Adonthell  0.4
animationframe Class Reference

Handles images properties in an animation. More...

#include <animation.h>

Public Member Functions

 animationframe ()
 Default constructor. More...
 
 ~animationframe ()
 Destructor. More...
 
void clear ()
 Resets an animationframe to it's initial (i.e post-constructor) state. More...
 
Mask and Alpha Settings.
bool is_masked () const
 Returns whether this frame is masked or not. More...
 
void set_mask (bool mask)
 Sets the mask parameter of this frame. More...
 
u_int8 alpha () const
 Returns the alpha value the this frame. More...
 
void set_alpha (u_int8 a)
 Sets the alpha value for this frame. More...
 
Image, delay and next frame settings.
u_int16 image_nbr () const
 Returns the image number this frame points to. More...
 
void set_image_nbr (u_int16 imnbr)
 Sets the image this frame should point to. More...
 
u_int16 delay () const
 Returns the duration of this frame. More...
 
void set_delay (u_int16 d)
 Sets the duration of this frame. More...
 
u_int16 nextframe () const
 Returns the index of the frame that will be displayed once the delay of this one expired. More...
 
void set_nextframe (u_int16 nf)
 Sets the index of the frame that will be displayed right after this one. More...
 
Individual frames relative position.
u_int16 offx () const
 Returns the X offset (i.e position relative to the animation's position) of this frame. More...
 
u_int16 offy () const
 Returns the Y offset (i.e position relative to the animation's position) of this frame. More...
 
void set_offset (u_int16 ox, u_int16 oy)
 Sets the offset for this frame. More...
 
Saving/Loading Methods.
s_int8 get (igzstream &file)
 Loads an animationframe from an opened file. More...
 
s_int8 put (ogzstream &file) const
 Saves an animationframe into an opened file. More...
 

Detailed Description

Handles images properties in an animation.

Objects of this class have no reason to exist if not affected to an animation. The fact is, that often in an animation, you want the same image to appear at different times, different positions or with different mask and alpha values. An animationframe is a class that contains the index of the image to display, the alpha and mask parameters to give it, the time (in game cycles) it should be displayed before going to the next frame, and the index and the frame to display right after this one. As images and animationframes are arranged into an indexed array in an animation, the index values only make sense from the animation point of view.

Definition at line 52 of file animation.h.

Constructor & Destructor Documentation

animationframe::animationframe ( )

Default constructor.

Definition at line 44 of file animation.cc.

animationframe::~animationframe ( )

Destructor.

Definition at line 49 of file animation.cc.

Member Function Documentation

void animationframe::clear ( )

Resets an animationframe to it's initial (i.e post-constructor) state.

Definition at line 53 of file animation.cc.

bool animationframe::is_masked ( ) const
inline

Returns whether this frame is masked or not.

Returns
true if the surface is masked, false otherwise.

Definition at line 87 of file animation.h.

void animationframe::set_mask ( bool  mask)
inline

Sets the mask parameter of this frame.

Parameters
masktrue if the surface should be masked, false otherwise.

Definition at line 97 of file animation.h.

u_int8 animationframe::alpha ( ) const
inline

Returns the alpha value the this frame.

Returns
the alpha value of the frame.

Definition at line 108 of file animation.h.

void animationframe::set_alpha ( u_int8  a)
inline

Sets the alpha value for this frame.

Parameters
anew alpha value.

Definition at line 118 of file animation.h.

u_int16 animationframe::image_nbr ( ) const
inline

Returns the image number this frame points to.

Returns
the index of the image this frame points to.

Definition at line 138 of file animation.h.

void animationframe::set_image_nbr ( u_int16  imnbr)
inline

Sets the image this frame should point to.

Parameters
imnbrthe index of the image this frame should point to.

Definition at line 148 of file animation.h.

u_int16 animationframe::delay ( ) const
inline

Returns the duration of this frame.

Returns
the delay (in game cycles) of this frame (0 means infinite).

Definition at line 159 of file animation.h.

void animationframe::set_delay ( u_int16  d)
inline

Sets the duration of this frame.

Parameters
dnew delay (in game cycles, 0 means infinite).

Definition at line 169 of file animation.h.

u_int16 animationframe::nextframe ( ) const
inline

Returns the index of the frame that will be displayed once the delay of this one expired.

Returns
the index of the frame next to this one.

Definition at line 181 of file animation.h.

void animationframe::set_nextframe ( u_int16  nf)
inline

Sets the index of the frame that will be displayed right after this one.

Parameters
nfindex of the frame that will be next to this one.

Definition at line 192 of file animation.h.

u_int16 animationframe::offx ( ) const
inline

Returns the X offset (i.e position relative to the animation's position) of this frame.

Returns
the X offset of this frame.

Definition at line 213 of file animation.h.

u_int16 animationframe::offy ( ) const
inline

Returns the Y offset (i.e position relative to the animation's position) of this frame.

Returns
the Y offset of this frame.

Definition at line 225 of file animation.h.

void animationframe::set_offset ( u_int16  ox,
u_int16  oy 
)
inline

Sets the offset for this frame.

Parameters
oxnew X offset.
oxnew Y offset.

Definition at line 236 of file animation.h.

s_int8 animationframe::get ( igzstream file)

Loads an animationframe from an opened file.

Parameters
filethe opened file from which to read.
Returns
0 in case of success, error number in case of error.

Definition at line 64 of file animation.cc.

s_int8 animationframe::put ( ogzstream file) const

Saves an animationframe into an opened file.

Parameters
filethe opened file where to save.
Returns
0 in case of success, error number in case of error.

Definition at line 78 of file animation.cc.


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