#include <tb_animated_sprite.h>
This is an ordered sequence of SpriteFrame objects that make up an animation for the AnimatedSprite to then flip from frame to frame.
- Note
- May eventually contain desired flip rate, default looping / pingpong values etc.
TurtleBrains::Graphics::AnimationSequence::AnimationSequence |
( |
const TextureHandle & |
textureHandle | ) |
|
|
explicit |
Creates an empty AnimationSequence with no frames. Frames must then be added to the sequence in the order desired by calling AddFrame().
- Parameters
-
- Note
- This will trigger an error condition it textureHandle is kInvalidTexture.
TurtleBrains::Graphics::AnimationSequence::AnimationSequence |
( |
const SpriteMap & |
spriteMap, |
|
|
const std::vector< size_t > |
frames |
|
) |
| |
Creates an AnimationSequence with a custom sequence of mapped frames by breaking down the texture into columns and rows based on width/height of the frame and texture, then uses the frames parameter as a sequence of indices into that space. A 512x256 texture, with a 32x32 frame will have 16 columns and 8 rows. The index 0 is for the top-left of the texture, the maximum index is (columns * rows) - 1 for the bottom-right most frame of the texture.
- Parameters
-
spriteMap | The SpriteMap object describing the location and framesize of each frame in the animation. |
frames | The customized sequence of indices on the mapped texture columns by rows, starting with top-left ending at the bottom-right. |
TurtleBrains::Graphics::AnimationSequence::AnimationSequence |
( |
const SpriteMap & |
spriteMap, |
|
|
const size_t & |
startFrameIndex, |
|
|
const size_t & |
frameCount |
|
) |
| |
Creates an AnimationSequence with an ordered sequence of mapped frames by breaking down the texture into columns and rows based on width/height of the frame and texture, then uses the frames parameter as a sequence of indices into that space. A 512x256 texture, with a 32x32 frame will have 16 columns and 8 rows. The index 0 is for the top-left of the texture, the maximum index is (columns * rows) - 1 for the bottom-right most frame of the texture.
- Parameters
-
spriteMap | The SpriteMap object describing the location and framesize of each frame in the animation. |
startFrameIndex | The first frame of the ordered sequence. |
frameCount | The number of frames in the sequence, the final frame index will be startFrame + frameCount. |
TurtleBrains::Graphics::AnimationSequence::~AnimationSequence |
( |
void |
| ) |
|
void TurtleBrains::Graphics::AnimationSequence::AddFrame |
( |
const SpriteFrame & |
frame | ) |
|
Adds a single custom frame to the end of the sequence. Each frame will be played in the order added to the sequence. Call AddFrame(); in the order desired. It is possible to add the same frame multiple times as well for any desired effects.
- Parameters
-
frame | The SpriteFrame object of the next frame in the animation sequence. |
Builds a SpriteFrame to add to the end of the sequence. Each frame will be played in the order added to the sequence. Call AddFrame(); in the order desired. It is possible to add the same frame multiple times as well for any desired effects.
- Parameters
-
frameX | The horizontal pixel location of the left edge of the sprite frame, 0 is the left edge of texture. |
frameY | The vertical pixel location of the top edge of the sprite frame, 0 is the top edge of texture. |
frameWidth | The width in pixels of the sprite frame. |
frameHeight | The height in pixels of the sprite frame. |
const SpriteFrame& TurtleBrains::Graphics::AnimationSequence::GetFrame |
( |
const size_t & |
frameIndex | ) |
const |
Returns the SpriteFrame at the frameIndex or triggers an error condition if frameIndex is out-of-range.
- Parameters
-
size_t TurtleBrains::Graphics::AnimationSequence::GetFrameCount |
( |
void |
| ) |
const |