Mana
|
This class is a leightweight alternative to the Sprite class. More...
#include <simpleanimation.h>
Public Member Functions | |
SimpleAnimation (Animation animation) | |
Creates a simple animation with an already created animation. | |
SimpleAnimation (XML::Node animationNode, const std::string &dyePalettes=std::string()) | |
Creates a simple animation that creates its animation from XML Data. | |
void | setFrame (int frame) |
int | getLength () const |
void | update (int dt) |
bool | draw (Graphics *graphics, int posX, int posY) const |
void | reset () |
Resets the animation. | |
Image * | getCurrentImage () const |
Private Attributes | |
Animation | mAnimation |
The hosted animation. | |
int | mAnimationTime = 0 |
Time in milliseconds the current frame is shown. | |
int | mAnimationPhase = 0 |
Index of current animation phase. | |
Frame * | mCurrentFrame = nullptr |
Current animation phase. | |
bool | mInitialized = false |
Tell whether the animation is ready. | |
This class is a leightweight alternative to the Sprite class.
It hosts a looping animation without actions and directions.
Definition at line 34 of file simpleanimation.h.
SimpleAnimation::SimpleAnimation | ( | Animation | animation | ) |
Creates a simple animation with an already created animation.
Takes ownership over the given animation.
Definition at line 31 of file simpleanimation.cpp.
SimpleAnimation::SimpleAnimation | ( | XML::Node | animationNode, |
const std::string & | dyePalettes = std::string() |
||
) |
Creates a simple animation that creates its animation from XML Data.
Definition at line 39 of file simpleanimation.cpp.
bool SimpleAnimation::draw | ( | Graphics * | graphics, |
int | posX, | ||
int | posY | ||
) | const |
Definition at line 52 of file simpleanimation.cpp.
Image * SimpleAnimation::getCurrentImage | ( | ) | const |
Definition at line 97 of file simpleanimation.cpp.
|
inline |
Definition at line 51 of file simpleanimation.h.
void SimpleAnimation::reset | ( | ) |
Resets the animation.
Definition at line 62 of file simpleanimation.cpp.
void SimpleAnimation::setFrame | ( | int | frame | ) |
Definition at line 68 of file simpleanimation.cpp.
void SimpleAnimation::update | ( | int | dt | ) |
Definition at line 78 of file simpleanimation.cpp.
|
private |
The hosted animation.
Definition at line 66 of file simpleanimation.h.
|
private |
Index of current animation phase.
Definition at line 72 of file simpleanimation.h.
|
private |
Time in milliseconds the current frame is shown.
Definition at line 69 of file simpleanimation.h.
|
private |
Current animation phase.
Definition at line 75 of file simpleanimation.h.
|
private |
Tell whether the animation is ready.
Definition at line 78 of file simpleanimation.h.