Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CGameState Class Reference

UI side information about the game. More...

#include <CGameState.h>

Collaboration diagram for CGameState:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TState { ENoGame, EPaused, ENextLevel }
 Game state. More...


Public Methods

TState State ()
 get game state. More...

void SetState (TState aState)
 set game state. More...

 ~CGameState ()
 destructor. More...

CHighScoresHighScores ()
 access high score table. More...


Static Public Methods

CGameState * NewL (const TDesC &aFileName)
 Leave safe construction. More...


Private Methods

 CGameState ()
 constructor. More...

void ConstructL (const TDesC &aFileName)
 2nd phase construction. More...


Private Attributes

CHighScoresiHighScores
 High score table. More...

TState iState
 Game state. More...


Detailed Description

UI side information about the game.

This contains the current game state and the high score table.

Definition at line 29 of file CGameState.h.


Member Enumeration Documentation

enum CGameState::TState
 

Game state.

Enumeration values:
ENoGame  No level loaded, start from first level.
EPaused  Level loaded, game thread paused.
ENextLevel  No level loaded, start from next level.

Definition at line 32 of file CGameState.h.

Referenced by SetState(), and State().

00032               {
00033     ENoGame, 
00034     EPaused, 
00035     ENextLevel 
00036   };


Constructor & Destructor Documentation

CGameState::~CGameState  
 

destructor.

Definition at line 95 of file CGameState.cpp.

References iHighScores.

00095                         {
00096   delete iHighScores;
00097 }

CGameState::CGameState   [private]
 

constructor.

Definition at line 54 of file CGameState.cpp.

00054                        : iState(ENoGame)  {
00055 
00056 }


Member Function Documentation

CGameState * CGameState::NewL const TDesC &    aFileName [static]
 

Leave safe construction.

Parameters:
aFileName  full path and filename of high score file

Definition at line 34 of file CGameState.cpp.

References ConstructL().

Referenced by CGameDocument::ConstructL().

00034                                                    {
00035   CGameState* self= new (ELeave) CGameState;
00036   CleanupStack::PushL(self);
00037   self->ConstructL(aFileName);
00038   CleanupStack::Pop(self);
00039   return(self);
00040 }

CGameState::TState CGameState::State  
 

get game state.

Definition at line 66 of file CGameState.cpp.

References iState, and TState.

Referenced by CGameAppView::Draw(), CGameAppUi::DynInitMenuPaneL(), CGameAppUi::HandleCommandL(), and CGameAppUi::LoadLevelL().

00066                                    {
00067   return iState;
00068 }

void CGameState::SetState CGameState::TState    aState
 

set game state.

Update the Cba buttons as nessesary

Definition at line 74 of file CGameState.cpp.

References ECmdCancelGame, ECmdContinueGame, ECmdStartGame, ENextLevel, ENoGame, EPaused, iState, and TState.

Referenced by CGameAppUi::ConstructL(), and CGameAppUi::HandleCommandL().

00074                                                  {
00075   iState=aState;
00076   CEikButtonGroupContainer* cba=CEikonEnv::Static()->AppUiFactory()->ToolBar();
00077   switch(iState) {
00078   case ENoGame:
00079     cba->DimCommand(ECmdCancelGame,ETrue);        
00080     cba->DimCommand(ECmdContinueGame,ETrue);
00081     cba->DimCommand(ECmdStartGame,EFalse);
00082     break;
00083   case EPaused:
00084   case ENextLevel:
00085     cba->DimCommand(ECmdCancelGame,EFalse);        
00086     cba->DimCommand(ECmdContinueGame,EFalse);
00087     cba->DimCommand(ECmdStartGame,ETrue);
00088     break;
00089   }
00090   cba->DrawNow();
00091 }

CHighScores & CGameState::HighScores  
 

access high score table.

Definition at line 59 of file CGameState.cpp.

References iHighScores.

Referenced by CGameAppView::DrawHighScores(), and CGameAppUi::HandleCommandL().

00059                                     {
00060   return *iHighScores;
00061 }

void CGameState::ConstructL const TDesC &    aFileName [private]
 

2nd phase construction.

Construct high score table

Parameters:
aFileName  full path and filename of high score file

Definition at line 49 of file CGameState.cpp.

References iHighScores, and CHighScores::NewL().

Referenced by NewL().

00049                                                   {
00050   iHighScores=CHighScores::NewL(aFileName);
00051 }


Member Data Documentation

CHighScores* CGameState::iHighScores [private]
 

High score table.

Definition at line 51 of file CGameState.h.

Referenced by ConstructL(), HighScores(), and ~CGameState().

TState CGameState::iState [private]
 

Game state.

Definition at line 52 of file CGameState.h.

Referenced by SetState(), and State().


The documentation for this class was generated from the following files:
Documentation for Game (Beta) version 1.44.