Cubios::Gfx::AnimatedSprite
Public Enums
playbackMode_t
Summary
Sprite animation playback modes:
- Loop - The animation is looped, when the last frame is reached, it rewinds to the beginning
- Bounce - The animation is looped, when the last frame is reached, the animation playback direction is reversed; when the first frame is reached, respectively, the direction of the animation playback changes again
- Set - Animation plays 1 time beginning from the set frame
Synopsis
Constructors
AnimatedSprite
Constructs an object for rendering articulated set of images, an animated sprite
Arguments
- names - names of sprite resources, each represents a single frame of animation
- t - Transform object that holds initial screen position, rotation and mirroring mode of the sprite
Synopsis
Arguments
- names - names of sprite resources, each represents a single frame of animation
- x - x screen coordinate of initial postion of the sprite
- y - y screen coordinate of initial postion of the sprite
Synopsis
Arguments
- names - names of sprite resources, each represents a single frame of animation
Synopsis
Arguments
- name - a "common" name of sprite resources
- extension - filename extension of sprite resources
- firstFrame - index of the first frame of animation
- lastFrame - index of the last frame of animation
- t - Transform object that holds initial screen position, rotation and mirroring mode of the sprite
Comment
Consider the following set of files that holds animation frames:
In order to create an animation that plays all frames in 1-2-3-4-5 order, the name should be anim, the extension is png and the first and last values are 1 and 5 correspondingly
Synopsis
Arguments
- name - a "common" name of sprite resources
- extension - filename extension of sprite resources
- firstFrame - index of the first frame of animation
- lastFrame - index of the last frame of animation
- x - x screen coordinate of initial postion of the sprite
- y - y screen coordinate of initial postion of the sprite
Comment
Consider the following set of files that holds animation frames:
In order to create an animation that plays all frames in 1-2-3-4-5 order, the name should be anim, the extension is png and the first and last values are 1 and 5 correspondingly
Synopsis
Arguments
- name - a "common" name of sprite resources
- extension - filename extension of sprite resources
- firstFrame - index of the first frame of animation
- lastFrame - index of the last frame of animation
Comment
Consider the following set of files that holds animation frames:
In order to create an animation that plays all frames in 1-2-3-4-5 order, the name should be anim, the extension is png and the first and last values are 1 and 5 correspondingly
Synopsis
Arguments
- sprite - animated sprite object which parameters will be used to initialize the sprite
Synopsis
Public Methods
Tick
Summary
Executes animation step. Must be called before the sprite is rendered
Arguments
- dt - time since previous call of the function, in milliseconds
Output
Returns an index of current frame of the animation
Synopsis
SetFrame
Summary
Sets current frame of the animation
Arguments
- frameNumber - index of a frame
Output
Returns a pointer to the object to which the change was applied
Synopsis
SetPlaybackSpeed
Summary
Sets animation playback speed, the time that must pass between frames of the animation before current frame gets changed to the next one
Arguments
- speed - playback speed, in milliseconds
Output
Returns a pointer to the object to which the change was applied
Synopsis
SetPlaybackMode
Summary
Sets animation playback mode. Available modes are loop, bounce and set
Arguments
- mode - animation playback mode
Output
Returns a pointer to the object to which the change was applied
Synopsis
PrevFrame
Summary
Gets an index of previous frame in the animation relatively to current one
Synopsis
NextFrame
Summary
Gets an index of previous frame in the animation relatively to current one
Synopsis