PixmapSprite Class Reference

This sprite is used to display a pixmap on the canvas. More...

#include <pixmapsprite.h>

Inheritance diagram for PixmapSprite:

Inheritance graph
[legend]
Collaboration diagram for PixmapSprite:

Collaboration graph
[legend]
List of all members.

Public Types

enum  AnimationState { Idle, Animated }
 Possible animation states of the sprite. More...

Public Member Functions

 PixmapSprite (int advancePeriod, int no, QGraphicsScene *scene)
 Constructor for the sprite.
 PixmapSprite (QString id, ThemeManager *theme, int advancePeriod, int no, QGraphicsScene *scene)
 Constructor for the sprite.
virtual void advance (int phase)
 Standard QGI advance function.
virtual int type () const
 Retrieve the type of QGI.
int number ()
 Retrieve the user defined sprite number (i.e.
virtual void changeTheme ()
 Main theme manager function.
void setFrame (int no, bool force=false)
 Choose a pixmap frame of this sprite.
void setAnimation (int start, int end, int delay)
 Initalize and start a frame animation between the start and end frame.
void setAnimation (bool status)
 Start or stop an animation.
void setPosition (QPointF pos)
 Set/Move the sprite to the given position.
double getDoubleValue (QString item)
 Reads a theme configuration item of type double and of the given name.

Protected Attributes

int mNo
 The user defined sprite number.
int mAdvancePeriod
 The canvas advance peridod (e.g.
QString mId
 The theme id.
AnimationState mAnimationState
 The state of the animation.
QPointF mStart
 The position of the sprite [rel 0.
int mStartFrame
 The first frame in the frame animation.
int mEndFrame
 The last frame in the frame animation.
int mDelay
 The delay between two frames in the frame animation.
int mTime
 The current running time for the animation.
int mCurrentFrame
 The current running frame number for the animation.
QList< QPixmap > mFrames
 Storage of the frame pixmaps.
QList< QPointF > mHotspots
 Storage of the frame pixmap offset points.

Detailed Description

This sprite is used to display a pixmap on the canvas.

It can be animated and it is themable.

Definition at line 35 of file pixmapsprite.h.


Member Enumeration Documentation

enum PixmapSprite::AnimationState
 

Possible animation states of the sprite.

Enumerator:
Idle 
Animated 

Definition at line 57 of file pixmapsprite.h.


Constructor & Destructor Documentation

PixmapSprite::PixmapSprite int  advancePeriod,
int  no,
QGraphicsScene *  scene
 

Constructor for the sprite.

Parameters:
advancePeriod The advance period time [ms]
no A user defined ID number
scene The graphics scene

Definition at line 51 of file pixmapsprite.cpp.

References Idle, mAdvancePeriod, mAnimationState, mCurrentFrame, and mNo.

Referenced by ScoreSprite::ScoreSprite().

PixmapSprite::PixmapSprite QString  id,
ThemeManager theme,
int  advancePeriod,
int  no,
QGraphicsScene *  scene
 

Constructor for the sprite.

Parameters:
id The theme file ID string
theme The theme manager
advancePeriod The advance period time [ms]
no A user defined ID number
scene The graphics scene

Definition at line 36 of file pixmapsprite.cpp.

References Idle, mAdvancePeriod, mAnimationState, mCurrentFrame, mNo, and ThemeManager::updateTheme().

Here is the call graph for this function:


Member Function Documentation

void PixmapSprite::advance int  phase  )  [virtual]
 

Standard QGI advance function.

Parameters:
phase The advance phase

Reimplemented in ScoreSprite.

Definition at line 210 of file pixmapsprite.cpp.

References Animated, mAdvancePeriod, mAnimationState, mCurrentFrame, mDelay, mEndFrame, mStartFrame, mTime, and setFrame().

Referenced by ScoreSprite::advance().

Here is the call graph for this function:

void PixmapSprite::changeTheme  )  [virtual]
 

Main theme manager function.

Called when any theme change like a new theme or a theme size change occurs. This object needs to resiez and redraw then.

Implements Themable.

Reimplemented in ScoreSprite.

Definition at line 65 of file pixmapsprite.cpp.

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

Referenced by ScoreSprite::changeTheme().

Here is the call graph for this function:

double PixmapSprite::getDoubleValue QString  item  ) 
 

Reads a theme configuration item of type double and of the given name.

Deprecated:
Thsi is debug only
Parameters:
item The theme configuration item name
Returns:
The read double value.

Definition at line 160 of file pixmapsprite.cpp.

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

