Public Member Functions

FIFE::Animation Class Reference

#include <animation.h>

Inheritance diagram for FIFE::Animation:
Inheritance graph
[legend]
Collaboration diagram for FIFE::Animation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Animation ()
 ~Animation ()
void addFrame (ImagePtr image, uint32_t duration)
int32_t getFrameIndex (uint32_t timestamp)
ImagePtr getFrame (int32_t index)
ImagePtr getFrameByTimestamp (uint32_t timestamp)
int32_t getFrameDuration (int32_t index) const
uint32_t getFrameCount () const
void setActionFrame (int32_t num)
int32_t getActionFrame () const
void setDirection (uint32_t direction)
uint32_t getDirection () const
uint32_t getDuration () const

Detailed Description

Animation.

A container of Images describing an animation. Animation itself does not take care of animating the images. Instead it contains images having associated timestamps. It is the responsibility of the animation user to query frames based on current timestamp and show returned images on screen.

Definition at line 56 of file animation.h.


Constructor & Destructor Documentation

FIFE::Animation::Animation (  )  [explicit]

Constructor.

Definition at line 38 of file animation.cpp.

FIFE::Animation::~Animation (  ) 

Destructor. Decreases the reference count of all referred images.

Definition at line 44 of file animation.cpp.


Member Function Documentation

void FIFE::Animation::addFrame ( ImagePtr  image,
uint32_t  duration 
)

Adds new frame into animation Frames must be added starting from first frame. Increases the reference count of the given image.

Parameters:
image Pointer to Image. Does not transfer the ownership
duration Duration for given frame in the animation

Definition at line 49 of file animation.cpp.

int32_t FIFE::Animation::getActionFrame (  )  const [inline]

Gets the action frame.

See also:
setActionFrame

Definition at line 110 of file animation.h.

uint32_t FIFE::Animation::getDirection (  )  const [inline]

Gets the animation direction

See also:
setDirection
Returns:
direction for this animation

Definition at line 125 of file animation.h.

uint32_t FIFE::Animation::getDuration (  )  const [inline]

Gets the total duration for the whole animation

Definition at line 129 of file animation.h.

ImagePtr FIFE::Animation::getFrame ( int32_t  index  ) 

Gets the frame iamge that matches the given index. If no matches found, returns an invalid ImagePtr

Definition at line 84 of file animation.cpp.

ImagePtr FIFE::Animation::getFrameByTimestamp ( uint32_t  timestamp  ) 

Gets the frame image that matches the given timestamp.

Definition at line 96 of file animation.cpp.

uint32_t FIFE::Animation::getFrameCount (  )  const

Get the number of frames

Definition at line 117 of file animation.cpp.

int32_t FIFE::Animation::getFrameDuration ( int32_t  index  )  const

Gets the frame duration for given (indexed) frame. Returns negative value in case of incorrect index

Definition at line 109 of file animation.cpp.

int32_t FIFE::Animation::getFrameIndex ( uint32_t  timestamp  ) 

Get the frame index that matches given timestamp. In case there is no exact match, correct frame is calculated. E.g. if there are frames for timestamps 50 and 100 and frame for 75 is asked, frame associated with value 50 is given back. In case the timestamp is past the sequence, negative value is returned

See also:
addFrame

Definition at line 69 of file animation.cpp.

void FIFE::Animation::setActionFrame ( int32_t  num  )  [inline]

Sets the action frame. Action frame is the frame when the related action actually happens. E.g. in case of punch animation, action frame is the frame when punch hits the target. In case there is no associated action frame, value is negative

Parameters:
num index of the action frame.

Definition at line 105 of file animation.h.

void FIFE::Animation::setDirection ( uint32_t  direction  ) 

Animation direction tells how this animation is associated with movement when played starting from frame 0 E.g. in walking animation there should be direction assigned so that engine can choose the correct animation when characters are moved around the map area

Parameters:
direction direction to set

Definition at line 121 of file animation.cpp.


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