#include <sprite.h>
Public Types | |
Enums | |
| enum | ShowOnFinish { show_blank, show_last_frame, show_first_frame } |
Public Member Functions | |
Construction | |
| CL_Sprite () | |
| Constructs a sprite. | |
| CL_Sprite (CL_GraphicContext &gc) | |
| Constructs a Sprite. | |
| CL_Sprite (CL_GraphicContext &gc, const CL_StringRef &fullname) | |
| Constructs a Sprite. | |
| CL_Sprite (CL_GraphicContext &gc, const CL_StringRef &filename, CL_VirtualDirectory &dir) | |
| Constructs a Sprite. | |
| CL_Sprite (CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources) | |
| Constructs a Sprite. | |
| CL_Sprite (CL_GraphicContext &gc, CL_IODevice &file, const CL_String &image_type) | |
| Constructs a Sprite. | |
| CL_Sprite (CL_GraphicContext &gc, const CL_SpriteDescription &description) | |
| Constructs a Sprite. | |
| CL_Sprite (const CL_Sprite ©) | |
| Constructs a Sprite. | |
| virtual | ~CL_Sprite () |
Attributes | |
| bool | is_null () const |
| Returns true if the sprite is not properly constructed. | |
| CL_Angle | get_angle () const |
| Returns current angle in degrees. | |
| CL_Angle | get_base_angle () const |
| Returns the base angle in degrees - angle added to any rotation set with set_rotate() or rotate(). | |
| void | get_scale (float &x, float &y) const |
| Returns scale for x and y. | |
| float | get_alpha () const |
| Returns current alpha. | |
| CL_Colorf | get_color () const |
| Returns current color. | |
| bool | get_linear_filter () const |
| Returns true if the sprite uses a linear filter for scaling up and down, false if a nearest-point filter is used. | |
| void | get_alignment (CL_Origin &origin, int &x, int &y) const |
| Returns translation hot-spot. | |
| void | get_rotation_hotspot (CL_Origin &origin, int &x, int &y) const |
| Returns rotation hot-spot. | |
| int | get_current_frame () const |
| Returns current frame in animation. 0 is first frame. | |
| int | get_frame_count () const |
| Returns number of frames in animation. | |
| int | get_frame_delay (int frame) const |
| Returns the delay of a frame. | |
| CL_Point | get_frame_offset (int frame) const |
| Returns the translation offset of a frame. 0 is first frame. | |
| CL_Size | get_frame_size (int frame) const |
| Returns the size of a frame. 0 is first frame. | |
| int | get_width () const |
| Return the width of the current frame, shortcut for 'get_frame_size(get_current_frame()).width'. | |
| int | get_height () const |
| Return the height of the current frame, shortcut for 'get_frame_size(get_current_frame()).height'. | |
| CL_Size | get_size () const |
| Return the size of the current frame, shortcut for 'get_frame_size(get_current_frame())'. | |
| int | get_id () const |
| Returns the attached id (if exists). | |
| bool | is_play_loop () const |
| Returns true if animation is played in loop (more than once). | |
| bool | is_play_backward () const |
| Returns true if animation is played in from right to left (starts at end). | |
| bool | is_play_pingpong () const |
| Returns true if animation is played in ping-pong mode. | |
| ShowOnFinish | get_show_on_finish () const |
| Returns an enum for what is shown when the animation is finished. | |
| bool | is_finished () const |
| Returns true if animation is finished. | |
| bool | is_looping () const |
| Returns true if animation has looped in the last update cycle. | |
Operators | |
| bool | operator== (const CL_Sprite &other) const |
| Equality operator. | |
| bool | operator!= (const CL_Sprite &other) const |
| Inequality operator. | |
| bool | operator< (const CL_Sprite &other) const |
| Less than operator. | |
Operations | |
| CL_Sprite & | operator= (const CL_Sprite ©) |
| Copy assignment operator. | |
| void | set_image_data (const CL_Sprite &image_source) |
| Sets the image data from another sprite, sharing animation state. | |
| void | clone (const CL_Sprite &source) |
| Copies all information from another sprite into this, not sharing animation state. | |
| void | draw (CL_GraphicContext &gc, float x, float y) |
| Draw sprite on graphic context. | |
| void | draw (CL_GraphicContext &gc, int x, int y) |
| void | draw (CL_GraphicContext &gc, const CL_Rectf &src, const CL_Rectf &dest) |
| void | draw (CL_GraphicContext &gc, const CL_Rectf &dest) |
| int | update (int time_elapsed_ms=-1) |
| Call this function to update the animation. | |
| void | set_angle (CL_Angle angle) |
| Set absolute rotation angle. | |
| void | set_angle_pitch (CL_Angle angle) |
| Set absolute rotation pitch angle. | |
| void | set_angle_yaw (CL_Angle angle) |
| Set absolute rotation yaw angle. | |
| void | rotate (CL_Angle angle) |
| Add angle in degrees to current angle. | |
| void | rotate_pitch (CL_Angle angle) |
| Add angle in degrees to current pitch angle. | |
| void | rotate_yaw (CL_Angle angle) |
| Add angle in degrees to current yaw angle. | |
| void | set_base_angle (CL_Angle angle) |
| Sets the base angle in degrees - angle added to any rotation set with set_rotate() or rotate(). | |
| void | set_scale (float x, float y) |
| Set scale for x and y directions individually. | |
| void | set_alpha (float alpha) |
| Sets transparency. | |
| void | set_color (const CL_Colorf &color) |
| Sets the color. | |
| void | set_color (const CL_Color &c) |
| Set color. | |
| void | set_linear_filter (bool linear_filter=true) |
| Set to true if a linear filter should be used for scaling up and down, false if a nearest-point filter should be used. | |
| void | set_alignment (CL_Origin origin, int x=0, int y=0) |
| Sets translation hotspot. | |
| void | set_rotation_hotspot (CL_Origin origin, int x=0, int y=0) |
| Sets rotation hotspot. | |
| void | set_frame (unsigned int frame) |
| Sets current animation frame. 0 is first frame. It will cap to available range. | |
| void | set_delay (int delay_ms) |
| Sets the delay for all frames. | |
| void | set_frame_delay (int frame, int delay_ms) |
| Sets the delay of a specific frame. | |
| void | set_frame_offset (int frame, CL_Point offset) |
| Sets the translate offset of a specific frame. 0 is first frame. | |
| void | set_id (int id) |
| Sets an attached id. | |
| void | finish () |
| Finish animation. | |
| void | restart () |
| Restart animation. | |
| void | set_play_loop (bool loop=true) |
| Set to true if animation should loop, false otherwise. | |
| void | set_play_pingpong (bool pingpong=true) |
| Set to true if animation should loop, false otherwise. | |
| void | set_play_backward (bool backward=true) |
| Set to true if animation should go backward (start at end). | |
| void | set_show_on_finish (CL_Sprite::ShowOnFinish show_on_finish) |
| Set what is shown when the animation is finished. | |
Signals | |
| CL_Signal_v0 & | sig_animation_finished () |
| Sig animation finished. | |
|
|
|
|
|
Constructs a sprite.
|
|
|
Constructs a Sprite.
|
|
||||||||||||
|
Constructs a Sprite.
|
|
||||||||||||||||
|
Constructs a Sprite.
|
|
||||||||||||||||
|
Constructs a Sprite.
|
|
||||||||||||||||
|
Constructs a Sprite.
|
|
||||||||||||
|
Constructs a Sprite.
|
|
|
Constructs a Sprite.
|
|
|
|
|
|
Copies all information from another sprite into this, not sharing animation state. This will not share animation state afterwards, like sprite1 = sprite2 would do. |
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Draw sprite on graphic context.
|
|
|
Finish animation. When an animation is finished, it will no longer show, unless ShowLastFrame is set to anything other than show_blank |
|
||||||||||||||||
|
Returns translation hot-spot.
|
|
|
Returns current alpha. Alpha 0.0f is full transparency, and 1.0f is full visibility (solid). |
|
|
Returns current angle in degrees.
|
|
|
Returns the base angle in degrees - angle added to any rotation set with set_rotate() or rotate().
|
|
|
Returns current color. Alpha 0.0f is full transparency, and 1.0f is full visibility (solid). |
|
|
Returns current frame in animation. 0 is first frame.
|
|
|
Returns number of frames in animation.
|
|
|
Returns the delay of a frame.
|
|
|
Returns the translation offset of a frame. 0 is first frame.
|
|
|
Returns the size of a frame. 0 is first frame.
|
|
|
Return the height of the current frame, shortcut for 'get_frame_size(get_current_frame()).height'.
|
|
|
Returns the attached id (if exists).
|
|
|
Returns true if the sprite uses a linear filter for scaling up and down, false if a nearest-point filter is used.
|
|
||||||||||||||||
|
Returns rotation hot-spot.
|
|
||||||||||||
|
Returns scale for x and y. 1.0f is normal scale, 2.0f is twice the size, etc. |
|
|
Returns an enum for what is shown when the animation is finished. If show_blank is returned, nothing is shown when animation is done. |
|
|
Return the size of the current frame, shortcut for 'get_frame_size(get_current_frame())'.
|
|
|
Return the width of the current frame, shortcut for 'get_frame_size(get_current_frame()).width'.
|
|
|
Returns true if animation is finished. When an animation is finished, it will no longer show, unless ShowLastFrame is set to anything other than show_blank |
|
|
Returns true if animation has looped in the last update cycle.
|
|
|
Returns true if the sprite is not properly constructed.
|
|
|
Returns true if animation is played in from right to left (starts at end).
|
|
|
Returns true if animation is played in loop (more than once).
|
|
|
Returns true if animation is played in ping-pong mode.
|
|
|
Inequality operator.
|
|
|
Less than operator.
|
|
|
Copy assignment operator.
|
|
|
Equality operator.
|
|
|
Restart animation.
|
|
|
Add angle in degrees to current angle.
|
|
|
Add angle in degrees to current pitch angle.
|
|
|
Add angle in degrees to current yaw angle.
|
|
||||||||||||||||
|
Sets translation hotspot.
|
|
|
Sets transparency. Alpha 0.0f is full transparency, and 1.0f is full visibility (solid). |
|
|
Set absolute rotation angle.
|
|
|
Set absolute rotation pitch angle.
|
|
|
Set absolute rotation yaw angle.
|
|
|
Sets the base angle in degrees - angle added to any rotation set with set_rotate() or rotate().
|
|
|
Set color.
|
|
|
Sets the color. Alpha 0.0f is full transparency, and 1.0f is full visibility (solid). |
|
|
Sets the delay for all frames.
|
|
|
Sets current animation frame. 0 is first frame. It will cap to available range.
|
|
||||||||||||
|
Sets the delay of a specific frame.
|
|
||||||||||||
|
Sets the translate offset of a specific frame. 0 is first frame.
|
|
|
Sets an attached id.
|
|
|
Sets the image data from another sprite, sharing animation state. Use this to change the look of your sprite. |
|
|
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 to true if animation should go backward (start at end).
|
|
|
Set to true if animation should loop, false otherwise.
|
|
|
Set to true if animation should loop, false otherwise.
|
|
||||||||||||||||
|
Sets rotation hotspot.
|
|
||||||||||||
|
Set scale for x and y directions individually. 1.0f is normal scale, 2.0f is twice the size, etc. |
|
|
Set what is shown when the animation is finished.
|
|
|
Sig animation finished.
|
|
|
Call this function to update the animation.
|
1.4.6