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
111 void initGame();
112
118 bool areThereInvadersLeft();
119
124 void handleScoreSaving();
125
131 Position invIndexToPos(unsigned x, unsigned y) const;
132
133 // drawing methods
134
139 void displayScore() const;
140
146 void displayAll(unsigned fps) const;
147
152 void displayGod() const;
153
160 void displayInvader(const Position& baseInvPos, InvaderType type) const;
161
166 void displayHearts(playerID) const;
167
168
169 // managers
170
175 void managePlayers();
176
182 void manageOnePlayer(playerID pID);
183
189 bool manageInvaders();
190
191 // collision things
192
197 void remCollidingProjectiles();
198
203 void moveMissiles();
204
209 void moveTorpedos();
210
215 void checkMissilesAndPlayers();
216
222 bool checkTorpedosAndInvaders();
223
229 bool invadersTouchPlayer() const;
230
235 void tryAwakeGod();
236
242 bool manageGod();
243
244public:
245 // in case someone wants to mess with the code, here's a minimal API, costs nothing to us
246
251 Game();
252
257 void managedGames();
258
265
271 bool reloadConfig();
272
278 bool arePlayersDead();
279};
280
281#endif
Main game class.
Definition: game.h:34
void managedGames()
manages and changes the states of the game
Definition: gameBasics.cpp:64
WinValue enterGameLoop()
enter the main gameplay game loop
Definition: gameBasics.cpp:116
bool reloadConfig()
reload the configuration file for a new game
Game()
constructor for the game class
Definition: gameBasics.cpp:21
bool arePlayersDead()
tells if all players are dead
Definition: gameBasics.cpp:176
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
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:54
nsGraphics::Vec2D Position
Definition: utils.h:53
WinValue
list of win values
Definition: utils.h:45