#include <animatedsprite.h>
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 AnimatedSprite * | load (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. | |
| SpriteDef * | mSprite |
| The sprite definition. | |
| Action * | mAction |
| The currently active action. | |
| Animation * | mAnimation |
| The currently active animation. | |
| Frame * | mFrame |
| The currently active frame. | |
| AnimatedSprite::AnimatedSprite | ( | SpriteDef * | sprite | ) |
Constructor.
| sprite | the sprite to animate |
Definition at line 35 of file animatedsprite.cpp.
| AnimatedSprite::~AnimatedSprite | ( | ) |
| 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.
| filename | the file of the sprite to animate | |
| variant | the sprite variant |
Definition at line 54 of file animatedsprite.cpp.
| void AnimatedSprite::reset | ( | ) |
| void AnimatedSprite::play | ( | SpriteAction | action | ) |
| 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 | ) |
| bool AnimatedSprite::updateCurrentAnimation | ( | unsigned int | dt | ) | [private] |
Definition at line 115 of file animatedsprite.cpp.
SpriteDirection AnimatedSprite::mDirection [private] |
int AnimatedSprite::mLastTime [private] |
unsigned int AnimatedSprite::mFrameIndex [private] |
unsigned int AnimatedSprite::mFrameTime [private] |
SpriteDef* AnimatedSprite::mSprite [private] |
Action* AnimatedSprite::mAction [private] |
Animation* AnimatedSprite::mAnimation [private] |
Frame* AnimatedSprite::mFrame [private] |
1.5.5