animationframe Class Reference

Handles images properties in an animation. More...

#include <animation.h>

List of all members.

Public Member Functions

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


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 48 of file animation.h.


Constructor & Destructor Documentation

animationframe::animationframe (  ) 

Default constructor.

Definition at line 41 of file animation.cc.

animationframe::~animationframe (  ) 

Destructor.

Definition at line 46 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 50 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 83 of file animation.h.

void animationframe::set_mask ( bool  mask  )  [inline]

Sets the mask parameter of this frame.

Parameters:
mask true if the surface should be masked, false otherwise.

Definition at line 93 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 104 of file animation.h.

void animationframe::set_alpha ( u_int8  a  )  [inline]

Sets the alpha value for this frame.

Parameters:
a new alpha value.

Definition at line 114 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 134 of file animation.h.

void animationframe::set_image_nbr ( u_int16  imnbr  )  [inline]

Sets the image this frame should point to.

Parameters:
imnbr the index of the image this frame should point to.

Definition at line 144 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 155 of file animation.h.

void animationframe::set_delay ( u_int16  d  )  [inline]

Sets the duration of this frame.

Parameters:
d new delay (in game cycles, 0 means infinite).

Definition at line 165 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 177 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:
nf index of the frame that will be next to this one.

Definition at line 188 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 209 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 221 of file animation.h.

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

Sets the offset for this frame.

Parameters:
ox new X offset.
ox new Y offset.

Definition at line 232 of file animation.h.

s_int8 animationframe::get ( igzstream file  ) 

Loads an animationframe from an opened file.

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

Definition at line 61 of file animation.cc.

s_int8 animationframe::put ( ogzstream file  )  const

Saves an animationframe into an opened file.

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

Definition at line 75 of file animation.cc.


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

Generated on Wed Jun 18 16:27:15 2008 for Adonthell by  doxygen 1.5.6