blob: b7486c8e000b3629ff47b3df31502a02dc7e6cf4 (
plain)
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
|
#ifndef _GAME_H
#define _GAME_H
#include "Player.h"
#include "Field.h"
#include <math.h>
#include <stdlib.h>
const PlayerColor playerColors[] = { 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0x88FF88, 0xFF8888};
const uint numColors = sizeof(playerColors)/sizeof(PlayerColor);
class Game
{
public:
Game(int width, int height, PlayerNumber num);
virtual ~Game(void);
void restart();
public:
void startGame();
void stopGame();
void pauseGame();
void resumeGame();
void toggleGame();
/**
* This function is to be called by the MainWindow at each Main loop iteration.
**/
void updateGame(uint timeElapsedMs);
Player& getPlayerByID(PlayerNumber id);
Field& getField();
private:
void init(int width, int height, PlayerNumber num);
static PlayerColor getColor(PlayerNumber n);
std::vector<Player> m_vPlayers;
bool m_gameStarted, m_gameRunning;
Field m_Field;
int m_width;
int m_height;
};
#endif
|