Sprite Class Reference

General clss representing a sprite. More...

#include <sprite.h>

List of all members.

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.
Animationget_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.


Detailed Description

General clss representing a sprite.

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.


Member Function Documentation

bool Sprite::create_from_gifs ( const Glib::ustring &  path  ) 

Create a sprite from GIFs in a directory.

Parameters:
path The path to the directory
Returns:
true if successful, false otherwise

void Sprite::add_animation ( const Animation anim  )  [inline]

Add an entire animation to the sprite.

Parameters:
anim The animation

void Sprite::add_animation_from_gif ( const Glib::ustring &  id,
const Glib::ustring &  path 
)

Add an animation from a GIF image.

Parameters:
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.

Parameters:
id The ID of the animation
Returns:
The requested animation, if found

AnimationMap Sprite::get_animations (  )  const [inline]

Get the full map of animations.

Returns:
A map of all sprite animations

int Sprite::num_animations (  )  const [inline]

Get the amount of animations in this sprite.

Returns:
The amount of animations

void Sprite::remove_animation ( const Glib::ustring &  id  )  [inline]

Remove an animation based on ID.

Parameters:
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.

Parameters:
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.

Parameters:
id The target animation's ID
index The 0 based index of the frame to remove


The documentation for this class was generated from the following files:
Generated on Fri Feb 22 22:34:18 2008 for Phoenix Wright Case Editor API by  doxygen 1.5.3