Here is the call graph for this function:

int PixmapSprite::number  )  [inline]
 

Retrieve the user defined sprite number (i.e.

which PixmapSprite)

Returns:
The sprite numbers.

Definition at line 72 of file pixmapsprite.h.

References mNo.

void PixmapSprite::setAnimation bool  status  ) 
 

Start or stop an animation.

Parameters:
status True to start and false to stop the animation

Definition at line 176 of file pixmapsprite.cpp.

References Animated, Idle, mAnimationState, mStartFrame, mTime, and setFrame().

Here is the call graph for this function:

void PixmapSprite::setAnimation int  start,
int  end,
int  delay
 

Initalize and start a frame animation between the start and end frame.

The delay between the frames is given in [ms]. After the last frame is displayed the animation starts with the first frame.

Parameters:
start The start frame number
end The end frame number
delay Delay between a frame change [ms]

Definition at line 186 of file pixmapsprite.cpp.

References mDelay, mEndFrame, and mStartFrame.

void PixmapSprite::setFrame int  no,
bool  force = false
 

Choose a pixmap frame of this sprite.

If the setting is forced a redraw is even performed when the frame number stays the same. This is important for theme changes.

Parameters:
no The new frame number (0..)
force Force redraw

Definition at line 197 of file pixmapsprite.cpp.

References mCurrentFrame, mFrames, and mHotspots.

Referenced by advance(), ScoreSprite::changeTheme(), setAnimation(), ScoreSprite::setInput(), and ScoreSprite::setTrump().

void PixmapSprite::setPosition QPointF  pos  ) 
 

Set/Move the sprite to the given position.

The position is given in relative coordinates [0..1, 0..1] to its parent object. Thus the position is scaled with the scale from the theme manager.

Parameters:
pos The position of the sprite [0..1, 0..1]

Definition at line 168 of file pixmapsprite.cpp.

References Themable::getScale(), and mStart.

Here is the call graph for this function:

virtual int PixmapSprite::type  )  const [inline, virtual]
 

Retrieve the type of QGI.

This item is UserType+3

Returns:
The type of item.

Reimplemented in ScoreSprite.

Definition at line 67 of file pixmapsprite.h.


Member Data Documentation

int PixmapSprite::mAdvancePeriod [protected]
 

The canvas advance peridod (e.g.

25) [ms]

Definition at line 125 of file pixmapsprite.h.

Referenced by advance(), and PixmapSprite().

AnimationState PixmapSprite::mAnimationState [protected]
 

The state of the animation.

Definition at line 133 of file pixmapsprite.h.

Referenced by advance(), PixmapSprite(), and setAnimation().

int PixmapSprite::mCurrentFrame [protected]
 

The current running frame number for the animation.

Definition at line 157 of file pixmapsprite.h.

Referenced by advance(), PixmapSprite(), and setFrame().

int PixmapSprite::mDelay [protected]
 

The delay between two frames in the frame animation.

Definition at line 149 of file pixmapsprite.h.

Referenced by advance(), and setAnimation().

int PixmapSprite::mEndFrame [protected]
 

The last frame in the frame animation.

Definition at line 145 of file pixmapsprite.h.

Referenced by advance(), and setAnimation().

QList<QPixmap> PixmapSprite::mFrames [protected]
 

Storage of the frame pixmaps.

Definition at line 161 of file pixmapsprite.h.

Referenced by changeTheme(), and setFrame().

QList<QPointF> PixmapSprite::mHotspots [protected]
 

Storage of the frame pixmap offset points.

Definition at line 165 of file pixmapsprite.h.

Referenced by changeTheme(), and setFrame().

QString PixmapSprite::mId [protected]
 

The theme id.

Reimplemented from Themable.

Definition at line 129 of file pixmapsprite.h.

int PixmapSprite::mNo [protected]
 

The user defined sprite number.

Definition at line 121 of file pixmapsprite.h.

Referenced by number(), and PixmapSprite().

QPointF PixmapSprite::mStart [protected]
 

The position of the sprite [rel 0.

.1, rel 0..1]

Definition at line 137 of file pixmapsprite.h.

Referenced by setPosition().

int PixmapSprite::mStartFrame [protected]
 

The first frame in the frame animation.

Definition at line 141 of file pixmapsprite.h.

Referenced by advance(), and setAnimation().

int PixmapSprite::mTime [protected]
 

The current running time for the animation.

Definition at line 153 of file pixmapsprite.h.

Referenced by advance(), and setAnimation().


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