Home | All Classes | Grouped Classes | Index | Search

# Class CL_Sprite

This class handles displaying sprites on the screen. More...

Derived from: none
Derived by: none
Group: Display (Sprites)

#include <ClanLib/display.h>

Construction:

CL_Sprite | Constructs a sprite.

Attributes:

get_angle | Returns current angle in degrees.
get_angle_yaw | Returns the current rotational yaw angle in degrees.
get_angle_pitch | Returns the current rotational pitch angle in degrees.
get_base_angle | Returns the base angle in degrees - angle added to any rotation set with set_rotate() or rotate().
get_scale | Returns scale for x and y.
get_alpha | Returns current alpha.
get_color | Returns current color.
get_blend_func | Returns blending functions.
get_alignment | Returns translation hotspot.
get_rotation_hotspot | Returns rotation hotspot.
get_current_frame | Returns current frame in animation. 0 is first frame.
get_frame_count | Returns number of frames in animation.
get_frame_delay | Returns the delay of a frame. 0 is first frame.
get_frame_offset | Returns the translation offset of a frame. 0 is first frame.
get_frame_size | Returns the size of a frame. 0 is first frame.
get_width | Return the width of the current frame, shortcut for 'get_frame_size(get_current_frame()).width'
get_height | Return the height of the current frame, shortcut for 'get_frame_size(get_current_frame()).height'
get_frame_surface | Returns the surface of a frame. 0 is first frame.
get_frame_pixeldata | Returns a CL_PixelBuffer with the same dimensions as this sprite.
get_id | Returns the attached id (if exists).
is_null | Returns true if this is an unattached sprite.
is_play_loop | Returns true if animation is played in loop (more than once).
is_play_backward | Returns true if animation is played in from right to left (starts at end).
is_play_pingpong | Returns true if animation is played in ping-pong mode.
get_show_on_finish | Returns an enum for what is shown when the animation is finished.
is_finished | Returns true if animation is finished.
is_looping | Returns true if animation has looped in the last update cycle
resource | Resource owning this sprite, if any.

Operations:

operator = | Copy assignment operator.
bool | Return true if the CL_Sprite is valid and useable
set_image_data | Sets the image data from another sprite.
draw | Draw sprite on graphic context.
draw_subpixel |
setup_draw_params | Calculate draw information and send it back. Returns false if sprite isn't currently drawn
update | Call this function to update the animation.
set_angle | Set absolute rotation angle in degrees.
set_angle_pitch | Set absolute rotation pitch angle in degrees.
set_angle_yaw | Set absolute rotation yaw angle in degrees.
rotate | Add angle in degrees to current angle.
rotate_pitch | Add angle in degrees to current pitch angle.
rotate_yaw | Add angle in degrees to current yaw angle.
set_base_angle | Sets the base angle in degrees - angle added to any rotation set with set_rotate() or rotate().
set_scale | Set scale for x and y directions individually.
set_alpha | Sets transparency.
set_color | Sets the color.
set_blend_func | Sets blending functions.
set_blend_func_separate | Sets blending functions.
set_alignment | Sets translation hotspot.
set_rotation_hotspot | Sets rotation hotspot.
set_frame | Sets current animation frame. 0 is first frame. It will cap to available range.
set_frame_delay | Sets the delay of a specific frame. 0 is first frame.
set_frame_offset | Sets the translate offset of a specific frame. 0 is first frame.
set_id | Sets an attached id.
finish | Finish animation.
restart | Restart animation.
set_play_loop | Set to true if animation should loop, false otherwise.
set_play_pingpong | Set to true if animation should loop, false otherwise.
set_play_backward | Set to true if animation should go backward (start at end).
set_show_on_finish | Set what is shown when the animation is finished.
add_frame | Adds a frame to the animation

Signals:

sig_animation_finished |

Detailed description:

!group=Display/Sprites! !header=display.h!

There are two overviews describing the sprite system in ClanLib. The sprites overview, and the sprites resources overview.

Questions or comments, write to the ClanLib mailing list.