diff options
Diffstat (limited to 'src/game.h')
| -rw-r--r-- | src/game.h | 80 |
1 files changed, 41 insertions, 39 deletions
| diff --git a/src/game.h b/src/game.h index dd4b2f7..346d67e 100644 --- a/src/game.h +++ b/src/game.h | |||
| @@ -1,45 +1,47 @@ | |||
| 1 | #ifndef GAME_H | 1 | #ifndef GAME_H_1014DDC9 |
| 2 | #define GAME_H | 2 | #define GAME_H_1014DDC9 |
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include "renderer.h" |
| 5 | #include <functional> | 5 | #include "entity_manager.h" |
| 6 | #include <list> | 6 | #include "system_manager.h" |
| 7 | #include <map> | ||
| 8 | #include "map.h" | ||
| 9 | #include "world.h" | 7 | #include "world.h" |
| 10 | 8 | ||
| 11 | class Entity; | 9 | class Game { |
| 12 | struct GLFWwindow; | 10 | public: |
| 13 | 11 | ||
| 14 | struct Savefile { | 12 | Game(GLFWwindow* window); |
| 15 | const Map* map; | ||
| 16 | std::pair<double, double> position; | ||
| 17 | }; | ||
| 18 | 13 | ||
| 19 | class Game { | 14 | void execute(); |
| 20 | public: | 15 | |
| 21 | Game(const char* maps); | 16 | inline EntityManager& getEntityManager() |
| 22 | void execute(GLFWwindow* window); | 17 | { |
| 23 | void loadMap(const Map& map, std::pair<double, double> position); | 18 | return entityManager_; |
| 24 | void detectCollision(Entity& collider, std::pair<double, double> old_position); | 19 | } |
| 25 | void saveGame(); | 20 | |
| 26 | void schedule(double time, std::function<void ()> callback); | 21 | inline SystemManager& getSystemManager() |
| 27 | void playerDie(); | 22 | { |
| 28 | const World& getWorld() const; | 23 | return systemManager_; |
| 29 | 24 | } | |
| 30 | private: | 25 | |
| 31 | friend void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); | 26 | inline const World& getWorld() |
| 32 | 27 | { | |
| 33 | std::list<std::shared_ptr<Entity>> entities; | 28 | return world_; |
| 34 | std::list<std::shared_ptr<Entity>> nextEntities; | 29 | } |
| 35 | std::pair<double, double> nextPosition; | 30 | |
| 36 | bool newWorld; | 31 | friend void key_callback( |
| 37 | std::shared_ptr<Entity> player; | 32 | GLFWwindow* window, |
| 38 | const Map* currentMap; | 33 | int key, |
| 39 | Savefile save; | 34 | int scancode, |
| 40 | std::list<std::pair<double, std::function<void ()>>> scheduled; | 35 | int action, |
| 41 | bool shouldQuit = false; | 36 | int mods); |
| 42 | World world; | 37 | |
| 38 | private: | ||
| 39 | |||
| 40 | GLFWwindow* const window_; | ||
| 41 | EntityManager entityManager_; | ||
| 42 | SystemManager systemManager_; | ||
| 43 | World world_; | ||
| 44 | bool shouldQuit_ = false; | ||
| 43 | }; | 45 | }; |
| 44 | 46 | ||
| 45 | #endif | 47 | #endif /* end of include guard: GAME_H_1014DDC9 */ |
