diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-10 00:41:59 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-10 00:41:59 -0400 |
| commit | 7f0e8c7ef70c62814c274f110367db92f01cbb26 (patch) | |
| tree | 750bcfec923a826609034ebe9185014521400c68 /src/game.h | |
| parent | b53826079429939cdfbda073608cb85be8ba0738 (diff) | |
| download | therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.tar.gz therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.tar.bz2 therapy-7f0e8c7ef70c62814c274f110367db92f01cbb26.zip | |
C++11'd everything!
Also moved location information from physics components into entity.
Diffstat (limited to 'src/game.h')
| -rw-r--r-- | src/game.h | 38 |
1 files changed, 17 insertions, 21 deletions
| diff --git a/src/game.h b/src/game.h index 69224dc..c419c5d 100644 --- a/src/game.h +++ b/src/game.h | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | #ifndef GAME_H | 1 | #ifndef GAME_H |
| 2 | #define GAME_H | 2 | #define GAME_H |
| 3 | 3 | ||
| 4 | #include "components.h" | 4 | class Game; |
| 5 | |||
| 6 | #include "map.h" | ||
| 7 | #include <memory> | ||
| 8 | #include "entity.h" | ||
| 5 | 9 | ||
| 6 | const int TILE_WIDTH = 8; | 10 | const int TILE_WIDTH = 8; |
| 7 | const int TILE_HEIGHT = 8; | 11 | const int TILE_HEIGHT = 8; |
| @@ -15,29 +19,21 @@ const double SECONDS_PER_FRAME = 1.0 / FRAMES_PER_SECOND; | |||
| 15 | 19 | ||
| 16 | class Game { | 20 | class Game { |
| 17 | public: | 21 | public: |
| 18 | static Game& getInstance() | 22 | Game(); |
| 19 | { | 23 | void execute(GLFWwindow* window); |
| 20 | static Game instance; | 24 | void loadMap(Map& map); |
| 21 | 25 | void detectCollision(Entity& collider, std::pair<double, double> old_position); | |
| 22 | return instance; | ||
| 23 | } | ||
| 24 | |||
| 25 | ~Game(); | ||
| 26 | void execute(); | ||
| 27 | void loadMap(Map* map); | ||
| 28 | void input(int key, int action); | ||
| 29 | 26 | ||
| 30 | bool shouldQuit = false; | 27 | bool shouldQuit = false; |
| 31 | private: | 28 | private: |
| 32 | Game(); | 29 | friend void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); |
| 33 | Game(Game const&); | 30 | |
| 34 | void operator=(Game const&); | 31 | std::list<std::shared_ptr<Entity>> entities; |
| 35 | 32 | std::list<std::shared_ptr<Entity>> nextEntities; | |
| 36 | GLFWwindow* window; | 33 | bool newWorld; |
| 37 | World* world; | 34 | std::shared_ptr<Entity> player; |
| 38 | World* nextWorld; | 35 | Map m{"../maps/embarass.txt"}; |
| 39 | Map* m; | 36 | Map m2{"../maps/second.txt"}; |
| 40 | Map* m2; | ||
| 41 | }; | 37 | }; |
| 42 | 38 | ||
| 43 | #endif | 39 | #endif |
