CGame Class Reference

The main window class of Bombermaaan. More...

#include <CGame.h>

Inheritance diagram for CGame:

Inheritance graph
[legend]
Collaboration diagram for CGame:

Collaboration graph
[legend]

List of all members.

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)
CModeScreenGetGameModeObject (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


Detailed Description

The main window class of Bombermaaan.

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).


Constructor & Destructor Documentation

CGame::CGame ( HINSTANCE  hInstance,
char **  pCommandLine 
)

CGame::~CGame ( void   )  [virtual]


Member Function Documentation

void CGame::OnActivateApp ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnMove ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnKeyDown ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnKeyUp ( WPARAM  wParam,
LPARAM  lParam 
) [private, 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.

Here is the call graph for this function:

void CGame::OnPaint ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

If the window has to be repainted, the display must be updated to redraw the game screen.

See also:
CDisplay::OnPaint()

Reimplemented from CWindow.

Here is the call graph for this function:

bool CGame::OnSysCommand ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Handles system commands.

Todo:
: SCREEN SAVER DISABLING DOES NOT WORK

Reimplemented from CWindow.

void CGame::OnSize ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnJoystickAxis ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnJoystickButton ( WPARAM  wParam,
LPARAM  lParam 
) [private, virtual]

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::OnWindowActive ( void   )  [private, virtual]

This method is called when the window is active.

If the menu yes/no is not active

  • Update the object corresponding to the current game mode and let it tell the next game mode

If the mode screen object corresponding to the current game mode is not asking for changing the game mode

  • Then let the menu yes/no ask for changing the game mode if needed.
    • Manage the menu yes/no and get the appropriate game mode to set

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

  • Change the game mode

<

See also:
FinishGameMode()
<
See also:
StartGameMode()

Reimplemented from CWindow.

Here is the call graph for this function:

void CGame::StartGameMode ( EGameMode  GameMode  )  [private]

Set a new game mode. Creates the object corresponding to the new game mode.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGame::FinishGameMode ( void   )  [private]

Finish the current game mode

Destroy the object corresponding to the new game mode

Set no game mode

Here is the call graph for this function:

Here is the caller graph for this function:

CModeScreen * CGame::GetGameModeObject ( EGameMode  GameMode  )  [private]

Here is the caller graph for this function:

bool CGame::Create ( char **  pCommandLine,
int  pCommandLineCount 
)

Creates the main parts of the game and establishes relationships to members.

See also:
ENABLE_CONSOLE

ENABLE_LOG

ENABLE_SOUND

Here is the caller graph for this function:

void CGame::Destroy ( void   ) 

Here is the call graph for this function:

Here is the caller graph for this function:

void CGame::SwitchToGameMode ( EGameMode  GameMode  )  [inline]

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

EGameMode CGame::m_GameMode [private]

Current game mode defining what to update.

Connection to the resources.

HINSTANCE CGame::m_hInstance [private]

Application instance handle.

Timer object for movement, animation, synchronization...

Needed to draw sprites and manage display.

Needed to read the players choices in menus, match, etc.

Needed to play sounds and musics.

Options chosen by the players.

Scores object where we keep the player scores and the draw games count.

Draw game screen object (happens when the previous match was a draw game).

Winner screen object (happens when a player just won one match).

Victory screen object (happens when a player has the score to reach).

Match screen object in which the players fight.

CMenu CGame::m_Menu [private]

Menu screen object for the user to choose the options.

Title screen object with the main menu.

Controls screen object.

CDemo CGame::m_Demo [private]

Demo screen object in which we show a match betweeen computer players.

Yes/No message box object.

string CGame::m_WindowTitle [private]


The documentation for this class was generated from the following files:

Generated on Sat Oct 18 12:26:46 2008 for Bombermaaan by  doxygen 1.5.5
Visit the Bombermaaan project page
SourceForge.net Logo