SDL SPOOKY PLATFORMER ENGINE  0.2.0
An implementation of a platformer using sdl, implemented using an entity component system and efficient collision management.
GameManager.hpp
Go to the documentation of this file.
1 #ifndef GAMEMANAGER_HPP
2 #define GAMEMANAGER_HPP
3 #include <SDL2/SDL.h>
4 #include "TickTimer.hpp"
5 #include "GameManager.hpp"
6 
8 #define ENEMY_FREEZE_TIME 3000
9 
11 #define ENEMY_FREEZE_COOLDOWN 5000 // in MS
12 
15 {
16 public:
17  ~GameManager();
18 
20  static GameManager &getInstance();
21 
23  void init();
24 
26  void shutdown();
27 
28  void Update();
29 
31  bool IsGameOver();
32 
34  void GameLost();
35 
37  unsigned int GetMSElapsed();
38 
40  void FreezeEnemies();
41 
43  void UnfreezeEnemies();
44 
47 
49 
50 private:
51  GameManager();
52  bool gameOver;
53  bool initialized;
54  TickTimer scoreTimer;
55  unsigned int lastTime;
56 
57 };
58 #endif
Definition: TickTimer.hpp:7
int lastFrozen
Definition: GameManager.hpp:48
void UnfreezeEnemies()
Unfreezes all enemies in the game.
Definition: GameManager.cpp:63
void FreezeEnemies()
Freezes all enemies in the game.
Definition: GameManager.cpp:56
unsigned int GetMSElapsed()
Return the amount of time that this game has been running for.
Definition: GameManager.cpp:49
bool IsGameOver()
Return whether the game has ended.
Definition: GameManager.cpp:41
void Update()
Definition: GameManager.cpp:29
void shutdown()
Close the game and cleanup references.
Definition: GameManager.cpp:25
void init()
Initialize the singleton GameManager.
Definition: GameManager.cpp:18
static GameManager & getInstance()
Return the singleton to represent the state of the game.
Definition: GameManager.cpp:13
void GameLost()
If the game is not already lost, it is ended when this function is called.
Definition: GameManager.cpp:45
~GameManager()
Definition: GameManager.cpp:7
Definition: GameManager.hpp:14
bool enemiesFrozen
Return whether all enemies are frozen.
Definition: GameManager.hpp:46