Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Animation Class Referencefinal

An animation consists of several frames, each with their own delay and offset. More...

#include <animation.h>

Public Member Functions

 Animation ()=default
 
void addFrame (Image *image, int delay, int offsetX, int offsetY)
 Appends a new animation at the end of the sequence.
 
void addTerminator ()
 Appends an animation terminator that states that the animation should not loop.
 
FramegetFrame (int index)
 Returns the frame at the specified index.
 
int getLength () const
 Returns the length of this animation in frames.
 
int getDuration () const
 Returns the duration of this animation in milliseconds.
 

Static Public Member Functions

static bool isTerminator (const Frame &phase)
 Determines whether the given animation frame is a terminator.
 
static Animation fromXML (XML::Node node, const std::string &dyePalettes={})
 Loads an animation from XML.
 

Protected Attributes

ResourceRef< ImageSetmImageSet
 
std::vector< FramemFrames
 
int mDuration = 0
 

Detailed Description

An animation consists of several frames, each with their own delay and offset.

Definition at line 46 of file animation.h.

Constructor & Destructor Documentation

◆ Animation()

Animation::Animation ( )
default

Member Function Documentation

◆ addFrame()

void Animation::addFrame ( Image image,
int  delay,
int  offsetX,
int  offsetY 
)

Appends a new animation at the end of the sequence.

Definition at line 29 of file animation.cpp.

◆ addTerminator()

void Animation::addTerminator ( )

Appends an animation terminator that states that the animation should not loop.

Definition at line 40 of file animation.cpp.

◆ fromXML()

Animation Animation::fromXML ( XML::Node  node,
const std::string &  dyePalettes = {} 
)
static

Loads an animation from XML.

Definition at line 50 of file animation.cpp.

◆ getDuration()

int Animation::getDuration ( ) const
inline

Returns the duration of this animation in milliseconds.

Definition at line 75 of file animation.h.

◆ getFrame()

Frame * Animation::getFrame ( int  index)
inline

Returns the frame at the specified index.

Definition at line 65 of file animation.h.

◆ getLength()

int Animation::getLength ( ) const
inline

Returns the length of this animation in frames.

Definition at line 70 of file animation.h.

◆ isTerminator()

bool Animation::isTerminator ( const Frame phase)
static

Determines whether the given animation frame is a terminator.

Definition at line 45 of file animation.cpp.

Member Data Documentation

◆ mDuration

int Animation::mDuration = 0
protected

Definition at line 91 of file animation.h.

◆ mFrames

std::vector<Frame> Animation::mFrames
protected

Definition at line 90 of file animation.h.

◆ mImageSet

ResourceRef<ImageSet> Animation::mImageSet
protected

Definition at line 89 of file animation.h.


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