breaking changes: optimizing code and added .clang-format
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#ifndef DATA_HPP
|
||||
#define DATA_HPP
|
||||
|
||||
#include "globals.hpp"
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
|
||||
struct Map {
|
||||
const char map[MAX_ROWS][MAX_COLS];
|
||||
};
|
||||
|
||||
struct Player {
|
||||
sf::Vector2<float> size { TILESIZE / 2.0f, TILESIZE / 2.0f };
|
||||
sf::Vector2<float> pos { TILESIZE, TILESIZE };
|
||||
float max_velocity_y { 15.0f };
|
||||
float border_size { -1.0f };
|
||||
|
||||
float dash_distance { 20.0f };
|
||||
sf::Vector2f velocity { 3.0f, 0 };
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -47,4 +47,13 @@ private:
|
||||
sf::Vector2f _min_velocity;
|
||||
};
|
||||
|
||||
struct player_data {
|
||||
sf::Vector2<float> size { TILESIZE / 2.0f, TILESIZE / 2.0f };
|
||||
sf::Vector2<float> pos { TILESIZE, TILESIZE };
|
||||
float max_velocity_y { 15.0f };
|
||||
float border_size { -1.0f };
|
||||
float dash_distance { 20.0f };
|
||||
sf::Vector2f velocity { 3.0f, 0 };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+10
-7
@@ -2,22 +2,25 @@
|
||||
#define MAPS_HPP
|
||||
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <array>
|
||||
#include "globals.hpp"
|
||||
#include "elements.hpp"
|
||||
|
||||
extern char test_level_0[MAX_ROWS][MAX_COLS];
|
||||
extern char test_level_1[MAX_ROWS][MAX_COLS];
|
||||
extern char test_level_2[MAX_ROWS][MAX_COLS];
|
||||
struct Level {
|
||||
char data[MAX_ROWS][MAX_COLS];
|
||||
std::string name;
|
||||
};
|
||||
|
||||
void clear_map(Entity* wall_list[MAX_ROWS][MAX_COLS]);
|
||||
void load_map(Entity* wall_list[MAX_ROWS][MAX_COLS], const char map_data[MAX_ROWS][MAX_COLS]);
|
||||
// void create_map(sf::RenderWindow &window, sf::Vector2i &local_position, sf::Vector2i &start_mouse_pos, sf::Vector2i &end_mouse_pos, bool &dragging, bool &prev_dragging, Entity *wall_list[MAX_ROWS][MAX_COLS]);
|
||||
extern Level levels[];
|
||||
|
||||
void clear_map(std::array<std::array<Entity*, MAX_COLS>, MAX_ROWS> wall_list);
|
||||
void load_map(std::array<std::array<Entity*, MAX_COLS>, MAX_ROWS> wall_list, const std::array<std::array<char, MAX_COLS>, MAX_ROWS> map_data);
|
||||
std::array<std::array<char, MAX_COLS>, MAX_ROWS> create_map(sf::RenderWindow &window,
|
||||
sf::Vector2i &local_position,
|
||||
sf::Vector2i &start_mouse_pos,
|
||||
sf::Vector2i &end_mouse_pos,
|
||||
bool &dragging,
|
||||
bool &prev_dragging,
|
||||
Entity *wall_list[MAX_ROWS][MAX_COLS]);
|
||||
std::array<std::array<Entity*, MAX_COLS>, MAX_ROWS> wall_list);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user