hoa_map::private_map::ActionAnimate Class Reference

Action that displays specific sprite frames for a certain period of time. More...

#include <map_actions.h>

Inheritance diagram for hoa_map::private_map::ActionAnimate:

Inheritance graph
[legend]
Collaboration diagram for hoa_map::private_map::ActionAnimate:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ActionAnimate (VirtualSprite *sprite)
void AddFrame (uint16 frame, uint32 time)
void Execute ()
 Executes the sprite's action.
void SetLoops (int8 count)
 ~ActionAnimate ()

Public Attributes

uint32 current_frame
 Indicates the current frame.
std::vector< uint32display_times
 Indicates how long to display each frame The size of this vector should be equal to the size of the frames vector.
std::vector< uint16frames
 The sprite animation to display for this action. This is an index to the sprite's animations vector.
int8 loop_count
 A counter for the number of loops.
int8 loops
 The number of times to loop the series of frames before finishing. A value less than zero indicates to loop forever. Be careful with this, because that means that the action would never arrive at the "finished" state.
uint32 timer
 Used to count down the display time of the current frame.

Detailed Description

Action that displays specific sprite frames for a certain period of time.

****************************************************************************

This action displays a certain animation in a sprite for a certain amount of time. It supports multiple animation + time combinations as well as looping through these animations. Its primary purpose is to allow complete control over how a sprite reacts to its surroundings, such as flipping through a book taken from a bookshelf.

Note:
The vectors ins this class should always be of the same size.

These actions can not be used with VirtualSprite objects, since this class explicitly needs animation images to work and virtual sprites have no sprite images to work with.

You MUST add at least one frame to the object if you are intending to use it. Calling the Execute() function when the object contains no frame entries will cause a segmentation fault.

Definition at line 193 of file map_actions.h.


Constructor & Destructor Documentation

hoa_map::private_map::ActionAnimate::ActionAnimate ( VirtualSprite sprite  )  [inline]

Definition at line 224 of file map_actions.h.

hoa_map::private_map::ActionAnimate::~ActionAnimate (  )  [inline]

Definition at line 227 of file map_actions.h.


Member Function Documentation

void hoa_map::private_map::ActionAnimate::AddFrame ( uint16  frame,
uint32  time 
) [inline]

Definition at line 232 of file map_actions.h.

References display_times, and frames.

void hoa_map::private_map::ActionAnimate::Execute (  )  [virtual]

Executes the sprite's action.

Implements hoa_map::private_map::SpriteAction.

Definition at line 113 of file map_actions.cpp.

References hoa_map::private_map::SpriteAction::_finished, hoa_map::private_map::SpriteAction::_sprite, current_frame, display_times, frames, hoa_system::GameSystem::GetUpdateTime(), loop_count, loops, hoa_system::SystemManager, and timer.

Here is the call graph for this function:

void hoa_map::private_map::ActionAnimate::SetLoops ( int8  count  )  [inline]

Definition at line 235 of file map_actions.h.

References loops.


Member Data Documentation

uint32 hoa_map::private_map::ActionAnimate::current_frame

Indicates the current frame.

Definition at line 206 of file map_actions.h.

Referenced by Execute().

std::vector<uint32> hoa_map::private_map::ActionAnimate::display_times

Indicates how long to display each frame The size of this vector should be equal to the size of the frames vector.

Definition at line 203 of file map_actions.h.

Referenced by AddFrame(), and Execute().

std::vector<uint16> hoa_map::private_map::ActionAnimate::frames

The sprite animation to display for this action. This is an index to the sprite's animations vector.

Definition at line 198 of file map_actions.h.

Referenced by AddFrame(), and Execute().

int8 hoa_map::private_map::ActionAnimate::loop_count

A counter for the number of loops.

Definition at line 212 of file map_actions.h.

Referenced by Execute().

int8 hoa_map::private_map::ActionAnimate::loops

The number of times to loop the series of frames before finishing. A value less than zero indicates to loop forever. Be careful with this, because that means that the action would never arrive at the "finished" state.

Note:
The default value of this member is zero, which indicates that the animations will not be looped.

Definition at line 222 of file map_actions.h.

Referenced by Execute(), and SetLoops().

uint32 hoa_map::private_map::ActionAnimate::timer

Used to count down the display time of the current frame.

Definition at line 209 of file map_actions.h.

Referenced by Execute().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:42 2007 for Hero of Allacrost by  doxygen 1.5.1