KWin4View Class Reference

The view object which shows the graphics for the game. More...

#include <kwin4view.h>

Inheritance diagram for KWin4View:

Inheritance graph
[legend]
Collaboration diagram for KWin4View:

Collaboration graph
[legend]
List of all members.

Public Slots

void updateAndAdvance ()
 The update and advance for the canvas.
void mouseInput (KGameIO *input, QDataStream &stream, QMouseEvent *mouse, bool *eatevent)
 Handle mouse inputs for the KGame framework.
void keyInput (KGameIO *input, QDataStream &stream, QKeyEvent *key, bool *eatevent)
 Handle key inputs for the KGame framework.
void moveDone (QGraphicsItem *item, int mode)
 Animation of a sprite is finised.

Signals

void signalMoveDone (int mode)
 Emit this signal if a sprite animation move is finished.

Public Member Functions

 KWin4View (QSize size, int advancePeriod, QGraphicsScene *scene, ThemeManager *theme, QWidget *parent=0)
 Constructor for the canvas view.
 ~KWin4View ()
 Desstructor.
void initGame (Score *scoreData)
 Initial setup of the game view.
void endGame ()
 Finalize (end) game.
void displayMove (int x, int y, int color, int xarrow, int colorarrow, int no, bool animation)
 Displays a move on the game board.
void displayStar (int x, int y, int no)
 Displays a star on the game board to indicate victorious pieces.
void displayHint (int x, int y)
 Displays a hint on the game board to indicate a good move.

Protected Member Functions

void resizeEvent (QResizeEvent *e)
 Will be called when the widgets contents are resized.

Detailed Description

The view object which shows the graphics for the game.

Definition at line 72 of file kwin4view.h.


Constructor & Destructor Documentation

KWin4View::KWin4View QSize  size,
int  advancePeriod,
QGraphicsScene *  scene,
ThemeManager theme,
QWidget *  parent = 0
 

Constructor for the canvas view.

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

Definition at line 54 of file kwin4view.cpp.

References ThemeManager::rescale(), DisplayIntro::start(), and updateAndAdvance().

Here is the call graph for this function:

KWin4View::~KWin4View  ) 
 

Desstructor.

Definition at line 99 of file kwin4view.cpp.


Member Function Documentation

void KWin4View::displayHint int  x,
int  y
 

Displays a hint on the game board to indicate a good move.

Parameters:
x The x position on the game board [0-6]
y The y position on the game board [0-5]

Definition at line 252 of file kwin4view.cpp.

References DisplayGame::displayHint().

Referenced by KWin4Doc::processAIHintCommand().

Here is the call graph for this function:

void KWin4View::displayMove int  x,
int  y,
int  color,
int  xarrow,
int  colorarrow,
int  no,
bool  animation
 

Displays a move on the game board.

This means a piece of the given number is moved to the given position, the move indicator arrow is switched on and any hints are disabed. The move can be performed animated or not.

Parameters:
x The x position on the game board [0-6]
y The y position on the game board [0-5]
color The color [Red,Yellow,Nobody]
xarrow The x position of the arrow [0-6]
colorarrow The color or the arrow [Red,Yellow,Nobody]
no The sprite number / move number
animation True to make an animated move

Definition at line 229 of file kwin4view.cpp.

References DisplayGame::displayArrow(), DisplayGame::displayHint(), DisplayGame::displayPiece(), and moveDone().

Referenced by KWin4Doc::makeMove(), and KWin4Doc::undoMove().

Here is the call graph for this function:

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

Displays a star on the game board to indicate victorious pieces.

Parameters:
x The x position on the game board [0-6]
y The y position on the game board [0-5]
no The sprite number / move number

Definition at line 246 of file kwin4view.cpp.

References DisplayGame::displayStar().

Here is the call graph for this function:

void KWin4View::endGame  ) 
 

Finalize (end) game.

Definition at line 134 of file kwin4view.cpp.

References DisplayGame::displayEnd().

Referenced by KWin4Doc::endGame().

Here is the call graph for this function:

void KWin4View::initGame Score scoreData  ) 
 

Initial setup of the game view.

Definition at line 116 of file kwin4view.cpp.

References DisplayGame::score(), Score::setDisplay(), and DisplayGame::start().

Here is the call graph for this function:

void KWin4View::keyInput KGameIO *  input,
QDataStream &  stream,
QKeyEvent *  key,
bool *  eatevent
[slot]
 

Handle key inputs for the KGame framework.

Parameters:
input The IO device
stream The KGame message stream
key The key event
eatevent Set to true if the event was processed

Definition at line 197 of file kwin4view.cpp.

void KWin4View::mouseInput KGameIO *  input,
QDataStream &  stream,
QMouseEvent *  mouse,
bool *  eatevent
[slot]
 

Handle mouse inputs for the KGame framework.

Parameters:
input The IO device
stream The KGame message stream
mouse The mouse event
eatevent Set to true if the event was processed

Definition at line 164 of file kwin4view.cpp.

void KWin4View::moveDone QGraphicsItem *  item,
int  mode
[slot]
 

Animation of a sprite is finised.

Parameters:
item The item
mode A user defined mode

Definition at line 258 of file kwin4view.cpp.

References signalMoveDone().

Referenced by displayMove().

void KWin4View::resizeEvent QResizeEvent *  e  )  [protected]
 

Will be called when the widgets contents are resized.

Resized and rescale game.

Parameters:
e The resize event

Definition at line 142 of file kwin4view.cpp.

References ThemeManager::rescale(), and VIEW_ASPECT_RATIO.

Here is the call graph for this function:

void KWin4View::signalMoveDone int  mode  )  [signal]
 

Emit this signal if a sprite animation move is finished.

Parameters:
mode A user defined parameter.

Referenced by moveDone().

void KWin4View::updateAndAdvance  )  [slot]
 

The update and advance for the canvas.

This is called by a timer at regular intervals.

Definition at line 107 of file kwin4view.cpp.

Referenced by KWin4View().


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