DisplayGame Class Reference

The display engine for the actual game. More...

#include <displaygame.h>

Inheritance diagram for DisplayGame:

Inheritance graph
[legend]
Collaboration diagram for DisplayGame:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DisplayGame (int advancePeriod, QGraphicsScene *scene, ThemeManager *theme, QGraphicsView *parent=0)
 Constructor for the game display.
 ~DisplayGame ()
 Destructor.
void start ()
 Start the display (setup and initialzation).
virtual void changeTheme ()
 Main theme function.
SpriteNotifydisplayPiece (int x, int y, int color, int no, bool animation)
 Set a game piece to a certain position on the game board.
void displayArrow (int x, int color)
 Sets the movement indicator arrow to the given position.
void displayHint (int x, int y, bool show)
 Sets the hint indicator on the game board.
void displayStar (int x, int y, int no)
 Sets on of the winning move indicator sprites on the game board.
int mapMouseToMove (QPoint pos)
 Transform the mouse coordinates to a game board movement coordinate.
void displayEnd ()
 Shows the game over sprite.
ScoreSpritescore ()
 Retrieve the score status sprite.

Protected Slots

void advance ()
 Run the main game animation (if existent).

Detailed Description

The display engine for the actual game.

Definition at line 44 of file displaygame.h.


Constructor & Destructor Documentation

DisplayGame::DisplayGame int  advancePeriod,
QGraphicsScene *  scene,
ThemeManager theme,
QGraphicsView *  parent = 0
 

Constructor for the game display.

Parameters:
advancePeriod The canvas advance period
scene The graphics scene
theme The theme manager
parent The parent window

Definition at line 47 of file displaygame.cpp.

DisplayGame::~DisplayGame  ) 
 

Destructor.

Definition at line 138 of file displaygame.cpp.


Member Function Documentation

void DisplayGame::advance  )  [protected, slot]
 

Run the main game animation (if existent).

This is done via a periodic timer.

Definition at line 221 of file displaygame.cpp.

void DisplayGame::changeTheme  )  [virtual]
 

Main theme function.

Called by the theme manager. Redraw and resize display.

Implements Themable.

Definition at line 150 of file displaygame.cpp.

References ThemeManager::config(), ThemeManager::getPixmap(), and Themable::thememanager().

Here is the call graph for this function:

void DisplayGame::displayArrow int  x,
int  color
 

Sets the movement indicator arrow to the given position.

Parameters:
x The x position [0-6]
color The arrow color [0:hide piece, 1: yellow, 2: red]

Definition at line 236 of file displaygame.cpp.

Referenced by KWin4View::displayMove().

void DisplayGame::displayEnd  ) 
 

Shows the game over sprite.

Definition at line 228 of file displaygame.cpp.

Referenced by KWin4View::endGame().

void DisplayGame::displayHint int  x,
int  y,
bool  show
 

Sets the hint indicator on the game board.

This is a little symbol to suggest where the next move is recommended to go.

Parameters:
x The x-position on the game board [0-6]
y The y-position on the game board [0-5]
show True to show the indicator, false to hide it.

Definition at line 257 of file displaygame.cpp.

References ThemeManager::config(), PixmapSprite::setPosition(), and Themable::thememanager().

Referenced by KWin4View::displayHint(), and KWin4View::displayMove().

Here is the call graph for this function:

SpriteNotify * DisplayGame::displayPiece int  x,
int  y,
int  color,
int  no,
bool  animation
 

Set a game piece to a certain position on the game board.

If an animation is requested the piece 'falls' to this position.

Parameters:
x The x-position on the game board [0-6]
y The y-position on the game board [0-5]
color Which color to use for the piece [0:hide piece, 1: yellow, 2: red]
no Which sprite to use for the piece [0-41]
animation True to use animation, false to just plot the piece
Returns:
The sprite notification object. Its signal indicate the end of the animation.

Definition at line 282 of file displaygame.cpp.

References ThemeManager::config(), Nobody, PieceSprite::notify(), PixmapSprite::setFrame(), PixmapSprite::setPosition(), PieceSprite::startLinear(), Themable::thememanager(), and Yellow.

Referenced by KWin4View::displayMove().

Here is the call graph for this function:

void DisplayGame::displayStar int  x,
int  y,
int  no
 

Sets on of the winning move indicator sprites on the game board.

They should be set on top of the winning pieces to show them.

Parameters:
x The x-position on the game board [0-6]
y The y-position on the game board [0-5]
no Which sprite to use for the piece [0-3]

Definition at line 362 of file displaygame.cpp.

References ThemeManager::config(), PixmapSprite::setAnimation(), PixmapSprite::setPosition(), and Themable::thememanager().

Referenced by KWin4View::displayStar().

Here is the call graph for this function:

int DisplayGame::mapMouseToMove QPoint  pos  ) 
 

Transform the mouse coordinates to a game board movement coordinate.

That is a coordinate [0-6] corresponding to a move on the board.

Parameters:
pos The mouse position.
Returns:
The game board position [0-6] or [-1] on error.

Definition at line 335 of file displaygame.cpp.

ScoreSprite * DisplayGame::score  ) 
 

Retrieve the score status sprite.

Returns:
The score sprite.

Definition at line 384 of file displaygame.cpp.

Referenced by KWin4View::initGame().

void DisplayGame::start  ) 
 

Start the display (setup and initialzation).

Definition at line 165 of file displaygame.cpp.

References ThemeManager::config(), and Themable::thememanager().

Referenced by KWin4View::initGame().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Sun Mar 4 10:56:43 2007 for KWin4 by  doxygen 1.4.6