FIFE  2008.0
FIFE::Animation Class Reference

#include <animation.h>

Inheritance diagram for FIFE::Animation:
Collaboration diagram for FIFE::Animation:

List of all members.

Public Member Functions

 Animation ()
 ~Animation ()
void addFrame (ResourcePtr image, unsigned int duration)
int getFrameIndex (unsigned int timestamp)
ImagegetFrame (int index)
ImagegetFrameByTimestamp (unsigned int timestamp)
int getFrameDuration (int index) const
unsigned int getNumFrames () const
void setActionFrame (int num)
int getActionFrame () const
void setDirection (unsigned int direction)
unsigned int getDirection () const
unsigned int 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 54 of file animation.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 41 of file animation.cpp.

FIFE::Animation::~Animation ( )

Destructor. Decreases the reference count of all referred images.

Definition at line 47 of file animation.cpp.


Member Function Documentation

void FIFE::Animation::addFrame ( ResourcePtr  image,
unsigned int  duration 
)

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

Parameters:
imagePointer to Image. Does not transfer the ownership
durationDuration for given frame in the animation

Definition at line 52 of file animation.cpp.

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

Gets the action frame.

See also:
setActionFrame

Definition at line 108 of file animation.h.

unsigned int FIFE::Animation::getDirection ( ) const [inline]

Gets the animation direction

See also:
setDirection
Returns:
direction for this animation

Definition at line 123 of file animation.h.

unsigned int FIFE::Animation::getDuration ( ) const [inline]

Gets the total duration for the whole animation

Definition at line 127 of file animation.h.

Referenced by FIFE::Cursor::draw().

Here is the caller graph for this function:

Image * FIFE::Animation::getFrame ( int  index)

Gets the frame that matches the given index. If no matches found, returns NULL

Definition at line 87 of file animation.cpp.

Referenced by getFrameByTimestamp().

Here is the caller graph for this function:

Image * FIFE::Animation::getFrameByTimestamp ( unsigned int  timestamp)

Gets the frame that matches the given timestamp.

Definition at line 95 of file animation.cpp.

References getFrame(), and getFrameIndex().

Referenced by FIFE::Cursor::draw().

Here is the caller graph for this function:

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

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

Definition at line 99 of file animation.cpp.

int FIFE::Animation::getFrameIndex ( unsigned int  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 72 of file animation.cpp.

Referenced by getFrameByTimestamp().

Here is the caller graph for this function:

unsigned int FIFE::Animation::getNumFrames ( ) const

Get the number of frames

Definition at line 107 of file animation.cpp.

void FIFE::Animation::setActionFrame ( int  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:
numindex of the action frame.

Definition at line 103 of file animation.h.

void FIFE::Animation::setDirection ( unsigned int  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:
directiondirection to set

Definition at line 111 of file animation.cpp.


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