AnimatedSprite Class Reference

#include <animatedsprite.h>

List of all members.


Detailed Description

Animates a sprite by adding playback state.

Definition at line 37 of file animatedsprite.h.


Public Member Functions

 AnimatedSprite (SpriteDef *sprite)
 Constructor.
 ~AnimatedSprite ()
 Destructor.
void reset ()
 Resets the animated sprite.
void play (SpriteAction action)
 Plays an action using the current direction.
void update (int time)
 Inform the animation of the passed time so that it can output the correct animation frame.
bool draw (Graphics *graphics, int posX, int posY) const
 Draw the current animation frame at the coordinates given in screen pixels.
int getWidth () const
 gets the width in pixels of the image of the current frame
int getHeight () const
 gets the height in pixels of the image of the current frame
void setDirection (SpriteDirection direction)
 Sets the direction.

Static Public Member Functions

static AnimatedSpriteload (const std::string &filename, int variant=0)
 An helper function, which will request the sprite to animate from the resource manager.

Private Member Functions

bool updateCurrentAnimation (unsigned int dt)

Private Attributes

SpriteDirection mDirection
 The sprite direction.
int mLastTime
 The last time update was called.
unsigned int mFrameIndex
 The index of the current frame.
unsigned int mFrameTime
 The time since start of frame.
SpriteDefmSprite
 The sprite definition.
ActionmAction
 The currently active action.
AnimationmAnimation
 The currently active animation.
FramemFrame
 The currently active frame.

Constructor & Destructor Documentation

AnimatedSprite::AnimatedSprite ( SpriteDef sprite  ) 

Constructor.

Parameters:
sprite the sprite to animate

Definition at line 35 of file animatedsprite.cpp.

AnimatedSprite::~AnimatedSprite (  ) 

Destructor.

Definition at line 65 of file animatedsprite.cpp.


Member Function Documentation

AnimatedSprite * AnimatedSprite::load ( const std::string &  filename,
int  variant = 0 
) [static]

An helper function, which will request the sprite to animate from the resource manager.

Parameters:
filename the file of the sprite to animate
variant the sprite variant

Definition at line 54 of file animatedsprite.cpp.

void AnimatedSprite::reset (  ) 

Resets the animated sprite.

Definition at line 70 of file animatedsprite.cpp.

void AnimatedSprite::play ( SpriteAction  action  ) 

Plays an action using the current direction.

Definition at line 77 of file animatedsprite.cpp.

void AnimatedSprite::update ( int  time  ) 

Inform the animation of the passed time so that it can output the correct animation frame.

Definition at line 95 of file animatedsprite.cpp.

bool AnimatedSprite::draw ( Graphics graphics,
int  posX,
int  posY 
) const

Draw the current animation frame at the coordinates given in screen pixels.

Definition at line 143 of file animatedsprite.cpp.

int AnimatedSprite::getWidth (  )  const

gets the width in pixels of the image of the current frame

Definition at line 173 of file animatedsprite.cpp.

int AnimatedSprite::getHeight (  )  const

gets the height in pixels of the image of the current frame

Definition at line 178 of file animatedsprite.cpp.

void AnimatedSprite::setDirection ( SpriteDirection  direction  ) 

Sets the direction.

Definition at line 153 of file animatedsprite.cpp.

bool AnimatedSprite::updateCurrentAnimation ( unsigned int  dt  )  [private]

Definition at line 115 of file animatedsprite.cpp.


Member Data Documentation

The sprite direction.

Definition at line 101 of file animatedsprite.h.

The last time update was called.

Definition at line 102 of file animatedsprite.h.

unsigned int AnimatedSprite::mFrameIndex [private]

The index of the current frame.

Definition at line 104 of file animatedsprite.h.

unsigned int AnimatedSprite::mFrameTime [private]

The time since start of frame.

Definition at line 105 of file animatedsprite.h.

The sprite definition.

Definition at line 107 of file animatedsprite.h.

The currently active action.

Definition at line 108 of file animatedsprite.h.

The currently active animation.

Definition at line 109 of file animatedsprite.h.

The currently active frame.

Definition at line 110 of file animatedsprite.h.


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5