#include <animation.h>
Collaboration diagram for Animation:
Public Member Functions | |
Animation (const Image &abase_image, Uint16 aframes=1, BasePointType abp_type=BP_MD, Uint16 aanimation_type=ATYPE_LOOP, double afps=0, Uint16 astart_pos=0, AllignType aallign_type=AT_MD) | |
Initialize the animation. | |
virtual void | setBasePos (SDL_Rect *abase_pos) |
Set the base position of the animation. | |
virtual void | unsetBasePos () |
Unsets the base position of the animation. | |
virtual void | runAnim () |
Start the animation from the beginning (used when the animation was still). | |
virtual bool | updateAnim (Uint16 dt) |
virtual Frame | getFrame () const |
Calculates and returns the current frame. | |
virtual SDL_Rect | getDrawPos () const |
virtual SDL_Rect | getFrameDim () const |
HACK: Return the dimensions of the first frame. | |
virtual Frame | getBaseFrame () const |
HACK: Return the base frame. | |
virtual bool | isValid () const |
return True if the animation is valid | |
virtual bool | isRunning () const |
return True if the animation is running | |
virtual bool | isImage () const |
return True if the animation is a still image | |
virtual bool | isFixed () const |
return True if the animation dimensions stay the same | |
virtual void | setFallBack (EmptyAnimationPtr *) |
Protected Member Functions | |
void | setShift () |
Helper function to set the shift values of the animation. | |
bool | stopAnim () |
Helper function to stop an animation. | |
bool | checkAnim () |
check validity of the animation | |
Protected Attributes | |
Image | base_image |
Base image for the animation (big). | |
Uint16 | frames |
Number of frames. | |
BasePointType | bp_type |
The base point of the animation. | |
Uint16 | animation_type |
double | fps |
FPS of the animation. | |
Uint16 | start_pos |
Start position from the frame array of the base_image. | |
AllignType | allign_type |
Allignment of the base point onto the base_pos. | |
SDL_Rect * | base_pos |
Pointer to the current base position of the animation. | |
Sint16 | shift_x |
shift is added as an additional value to the designated BP position. | |
Sint16 | shift_y |
Uint32 | duration |
Duration of the animation in ms. | |
Uint16 | base_frame_pos |
Position of the base frame. | |
Uint16 | end_pos |
End position from the frame array of the base_image. | |
bool | is_image |
True if the animation consist of one still image (frames=1,still=true). | |
bool | is_valid |
True if the sanity checks suceeded. | |
bool | is_fixed |
True if the image dimensions stay fixed during the whole animation (unused). | |
bool | is_running |
True if the animation is running. | |
bool | forward |
True if the animation is running forward at the moment. | |
Uint16 | cur_frame_num |
Current frame number. | |
Uint32 | cur_time |
Current time. |
|
Initialize the animation.
|
|
Updates a running animation and stops it if necessary return True if the animation is still running |
|
Calculates and returns the current draw position using: base_pos,bp_type,allign_type |
|
The base point of the animation. The base point always stays fixed during the animation. It's types are: BP_xy, where x may be either L,M or R and y may be either U, M or D. L: left end, M: middle, R: right end, U: upper end, D: lower end Example: BP_MU means the BP is the upper middle point of each frame. Default: BP_MD |
|
Animation type: ATYPE_ONCE (play once), ATYPE_LOOP (always play, jump back to the beginning), ATYPE_SWING (always play, reverse direction when finnished), ATYPE_ST_SWITCH (parameter for ATYPE_ALL_ONCE: switch state when finnished). The appended _REV means that the animation is started at the end and played backwards. |
|
Allignment of the base point onto the base_pos. The allignment specifies how the base point should be positioned wrt to the base_pos: It's type are basically the same as in BasePointType. Example: (Assuming BP_MD) AT_LD means the middle point of each frame (BP_MD) is stays fixed wrt to the base position and the animation is placed with a "south west gravity" (similar to ImageMagick) wrt to the base position Default: AT_MD |