Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SimpleAnimation Class Referencefinal

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.
 
ImagegetCurrentImage () 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.
 
FramemCurrentFrame = nullptr
 Current animation phase.
 
bool mInitialized = false
 Tell whether the animation is ready.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SimpleAnimation() [1/2]

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() [2/2]

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.

Member Function Documentation

◆ draw()

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

Definition at line 52 of file simpleanimation.cpp.

◆ getCurrentImage()

Image * SimpleAnimation::getCurrentImage ( ) const

Definition at line 97 of file simpleanimation.cpp.

◆ getLength()

int SimpleAnimation::getLength ( ) const
inline

Definition at line 51 of file simpleanimation.h.

◆ reset()

void SimpleAnimation::reset ( )

Resets the animation.

Definition at line 62 of file simpleanimation.cpp.

◆ setFrame()

void SimpleAnimation::setFrame ( int  frame)

Definition at line 68 of file simpleanimation.cpp.

◆ update()

void SimpleAnimation::update ( int  dt)

Definition at line 78 of file simpleanimation.cpp.

Member Data Documentation

◆ mAnimation

Animation SimpleAnimation::mAnimation
private

The hosted animation.

Definition at line 66 of file simpleanimation.h.

◆ mAnimationPhase

int SimpleAnimation::mAnimationPhase = 0
private

Index of current animation phase.

Definition at line 72 of file simpleanimation.h.

◆ mAnimationTime

int SimpleAnimation::mAnimationTime = 0
private

Time in milliseconds the current frame is shown.

Definition at line 69 of file simpleanimation.h.

◆ mCurrentFrame

Frame* SimpleAnimation::mCurrentFrame = nullptr
private

Current animation phase.

Definition at line 75 of file simpleanimation.h.

◆ mInitialized

bool SimpleAnimation::mInitialized = false
private

Tell whether the animation is ready.

Definition at line 78 of file simpleanimation.h.


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