#ifndef _GAME_H #define _GAME_H #include "Player.h" #include "Field.h" #include #include 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); virtual ~Game(void); public: /** * Pauses the game **/ void pauseGame(); /** * Resumes the game **/ void resumeGame(); /** * Toggle between pause & resume **/ void toggleGame(); /** * Returns true if the game is not paused **/ bool isRunning(); /** * Restarts the game. It will not be paused. All dead player will live again, at original positions and original directions. **/ void restart(); /** * Starts the game the first time. The game will be paused. **/ void start(); /** * Go for 1 round if enough time passed **/ void updateGame(uint timeElapsedMs); /** * Returns a specific player giver its ID **/ Player* getPlayerByID(PlayerNumber id); /** * Returns the field **/ Field& getField(); /** * Changed the size of the game and the field **/ void setSize(int width, int height); /** * Adds a new player with default parameters. **/ Player* addPlayer(); private: void initField(int width, int height); void initPlayer(Player* pPlayer, PlayerNumber playerID); void placePlayers(); static PlayerColor getColor(PlayerNumber n); void killPlayer(Player *player); std::vector m_vpPlayers; bool m_gameRunning; Field m_Field; int m_width; int m_height; }; #endif