#include <CGame.h>
Public Member Functions | |
CGame (HINSTANCE hInstance, char **pCommandLine) | |
virtual | ~CGame (void) |
bool | Create (char **pCommandLine, int pCommandLineCount) |
Creates the main parts of the game and establishes relationships to members. | |
void | Destroy (void) |
void | SwitchToGameMode (EGameMode GameMode) |
Private Member Functions | |
void | OnActivateApp (WPARAM wParam, LPARAM lParam) |
void | OnMove (WPARAM wParam, LPARAM lParam) |
void | OnKeyDown (WPARAM wParam, LPARAM lParam) |
void | OnKeyUp (WPARAM wParam, LPARAM lParam) |
void | OnPaint (WPARAM wParam, LPARAM lParam) |
bool | OnSysCommand (WPARAM wParam, LPARAM lParam) |
Handles system commands. | |
void | OnSize (WPARAM wParam, LPARAM lParam) |
void | OnJoystickAxis (WPARAM wParam, LPARAM lParam) |
void | OnJoystickButton (WPARAM wParam, LPARAM lParam) |
void | OnWindowActive (void) |
void | StartGameMode (EGameMode GameMode) |
void | FinishGameMode (void) |
CModeScreen * | GetGameModeObject (EGameMode GameMode) |
Private Attributes | |
EGameMode | m_GameMode |
Current game mode defining what to update. | |
HMODULE | m_hModule |
Connection to the resources. | |
HINSTANCE | m_hInstance |
Application instance handle. | |
CTimer | m_Timer |
Timer object for movement, animation, synchronization... | |
CDisplay | m_Display |
Needed to draw sprites and manage display. | |
CInput | m_Input |
Needed to read the players choices in menus, match, etc. | |
CSound | m_Sound |
Needed to play sounds and musics. | |
COptions | m_Options |
Options chosen by the players. | |
CScores | m_Scores |
Scores object where we keep the player scores and the draw games count. | |
CDrawGame | m_DrawGame |
Draw game screen object (happens when the previous match was a draw game). | |
CWinner | m_Winner |
Winner screen object (happens when a player just won one match). | |
CVictory | m_Victory |
Victory screen object (happens when a player has the score to reach). | |
CMatch | m_Match |
Match screen object in which the players fight. | |
CMenu | m_Menu |
Menu screen object for the user to choose the options. | |
CTitle | m_Title |
Title screen object with the main menu. | |
CControls | m_Controls |
Controls screen object. | |
CDemo | m_Demo |
Demo screen object in which we show a match betweeen computer players. | |
CMenuYesNo | m_MenuYesNo |
Yes/No message box object. | |
string | m_WindowTitle |
The CGame class is a window. It initializes itself using an application instance, then initializes the timer, the input, the display, the game screens objects, etc. It's the core of the game and manages switches between game modes (see EGameMode).
CGame::CGame | ( | HINSTANCE | hInstance, | |
char ** | pCommandLine | |||
) |
CGame::~CGame | ( | void | ) | [virtual] |
Change display mode if this is a F1-F4 key
Display modes #1 and #2 are not available in the 32-pixels version since the screen isn't large enough (so disable F1 and F2 keys)
Quickly exit the game with Ctrl + F12
Reimplemented from CWindow.
If the window has to be repainted, the display must be updated to redraw the game screen.
Reimplemented from CWindow.
void CGame::OnWindowActive | ( | void | ) | [private, virtual] |
This method is called when the window is active.
If the menu yes/no is not active
If the mode screen object corresponding to the current game mode is not asking for changing the game mode
Make the display black
Display the object corresponding to the current game mode
Display the menu yes/no if needed
Display everything (CDisplay::Update())
If the next game mode is different from the current game mode
<
Reimplemented from CWindow.
void CGame::StartGameMode | ( | EGameMode | GameMode | ) | [private] |
Set a new game mode. Creates the object corresponding to the new game mode.
void CGame::FinishGameMode | ( | void | ) | [private] |
Finish the current game mode
Destroy the object corresponding to the new game mode
Set no game mode
CModeScreen * CGame::GetGameModeObject | ( | EGameMode | GameMode | ) | [private] |
bool CGame::Create | ( | char ** | pCommandLine, | |
int | pCommandLineCount | |||
) |
Creates the main parts of the game and establishes relationships to members.
void CGame::Destroy | ( | void | ) |
void CGame::SwitchToGameMode | ( | EGameMode | GameMode | ) | [inline] |
EGameMode CGame::m_GameMode [private] |
Current game mode defining what to update.
HMODULE CGame::m_hModule [private] |
Connection to the resources.
HINSTANCE CGame::m_hInstance [private] |
Application instance handle.
CTimer CGame::m_Timer [private] |
Timer object for movement, animation, synchronization...
CDisplay CGame::m_Display [private] |
Needed to draw sprites and manage display.
CInput CGame::m_Input [private] |
Needed to read the players choices in menus, match, etc.
CSound CGame::m_Sound [private] |
Needed to play sounds and musics.
COptions CGame::m_Options [private] |
Options chosen by the players.
CScores CGame::m_Scores [private] |
Scores object where we keep the player scores and the draw games count.
CDrawGame CGame::m_DrawGame [private] |
Draw game screen object (happens when the previous match was a draw game).
CWinner CGame::m_Winner [private] |
Winner screen object (happens when a player just won one match).
CVictory CGame::m_Victory [private] |
Victory screen object (happens when a player has the score to reach).
CMatch CGame::m_Match [private] |
Match screen object in which the players fight.
CMenu CGame::m_Menu [private] |
Menu screen object for the user to choose the options.
CTitle CGame::m_Title [private] |
Title screen object with the main menu.
CControls CGame::m_Controls [private] |
Controls screen object.
CDemo CGame::m_Demo [private] |
Demo screen object in which we show a match betweeen computer players.
CMenuYesNo CGame::m_MenuYesNo [private] |
Yes/No message box object.
string CGame::m_WindowTitle [private] |