DisplayTwo Class Reference

The display engine for a two player game. More...

#include <display_two.h>

Inheritance diagram for DisplayTwo:

Inheritance graph
[legend]
Collaboration diagram for DisplayTwo:

Collaboration graph
[legend]
List of all members.

Public Slots

void convertMousePress (QPoint mouse, int &playerNumber, int &cardNumber)
 Convert the position of a mouse click to a logical game position, that is position (up/down) and a card number (0-7).
void updatePlayer (Player *player)
 Connect a player with the score widget by setting the player properties to the score board.

Public Member Functions

 DisplayTwo (Deck *deck, QGraphicsScene *scene, ThemeManager *theme, int advancePeriod, QGraphicsView *parent)
 Constructor for the engine.
void start ()
 Start the display.
virtual void changeTheme ()
 Main theme function.
void deal (Player *player, int position)
void play (int cardNumber, int playerNumber, int phase)
 Play a card on the display.
void turn (int cardNumber)
 Turn a card on the display.
void remove (int winnerPosition, int cardNumber, int delta)
 Remove the given card from the display.
int shuffleTime ()
 Returns the time in milliseconds used for shuffling the initial cards.
void showScore (int position, int score)
 Display the score on the game board.
void showText (QString text)
 Display a text on the game board.
void showMove (int no=-1)
 Show the move icon for the given player.

Protected Member Functions

void calcXYFromNumber (int cardNumber, int &x, int &y)
 Calculate the x,y position values from a card number.
CardSpritegetCardSprite (int cardValue)
 Get a card sprite for a card value.

Detailed Description

The display engine for a two player game.

Definition at line 45 of file display_two.h.


Constructor & Destructor Documentation

DisplayTwo::DisplayTwo Deck deck,
QGraphicsScene *  scene,
ThemeManager theme,
int  advancePeriod,
QGraphicsView *  parent
 

Constructor for the engine.

Parameters:
deck The card deck
scene The graphics scene to work with
theme The theme manager
advancePeriod The advance period [ms]
parent The parent object

Definition at line 47 of file display_two.cpp.

References AbstractDisplay::mAdvancePeriod, AbstractDisplay::mSprites, AbstractDisplay::mTheme, AbstractDisplay::scene(), and ThemeManager::updateTheme().

Here is the call graph for this function:


Member Function Documentation

void DisplayTwo::calcXYFromNumber int  cardNumber,
int &  x,
int &  y
[protected]
 

Calculate the x,y position values from a card number.

Parameters:
cardNumber The card number [0-7]
x The board x coordinate [0-3]
y The board y coordinate [0-1]

Definition at line 281 of file display_two.cpp.

void DisplayTwo::changeTheme  )  [virtual]
 

Main theme function.

Called by the theme manager. Redraw and resize display.

Implements Themable.

Definition at line 107 of file display_two.cpp.

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

Here is the call graph for this function:

void DisplayTwo::convertMousePress QPoint  mouse,
int &  playerNumber,
int &  cardNumber
[virtual, slot]
 

Convert the position of a mouse click to a logical game position, that is position (up/down) and a card number (0-7).

Parameters:
mouse The mouse coordinates [screen coordinates]
playerNumber The resulting player number [0-1]
cardNumber The resulting card number [0-7]

Implements AbstractDisplay.

Definition at line 230 of file display_two.cpp.

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

void DisplayTwo::deal Player player,
int  position
 

Definition at line 159 of file display_two.cpp.

References ThemeManager::config(), Player::getCard(), AbstractDisplay::mCards, CardSprite::setPosition(), CardSprite::setShuffleMove(), Themable::thememanager(), and TIME_DELAY_SHUFFLE.

Referenced by EngineTwo::startGame().

Here is the call graph for this function:

CardSprite * DisplayTwo::getCardSprite int  cardValue  )  [protected]
 

Get a card sprite for a card value.

Parameters:
cardValue The card value [0-31]
Returns:
The sprite.

Definition at line 289 of file display_two.cpp.

References AbstractDisplay::mCards.

Referenced by play(), remove(), and turn().

void DisplayTwo::play int  cardNumber,
int  playerNumber,
int  phase
[virtual]
 

Play a card on the display.

The card is moved from its current position to the card deposit.

Parameters:
cardNumber The card number (0-7)
playerNumber The player number (0-1)
phase Movement phase (1st part, 2nd part, etc) [optional]

Implements AbstractDisplay.

Definition at line 304 of file display_two.cpp.

References ThemeManager::config(), getCardSprite(), CardSprite::setMove(), and Themable::thememanager().

Referenced by EngineTwo::playerInput().

Here is the call graph for this function:

void DisplayTwo::remove int  winnerPosition,
int  cardNumber,
int  delta
[virtual]
 

Remove the given card from the display.

Parameters:
winnerPosition The position of the winner (0,1)
cardNumber The number of the card
delta Card offset from target position (0,1,2,...)

Implements AbstractDisplay.

Definition at line 335 of file display_two.cpp.

References ThemeManager::config(), getCardSprite(), CardSprite::setRemove(), and Themable::thememanager().

Referenced by EngineTwo::gameLoopFinish().

Here is the call graph for this function:

void DisplayTwo::showMove int  no = -1  ) 
 

Show the move icon for the given player.

Parameters:
no The player number (-1: show none)

Definition at line 381 of file display_two.cpp.

Referenced by EngineTwo::gameLoopFinish().

void DisplayTwo::showScore int  position,
int  score
 

Display the score on the game board.

Parameters:
position Which player position
score The score to display

Definition at line 369 of file display_two.cpp.

References TextSprite::setText().

Referenced by EngineTwo::evaluateGame().

Here is the call graph for this function:

void DisplayTwo::showText QString  text  ) 
 

Display a text on the game board.

Parameters:
text The text to display

Definition at line 361 of file display_two.cpp.

References TextSprite::setText().

Referenced by EngineTwo::evaluateGame().

Here is the call graph for this function:

int DisplayTwo::shuffleTime  ) 
 

Returns the time in milliseconds used for shuffling the initial cards.

Returns:
The time in milliseconds [ms].

Definition at line 223 of file display_two.cpp.

References TIME_DELAY_AFTER_SHUFFLE, and TIME_DELAY_SHUFFLE.

void DisplayTwo::start  )  [virtual]
 

Start the display.

Implements AbstractDisplay.

Definition at line 121 of file display_two.cpp.

References AbstractDisplay::mCards.

void DisplayTwo::turn int  cardNumber  )  [virtual]
 

Turn a card on the display.

The card is flipped backside to frontside.

Parameters:
cardNumber The card number (0-7)

Implements AbstractDisplay.

Definition at line 327 of file display_two.cpp.

References getCardSprite(), and CardSprite::setTurning().

Referenced by EngineTwo::playerInput().

Here is the call graph for this function:

void DisplayTwo::updatePlayer Player player  )  [slot]
 

Connect a player with the score widget by setting the player properties to the score board.

Parameters:
player The player to set

Definition at line 146 of file display_two.cpp.

References Player::games(), Player::id(), Player::input(), Player::name(), Player::points(), Player::score(), ScoreSprite::setGames(), ScoreSprite::setInput(), ScoreSprite::setPlayerName(), ScoreSprite::setPoints(), ScoreSprite::setScore(), ScoreSprite::setTrump(), Player::trump(), AbstractInput::type(), and Player::wonGames().


The documentation for this class was generated from the following files:
Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6