supertux
|
Public Types | |
enum | Loops { LOOPS_CONTINUED = -100 } |
Public Member Functions | |
Sprite (SpriteData &data) | |
SpritePtr | clone () const |
void | draw (Canvas &canvas, const Vector &pos, int layer, Flip flip=NO_FLIP) |
Draw sprite, automatically calculates next frame. | |
void | draw_scaled (Canvas &canvas, const Rectf &dest_rect, int layer, Flip flip=NO_FLIP) |
void | set_action (const std::string &name, int loops=-1) |
Set action (or state) | |
void | set_action (const std::string &name, const Direction &dir, int loops=-1) |
Composes action (or state) string from an action name and a particular direction in the form of "name-direction", eg. More... | |
void | set_action (const Direction &dir, const std::string &name, int loops=-1) |
Composes action (or state) string from an action name and a particular direction in the form of "direction-name", eg. More... | |
void | set_action (const Direction &dir, int loops=-1) |
Composes action (or state) string from a particular direction in the form of "direction", e.g. More... | |
void | set_animation_loops (int loops=-1) |
Set number of animation cycles until animation stops. | |
void | set_frame_progress (float frame_progress) |
void | set_frame (int frame) |
void | stop_animation () |
void | pause_animation () |
void | resume_animation () |
bool | animation_done () const |
Check if animation is stopped or not. | |
int | get_frames () const |
Get current action total frames. | |
int | get_current_frame () const |
Get currently drawn frame. | |
float | get_current_frame_progress () const |
Get current frame progress. | |
const std::string & | get_name () const |
Get sprite's name. | |
const std::string & | get_action () const |
Get current action name. | |
int | get_width () const |
int | get_height () const |
const std::optional< std::vector< SurfacePtr > > | get_action_surfaces (const std::string &name) const |
bool | is_current_hitbox_unisolid () const |
Return the "unisolid" property for the current action's hitbox. More... | |
float | get_current_hitbox_x_offset () const |
return x-offset of current action's hitbox, relative to start of image | |
float | get_current_hitbox_y_offset () const |
return y-offset of current action's hitbox, relative to start of image | |
float | get_current_hitbox_width () const |
return width of current action's hitbox | |
float | get_current_hitbox_height () const |
return height of current action's hitbox | |
Rectf | get_current_hitbox () const |
return current action's hitbox, relative to 0,0 | |
void | set_angle (float angle) |
Set the angle of the sprite rotation in degree. | |
float | get_angle () const |
Get the angle of the sprite rotation in degree. | |
void | set_color (const Color &color) |
Color | get_color () const |
void | set_alpha (float alpha) |
float | get_alpha () const |
void | set_blend (const Blend &blend) |
Blend | get_blend () const |
bool | has_action (const std::string &name) const |
size_t | get_actions_count () const |
bool Sprite::is_current_hitbox_unisolid | ( | ) | const |
Return the "unisolid" property for the current action's hitbox.
void Sprite::set_action | ( | const std::string & | name, |
const Direction & | dir, | ||
int | loops = -1 |
||
) |
Composes action (or state) string from an action name and a particular direction in the form of "name-direction", eg.
"walk-left"
void Sprite::set_action | ( | const Direction & | dir, |
const std::string & | name, | ||
int | loops = -1 |
||
) |
Composes action (or state) string from an action name and a particular direction in the form of "direction-name", eg.
"left-up"
void Sprite::set_action | ( | const Direction & | dir, |
int | loops = -1 |
||
) |
Composes action (or state) string from a particular direction in the form of "direction", e.g.
"left"