SUPER Space invader : Turbo edition DX - VS GOD 1.0.0
A simple space invader ripoff
game.h
Go to the documentation of this file.
1
13#ifndef GUARD_GAME_H
14#define GUARD_GAME_H
15#include <vector>
16#include "mingl/mingl.h"
18#include "utils.h"
19#include "playerDef.h"
20#include "player.h"
21#include "playMode.h"
22#include "configData.h"
23#include "projectiles.h"
24#include "scoresManager.h"
25#include "god.h"
26#include "invadersGrid.h"
27
28using namespace std;
29
34class Game {
35private:
36
40 MinGL window;
41
46 unique_ptr<PixelManager> pm;
47
51 ConfigData confData;
52
57
61 God god;
62
66 Position baseInvPos;
67
71 InvadersGrid grid;
72
76 bool direction;
77
81 vector<missile> missiles;
82
86 vector<Torpedo> torpedos;
87
91 PlayMode playMode;
92
96 vector<Player> players;
97
98 // invaders related variables
99
103 unsigned fireCooldown=0;
104
105 // basic methods
106
112 bool areThereInvadersLeft();
113
118 void handleScoreSaving();
119
127 Position invIndexToPos(unsigned x, unsigned y) const;
128
134 void displayAll(unsigned fps) const;
135
140 void displayGod() const;
141
148 void displayInvader(const Position& basePos, InvaderType type) const;
149
154 void displayHearts(playerID) const;
155
156
157 // managers
158
163 void managePlayers();
164
170 void manageOnePlayer(playerID pID);
171
177 bool manageInvaders();
178
179 // collision things
180
185 void remCollidingProjectiles();
186
191 void moveMissiles();
192
197 void moveTorpedos();
198
203 void checkMissilesAndPlayers();
204
210 bool checkTorpedosAndInvaders();
211
217 bool invadersTouchPlayer() const;
218
223 void tryAwakeGod();
224
230 bool manageGod();
231
232public:
233 // in case someone wants to mess with the code, here's a minimal public API, costs nothing to us
234
239 Game();
240
245 void managedGames();
246
251 void initGame();
252
259
265 bool reloadConfig();
266
272 bool arePlayersDead();
273};
274
275#endif
Main game class.
Definition: game.h:34
void managedGames()
start games managed by our class
Definition: gameBasics.cpp:63
WinValue enterGameLoop()
enter the main gameplay game loop. Will block until the game ends
Definition: gameBasics.cpp:115
void initGame()
Set or reset all the setting for a new game.
Definition: gameBasics.cpp:83
bool reloadConfig()
reload the configuration file (not dynamically used currently, but it was planned to be)
Game()
constructor for the game class
Definition: gameBasics.cpp:20
bool arePlayersDead()
tells if all players are dead
Definition: gameBasics.cpp:175
stores all God's data
Definition: god.h:47
manage the score in the game and inside the score file
Definition: scoresManager.h:51
Configuration file data storage.
Special entity known as "God"
InvaderType
List of all invader type.
Definition: invadersGrid.h:22
Manages screen display.
game mode options
PlayMode
List of all game playmode.
Definition: playMode.h:17
player data storage
player key configuration
projectiles data storage
Score file manager.
this struct stores all relevant data from the configuration file
Definition: configData.h:27
utilies for the game
unsigned playerID
Definition: utils.h:52
nsGraphics::Vec2D Position
Definition: utils.h:51
WinValue
list of win values
Definition: utils.h:43