e2d::graphics::Animation Class Reference

Inheritance diagram for e2d::graphics::Animation:


List of all members.

Detailed Description

This class controls iterators who access all animations defined in an instance of AnimationMap. Through its methods, you can start and stop animations and always know what is the current animation frame.

Since this class just controls the logic of animations and has no image data assigned to it, you should use a more specialized class to blit animations, such as the Sprite class.

Public Member Functions

int GetCurrentAnimation ()
 Gets current animation being executed.
int GetCurrentFrame ()
 Gets current frame of animation.
bool IsRunning (void)
 Tells if an animation is running.
void SetAnimationMap (AnimationMap *animations)
 Assigns an animation map to this animation.
void SetCurrentFrame (unsigned int frame)
 Sets frame of animation.
void StartAnimation (unsigned int animation_id, bool repeating=true)
 Starts selected animation.
void StopAnimation ()
 Stops current animation.

Member Function Documentation

int e2d::graphics::Animation::GetCurrentAnimation (  ) 

The id of the current animation being executed, or -1 if it is stopped.

int e2d::graphics::Animation::GetCurrentFrame (  ) 

Call this method at any moment to know what is the current frame of this animation.

If you want the animation to keep being animated, you must keep calling this method.
Index of the image representing the frame.

bool e2d::graphics::Animation::IsRunning ( void   ) 

true if an animation is running, false if it is stopped.

void e2d::graphics::Animation::SetAnimationMap ( AnimationMap animations  ) 

Assigns an animation map to an object of this class so it may be able to control its animations.

animations map of animations for this class to iterate over.

void e2d::graphics::Animation::SetCurrentFrame ( unsigned int  frame  ) 

You may, at any moment, set the frame you want to be recovered by Animation::GetCurrentFrame. Note that this method also stops any animation running at the moment.

frame Index of the image representing the frame.

void e2d::graphics::Animation::StartAnimation ( unsigned int  animation_id,
bool  repeating = true 

Starts an animation whose id is defined as a key of the animation map assigned to this object. Right after a call to this method, the current frame is set to the first frame of the selected animation, and after the amount of time defined for that frame has elapsed, the current frame is set to the second frame of the animation, and so on until the end of the animation sequence.

If the parameter "repeating" is set to true, the current frame will return to the first frame of animation after the last frame's duration has elapsed, thus making this animation repeat forever until Animation::StopAnimation is called. Otherwise, the animation sequence shall run only once, and after it ends the current frame will stay set to the last frame of the sequence.

animation_id Id defined for this animation
repeating true if you want the animation to loop, false if you want it to run only once.

void e2d::graphics::Animation::StopAnimation (  ) 

Stops the current animation from running. The current frame will stay set to the last frame before this method was called.

Generated on Tue Dec 8 10:32:44 2009 for Easy2D by  doxygen 1.5.6