All Classes |Grouped Classes |Index

Class CL_Sprite

Sprite class. More...

Derived from:

None

Derived by:

None

Group:

2D (Display)

#include <ClanLib/display.h>

Class Members:

Enums:

ShowOnFinish


Construction:

CL_Sprite

Constructs a null instance.


Attributes:

is_null

Returns true if this object is invalid.

throw_if_null

Throw an exception if this object is invalid.

get_angle

Returns current 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_linear_filter

Returns true if the sprite uses a linear filter for scaling up and down, false if a nearest-point filter is used.

get_alignment

Returns translation hot-spot.

get_rotation_hotspot

Returns rotation hot-spot.

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.

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_size

Return the size of the current frame, shortcut for 'get_frame_size(get_current_frame())'.

get_id

Returns the attached id (if exists).

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.


Operators:

operator==

Equality operator.

operator!=

Inequality operator.

operator<

Less than operator.


Operations:

set_image_data

Sets the image data from another sprite, sharing animation state.

clone

Copies all information from another sprite into this, not sharing animation state.

draw

Draw sprite on graphic context.

update

Call this function to update the animation.

set_angle

Set absolute rotation angle.

set_angle_pitch

Set absolute rotation pitch angle.

set_angle_yaw

Set absolute rotation yaw angle.

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_linear_filter

Set to true if a linear filter should be used for scaling up and down, false if a nearest-point filter should be used.

set_alignment

Sets translation hotspot.

set_rotation_hotspot

Sets rotation hotspot.

set_frame

Sets current animation frame. 0 is first frame.

set_delay

Sets the delay for all frames.

set_frame_delay

Sets the delay of a specific 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.


Signals:

sig_animation_finished

Sig animation finished.