ManaPlus
|
#include <simpleanimation.h>
Public Member Functions | |
SimpleAnimation (Animation *const animation) | |
SimpleAnimation (const xmlNodePtr animationNode, const std::string &dyePalettes) | |
~SimpleAnimation () | |
void | setFrame (int frame) |
int | getLength () const |
bool | update (const int timePassed) |
void | draw (Graphics *const graphics, const int posX, const int posY) const |
void | reset () |
Image * | getCurrentImage () const |
Private Member Functions | |
void | initializeAnimation (const xmlNodePtr animationNode, const std::string &dyePalettes) |
Private Attributes | |
Animation * | mAnimation |
int | mAnimationTime |
int | mAnimationPhase |
const Frame * | mCurrentFrame |
bool | mInitialized |
ImageSet * | mImageSet |
This class is a leightweight alternative to the AnimatedSprite class. It hosts a looping animation without actions and directions.
Definition at line 42 of file simpleanimation.h.
|
explicit |
Creates a simple animation with an already created animation. Takes ownership over the given animation.
Definition at line 43 of file simpleanimation.cpp.
SimpleAnimation::SimpleAnimation | ( | const xmlNodePtr | animationNode, |
const std::string & | dyePalettes | ||
) |
Creates a simple animation that creates its animation from XML Data.
Definition at line 53 of file simpleanimation.cpp.
References initializeAnimation(), mAnimation, mCurrentFrame, and Animation::mFrames.
SimpleAnimation::~SimpleAnimation | ( | ) |
Definition at line 69 of file simpleanimation.cpp.
References Resource::decRef(), delete2, mAnimation, and mImageSet.
void SimpleAnimation::draw | ( | Graphics *const | graphics, |
const int | posX, | ||
const int | posY | ||
) | const |
Definition at line 79 of file simpleanimation.cpp.
References Graphics::drawImage(), FUNC_BLOCK, Frame::image, mCurrentFrame, Frame::offsetX, and Frame::offsetY.
Referenced by ProgressIndicator::draw(), and ProgressIndicator::safeDraw().
Image * SimpleAnimation::getCurrentImage | ( | ) | const |
Definition at line 141 of file simpleanimation.cpp.
References Frame::image, and mCurrentFrame.
Referenced by Particle::update(), and TileAnimation::update().
int SimpleAnimation::getLength | ( | ) | const |
Definition at line 133 of file simpleanimation.cpp.
References CAST_S32, Animation::getLength(), and mAnimation.
Referenced by Particle::update().
|
private |
Definition at line 148 of file simpleanimation.cpp.
References Animation::addFrame(), Animation::addTerminator(), for_each_xml_child_node, ImageSet::get(), ImageSet::getHeight(), Loader::getImageSet(), XML::getIntProperty(), XML::getProperty(), ImageSet::getWidth(), Dye::instantiate(), mAnimation, mapTileSize, mInitialized, reportAlways, and anonymous_namespace{stringutils.cpp}::start.
Referenced by SimpleAnimation().
void SimpleAnimation::reset | ( | ) |
Resets the animation.
Definition at line 91 of file simpleanimation.cpp.
References mAnimationPhase, and mAnimationTime.
void SimpleAnimation::setFrame | ( | int | frame | ) |
Definition at line 97 of file simpleanimation.cpp.
References CAST_U32, Animation::getLength(), mAnimation, mAnimationPhase, mCurrentFrame, and Animation::mFrames.
Referenced by Particle::update().
bool SimpleAnimation::update | ( | const int | timePassed | ) |
Definition at line 111 of file simpleanimation.cpp.
References CAST_SIZE, Frame::delay, Animation::getLength(), mAnimation, mAnimationPhase, mAnimationTime, mCurrentFrame, Animation::mFrames, and mInitialized.
Referenced by ProgressIndicator::logic(), Particle::update(), and TileAnimation::update().
|
private |
The hosted animation.
Definition at line 82 of file simpleanimation.h.
Referenced by getLength(), initializeAnimation(), setFrame(), SimpleAnimation(), update(), and ~SimpleAnimation().
|
private |
Index of current animation phase.
Definition at line 88 of file simpleanimation.h.
Referenced by reset(), setFrame(), and update().
|
private |
Time in game ticks the current frame is shown.
Definition at line 85 of file simpleanimation.h.
|
private |
Current animation phase.
Definition at line 91 of file simpleanimation.h.
Referenced by draw(), getCurrentImage(), setFrame(), SimpleAnimation(), and update().
|
private |
Definition at line 96 of file simpleanimation.h.
Referenced by ~SimpleAnimation().
|
private |
Tell whether the animation is ready
Definition at line 94 of file simpleanimation.h.
Referenced by initializeAnimation(), and update().