#include <Game.h>
Public Member Functions | |
Game () | |
~Game () | |
int | Update (double deltaTime) |
void | Draw (double deltaTime) |
Protected Types | |
enum | State { MENU, SINGLEPLAYING, MULTIPLAYING, TUTORIAL, HIGHSCORE, DIFFICULTY } |
Possible gamestates. | |
Protected Member Functions | |
int | UpdateMainMenu (double deltaTime) |
void | UpdateSinglePlayerGame (double deltaTime) |
void | UpdateMultiplayerGame (double deltaTime) |
void | UpdateTutorial (double deltaTime) |
void | UpdateHighscoreTable (double deltaTime) |
void | UpdateDifficultyMenu (double deltaTime) |
void | Fadeout () |
void | Fadein (Menu *menu, double deltaTime) |
void | Fadein (Match *match, double deltaTime) |
Protected Attributes | |
State | m_state |
The current gamestate. | |
Background * | m_background |
The game's background. | |
MainMenu * | m_mainMenu |
The game's main menu. | |
SinglePlayerMatch * | m_singlePlayerMatch |
A singleplayer match. | |
MultiplayerMatch * | m_multiPlayerMatch |
A multiplayer match. | |
ExtendedTutorial * | m_tutorial |
A tutorial. | |
HighScoreTable * | m_highScoreTable |
The highscore table. | |
DifficultyMenu * | m_difficultyMenu |
Difficulty selection menu. | |
CIw2DFont * | m_font |
Font for drawing text to the screen. | |
CIwFVec2 | m_screenSize |
Screen dimensions (in pixels). | |
float | startTime |
Start time of the match (in ms). | |
float | matchTime |
Duration of the match. | |
Static Protected Attributes | |
static const int | m_fadeSpeed = 10 |
Speed for fading during scene transitions. |
Game class.
Game class which controls game states, updates, and rendering.
Game::Game | ( | ) |
Constructor.
Create a new game.
Game::~Game | ( | ) |
Destructor.
Destroy the game and release all associated memory.
void Game::Draw | ( | double | deltaTime | ) |
Draw.
Render the game.
[in] | deltaTime | Time since the last update. |
void Game::Fadein | ( | Menu * | menu, | |
double | deltaTime | |||
) | [protected] |
Fade in.
Fade in effect for gamestate changes (renders a menu derivitive in the background).
[in] | menu | The menu to be drawn during the fade transition. |
[in] | deltaTime | Time since the last update. |
void Game::Fadein | ( | Match * | match, | |
double | deltaTime | |||
) | [protected] |
Fade in.
Fade in effect for gamestate changes (renders a match derivitive in the background).
[in] | match | The match to be drawn during the fade transition. |
[in] | deltaTime | Time since the last update. |
void Game::Fadeout | ( | ) | [protected] |
Fadout.
Fadeout effect for gamestate changes.
int Game::Update | ( | double | deltaTime | ) |
Update.
Updates whichever state the game is currently in (playing, menu, tutorial, etc).
[in] | deltaTime | Time since the last update. |
void Game::UpdateDifficultyMenu | ( | double | deltaTime | ) | [protected] |
Update difficulty menu.
Updates the "choose difficulty" menu and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |
void Game::UpdateHighscoreTable | ( | double | deltaTime | ) | [protected] |
Update highscore table.
Updates a highscore table and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |
int Game::UpdateMainMenu | ( | double | deltaTime | ) | [protected] |
Update main menu.
Updates the main menu and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |
void Game::UpdateMultiplayerGame | ( | double | deltaTime | ) | [protected] |
Update multiplayer games.
Updates a multiplayer game and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |
void Game::UpdateSinglePlayerGame | ( | double | deltaTime | ) | [protected] |
Update singleplayer games.
Updates a singleplayer game and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |
void Game::UpdateTutorial | ( | double | deltaTime | ) | [protected] |
Update tutorial.
Updates a tutorial and sets the new gamestate depending on player input (if any).
[in] | deltaTime | Time since the last update. |