Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CGUIController Class Reference

CGUIController. More...

#include <GUIController.h>

Inheritance diagram for CGUIController:

CBGController COthelloController CTicTacToeController List of all members.

Public Member Functions

 CGUIController (QWidget *target)
 CGUIController.
 CGUIController (QWidget *target, uint32 studentID, const int8 *name, uint32 nameLength, CaffeineGUID gameID, bool bIsSpectator=false)
 CGUIController.
 ~CGUIController ()
 CGUIController.
void StartNewGame ()
 StartNewGame.
void Stop ()
 Stop.
bool IsUsingCaffeine () const
 IsUsingCaffeine.

Protected Member Functions

void run ()
 run
void PostEvent (CGameEvent *pGameEvent)
 PostEvent.
bool UserMove (CMove *)
 UserMove.
virtual void NewGame ()=0
 NewGame.
virtual void PlayMove (const CMove *m)=0
 PlayMove.
virtual bool CheckMove (CMove *m)=0
 CheckMove.
virtual bool CheckForWin ()=0
 CheckForWin.
virtual void UpdateCurrentPlayerPiece ()=0
 UpdateCurrentPlayerPiece.
virtual void SetPlayerPiece (const CPiece *p)=0
 SetPlayerPiece.
virtual void Play (const CPiece *p)=0
 Play.
virtual void TimeElapsed (const CPlayerPiece *piece)=0
 TimeElapsed.

Detailed Description

CGUIController.

Description: A generic base controller class for game GUIs.

Limitations: NONE


Constructor & Destructor Documentation

CGUIController::CGUIController QWidget *  target  ) 
 

CGUIController.

Description: Class constructor

Parameters:
target is the QWidget target for the custom event messages.
Limitations: NONE

CGUIController::CGUIController QWidget *  target,
uint32  studentID,
const int8 *  name,
uint32  nameLength,
CaffeineGUID  gameID,
bool  bIsSpectator = false
 

CGUIController.

Description: Class constructor

Parameters:
target is the QWidget target for the custom event messages.
studentID is the student ID of the person playing.
name is the name of the person playing as a ascii string.
nameLength is the length in bytes of the name string
gameID is the CaffeineGUID of the game that we are playing.
bIsSpectator is true if this GUI is to be a spectator.
Limitations: NONE

CGUIController::~CGUIController  ) 
 

CGUIController.

Description: Class deconstructor

Limitations: NONE


Member Function Documentation

virtual bool CGUIController::CheckForWin  )  [protected, pure virtual]
 

CheckForWin.

Description: Checks for a win condition. If true, the function will set the m_winningPiece variable accordingly.

Returns:
True if the game is over and someone has won and false if the game is not yet hit a end game condition.
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

virtual bool CGUIController::CheckMove CMove m  )  [protected, pure virtual]
 

CheckMove.

Description: Checks a move and returns true if it is valid and false otherwise.

Parameters:
m is the move that should be checked for validity.
Returns:
True if the move is valid and false otherwise
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

bool CGUIController::IsUsingCaffeine  )  const [inline]
 

IsUsingCaffeine.

Description: Returns true if we are using the Caffeine framework.

Returns:
True if using the Caffeine framework and false otherwise.
Limitations: NONE

virtual void CGUIController::NewGame  )  [protected, pure virtual]
 

NewGame.

Description: Initalizes the game board and sets the m_curPiece value to the first player that should play.

Returns:
void
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

virtual void CGUIController::Play const CPiece p  )  [protected, pure virtual]
 

Play.

Description: Tells the GUI to play a move. This is needed so that we can pass stochastic elements to the game controller (eg dice rolls).

Parameters:
p is piece information (eg dice rolls)
Returns:
void
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

virtual void CGUIController::PlayMove const CMove m  )  [protected, pure virtual]
 

PlayMove.

Description: Plays a move by updating the game board.

Parameters:
m is the move that should be made.
Returns:
void
Limitations: The move m must be a valid move.

Implemented in CBGController, COthelloController, and CTicTacToeController.

void CGUIController::PostEvent CGameEvent pGameEvent  )  [protected]
 

PostEvent.

Description: Posts an event to the target widget.

Parameters:
pGameEvent is the event to send to the target widget. The owner of this object is taken away and given to QApplication.
Returns:
void
Limitations: NONE

void CGUIController::run  )  [protected]
 

run

Description: The main function for this thread. It will process messages from the Caffeine Helper.

Returns:
void
Limitations: NONE

virtual void CGUIController::SetPlayerPiece const CPiece p  )  [protected, pure virtual]
 

SetPlayerPiece.

Description: This function is called when the player's piece should be set.

Parameters:
p is this player's piece.
Returns:
void
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

void CGUIController::StartNewGame  ) 
 

StartNewGame.

Description: Starts a new game and posts the event to the GUI for the first player to move if not connecting to Caffeine Client.

Returns:
void
Limitations: NONE

void CGUIController::Stop  ) 
 

Stop.

Description: Stops this thread.

Returns:
void
Limitations: NONE

virtual void CGUIController::TimeElapsed const CPlayerPiece piece  )  [protected, pure virtual]
 

TimeElapsed.

Description: Called when either a player's move time or game time has expired

Parameters:
piece is the CPlayerPiece* of the player whose time has expired
Returns:
void
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

virtual void CGUIController::UpdateCurrentPlayerPiece  )  [protected, pure virtual]
 

UpdateCurrentPlayerPiece.

Description: Updates the value of the m_curPiece variable to the piece that should play now.

Returns:
void
Limitations: NONE

Implemented in CBGController, COthelloController, and CTicTacToeController.

bool CGUIController::UserMove CMove m  )  [protected]
 

UserMove.

Description: Takes a move made by the user checks its validity and then plays the move if it is valid. It will also send the move along to the caffeine framework if needed.

Parameters:
m is the move that the user made
Returns:
True if the move was valid and played and false otherwise
Limitations: NONE


The documentation for this class was generated from the following files:
Copyright (c) 2005 Matt Bruns, Pat Hammond, Kevin Markussen, Travis Service, Brain Shaver

SourceForge.net Logo