GEJM  1.0.0.0
a 2D platformer made by students
Game.h
1 #ifndef GAME_H
2 #define GAME_H
3 
4 #include "Object.h"
5 #include "Physics.h"
6 #include "Controller.h"
7 #include "PlayerController.h"
8 #include <algorithm>
9 #include <list>
10 #include <ctime>
11 
16 enum class GameState
17 {
21  Menu,
22 
26  Playing,
27 
31  Paused,
32 
36  Won,
37 
41  Lost,
42 
46  Quit
47 };
48 
53 class Game
54 {
55 public:
61  Game();
62 
67  ~Game();
68 
73  void gameLoop();
74 
79  void startGame();
80 
85  void pauseGame();
86 
91  void resumeGame();
92 
97  void quitToMenu();
98 
103  void gameOver();
104 
109  void wonGame();
110 
116  void loadLevel();
117 
122  void unloadLevel();
123 
128  GameState getGameState() const;
129 
134  PlayerController* getPlayerController() const;
135 
140  bool getHasEnded() const;
141 
146  bool getPosUpdated() const;
147 
152  int getLevelWidth() const;
153 
158  int getLevelHeight() const;
159 
164  Uint8 getLevelCoins() const;
165 
170  double getPosAlpha() const;
171 
176  std::list<Object*> const& getObjectList() const;
177 private:
181  std::list<Object*> objectList;
182 
186  GameState gameState;
187 
191  bool posUpdated;
192 
196  int levelWidth;
197 
201  int levelHeight;
202 
206  Uint8 levelCoins;
207 
211  bool levelLoaded;
212 
216  double posAlpha;
217 
221  PlayerController* playerController;
222 
226  std::list<Controller*> controllerList;
227 
231  Physics* physics;
232 
237  void checkPositions();
238 };
239 
240 #endif // GAME_H
Definition: PlayerController.h:13
Definition: Physics.h:29
Definition: Game.h:53