Adonthell
0.4
|
Handles images properties in an animation. More...
#include <animation.h>
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. |
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.
animationframe::animationframe | ( | ) |
Default constructor.
Definition at line 41 of file animation.cc.
animationframe::~animationframe | ( | ) |
Destructor.
Definition at line 46 of file animation.cc.
void animationframe::clear | ( | ) |
Resets an animationframe to it's initial (i.e post-constructor) state.
Definition at line 50 of file animation.cc.
|
inline |
Returns whether this frame is masked or not.
Definition at line 83 of file animation.h.
|
inline |
Sets the mask parameter of this frame.
mask | true if the surface should be masked, false otherwise. |
Definition at line 93 of file animation.h.
|
inline |
Returns the alpha value the this frame.
Definition at line 104 of file animation.h.
|
inline |
Sets the alpha value for this frame.
a | new alpha value. |
Definition at line 114 of file animation.h.
|
inline |
Returns the image number this frame points to.
Definition at line 134 of file animation.h.
|
inline |
Sets the image this frame should point to.
imnbr | the index of the image this frame should point to. |
Definition at line 144 of file animation.h.
|
inline |
Returns the duration of this frame.
Definition at line 155 of file animation.h.
|
inline |
Sets the duration of this frame.
d | new delay (in game cycles, 0 means infinite). |
Definition at line 165 of file animation.h.
|
inline |
Returns the index of the frame that will be displayed once the delay of this one expired.
Definition at line 177 of file animation.h.
|
inline |
Sets the index of the frame that will be displayed right after this one.
nf | index of the frame that will be next to this one. |
Definition at line 188 of file animation.h.
|
inline |
Returns the X offset (i.e position relative to the animation's position) of this frame.
Definition at line 209 of file animation.h.
|
inline |
Returns the Y offset (i.e position relative to the animation's position) of this frame.
Definition at line 221 of file animation.h.
Sets the offset for this frame.
ox | new X offset. |
ox | new Y offset. |
Definition at line 232 of file animation.h.
Loads an animationframe from an opened file.
file | the opened file from which to read. |
Definition at line 61 of file animation.cc.
Saves an animationframe into an opened file.
file | the opened file where to save. |
Definition at line 75 of file animation.cc.