-
Notifications
You must be signed in to change notification settings - Fork 9
/
Game.h
48 lines (38 loc) · 1.27 KB
/
Game.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef GAME_H
#define GAME_H
#include "World.h"
#include "Land.h"
#include "Player.h"
#include "AppState.h"
#include <cassert>
class Game : public AppState
{
public:
Game();
void draw(sf::RenderWindow &window);
void update(float dt);
void receiveMessage(const Message &msg);
void passEvent(sf::Event Event);
void reset();
void newGame(int n_players = 2,Land::Landtype land_t = Land::Random);
inline sf::Vector2f getLandNormal(int x,int y){ return land->getNormal(x,y); }
inline float getLandNormAng(int x,int y){ return land->getNormAngle(x,y); }
inline int getLandHeight(int x){ return land->getHeight(x); }
inline void incCounter() { ++counter; }
inline void decCounter() { --counter;assert(counter>=0); }
WorldObject* addWorldObj(WorldObject* wo){ return world.addObj(wo); }
size_t getPlayerIndex(){ return playerActive; }
Player* getCurrPlayer(){ return players[playerActive].get(); }
bool isPlayerTurn(){ return counter==0 && landSliding==false; }
private:
std::deque<Playerptr> players;
size_t playerActive;
//flags and counters
int counter; //weapons,effects,tanks on free fall etc. counter
bool landSliding;
Land *land;
World world;
private:
void handleInput();
};
#endif // GAME_H