An Animation frame.
More...
#include <AnimationFrame.h>
An Animation frame.
Definition at line 36 of file AnimationFrame.h.
◆ AnimationFrame() [1/3]
ime::AnimationFrame::AnimationFrame |
( |
unsigned int |
rectLeft, |
|
|
unsigned int |
rectTop, |
|
|
unsigned int |
rectWidth, |
|
|
unsigned int |
rectHeight |
|
) |
| |
Construct the frame from its coordinates.
- Parameters
-
rectLeft | Left coordinate of the frame |
rectTop | Top coordinate of the frame |
rectWidth | Width of the frame |
rectHeight | Height of the frame |
- Note
- the last two parameters are the width and height, not the right and bottom coordinates!
◆ AnimationFrame() [2/3]
ime::AnimationFrame::AnimationFrame |
( |
const UIntRect & |
rect | ) |
|
Construct the frame from.
- Parameters
-
◆ AnimationFrame() [3/3]
◆ getIndex()
unsigned int ime::AnimationFrame::getIndex |
( |
| ) |
const |
Get the position of the frame in the animation sequence.
- Returns
- The index of the frame in the animation sequence
◆ getName()
const std::string & ime::AnimationFrame::getName |
( |
| ) |
const |
Get the name of the frame.
- Returns
- The name of the frame
- See also
- setName
◆ getSpritesheetRect()
const UIntRect & ime::AnimationFrame::getSpritesheetRect |
( |
| ) |
const |
Get position information of the frame on the Spritesheet.
- Returns
- Position information on the animations spritesheet
◆ isCurrent()
bool ime::AnimationFrame::isCurrent |
( |
| ) |
const |
Check if the frame is currently displayed by the animation.
- Returns
- True if currently displayed, otherwise false
◆ operator=()
Copy assignment operator.
◆ setName()
void ime::AnimationFrame::setName |
( |
const std::string & |
name | ) |
|
Set the name of the frame.
- Parameters
-
name | The name of the frame |
The name property allows you to retrieve or remove an animation frame from an Animation by its name instead of its index. Here is an example that plays an explosion effect when the animation reaches the 3rd frame:
explosionAnim->getFrame(2).setName("audioTrigger");
...
if (animator.getCurrentFrame().getName() == "audioTrigger")
explosionSfx.play()
std::shared_ptr< Animation > Ptr
Shared animation pointer.
static Animation::Ptr create(const std::string &name, const SpriteSheet &spriteSheet, const Time &duration=Time::Zero)
Create a new Animation object.
Represents a position Grid2D Tile.
By default the frame name is an empty string
- See also
- getName
◆ Animation
The documentation for this class was generated from the following file: