#include <sprite.h>
Public Member Functions | |
Sprite () | |
Default constructor. | |
bool | create_from_gifs (const Glib::ustring &path) |
Create a sprite from GIFs in a directory. | |
void | add_animation (const Animation &anim) |
Add an entire animation to the sprite. | |
void | add_animation_from_gif (const Glib::ustring &id, const Glib::ustring &path) |
Add an animation from a GIF image. | |
Animation & | get_animation (const Glib::ustring &id) |
Get an animation from the sprite. | |
AnimationMap | get_animations () const |
Get the full map of animations. | |
int | num_animations () const |
Get the amount of animations in this sprite. | |
void | remove_animation (const Glib::ustring &id) |
Remove an animation based on ID. | |
void | add_frame (const Glib::ustring &id, int time, const Glib::RefPtr< Gdk::Pixbuf > &pixbuf) |
Add a frame to an animation. | |
void | remove_frame (const Glib::ustring &id, int index) |
Remove a frame from an animation. | |
void | clear () |
Clear out all animations and other data. | |
Private Attributes | |
AnimationMap | m_Animations |
Map of animations. |
The Sprite class stores all of the image data needed to function. It also keeps track of the current frame of animation, as well as management of many animations. In addition, it provides the utility to create animations from a series of GIF files. Besides just storing data, the Sprite class is also in charge of playing the actual animations, including correctly timing each frame.
bool Sprite::create_from_gifs | ( | const Glib::ustring & | path | ) |
Create a sprite from GIFs in a directory.
path | The path to the directory |
void Sprite::add_animation | ( | const Animation & | anim | ) | [inline] |
Add an entire animation to the sprite.
anim | The animation |
void Sprite::add_animation_from_gif | ( | const Glib::ustring & | id, | |
const Glib::ustring & | path | |||
) |
Add an animation from a GIF image.
id | The new ID for this animation | |
path | The path to the GIF |
Animation& Sprite::get_animation | ( | const Glib::ustring & | id | ) | [inline] |
Get an animation from the sprite.
id | The ID of the animation |
AnimationMap Sprite::get_animations | ( | ) | const [inline] |
Get the full map of animations.
int Sprite::num_animations | ( | ) | const [inline] |
Get the amount of animations in this sprite.
void Sprite::remove_animation | ( | const Glib::ustring & | id | ) | [inline] |
Remove an animation based on ID.
id | The ID of the animation |
void Sprite::add_frame | ( | const Glib::ustring & | id, | |
int | time, | |||
const Glib::RefPtr< Gdk::Pixbuf > & | pixbuf | |||
) |
Add a frame to an animation.
id | The ID of the target animation | |
time | Time delay of the frame | |
pixbuf | Image data for this frame |
void Sprite::remove_frame | ( | const Glib::ustring & | id, | |
int | index | |||
) |
Remove a frame from an animation.
id | The target animation's ID | |
index | The 0 based index of the frame to remove |