Changes a sprite's subrect over time.
More...
|
| FrameAnimation () |
| Default constructor.
|
|
void | addFrame (float relativeDuration, const sf::IntRect &subrect) |
| Adds a frame to the animation, changes only the sub-rect. More...
|
|
void | addFrame (float relativeDuration, const sf::IntRect &subrect, sf::Vector2f origin) |
| Adds a frame to the animation, changes sub-rect and sprite origin. More...
|
|
template<class Animated > |
void | operator() (Animated &animated, float progress) const |
| Animates the object. More...
|
|
Changes a sprite's subrect over time.
This class stores multiple frames that represent the sub-rectangle of a texture. The resulting animation consists of a sequence of frames that are drawn one after another.
void thor::FrameAnimation::addFrame |
( |
float |
relativeDuration, |
|
|
const sf::IntRect & |
subrect |
|
) |
| |
Adds a frame to the animation, changes only the sub-rect.
- Parameters
-
relativeDuration | Duration of the frame relative to the other durations. |
subrect | Rectangle of the sf::Texture that is used for the new frame. |
void thor::FrameAnimation::addFrame |
( |
float |
relativeDuration, |
|
|
const sf::IntRect & |
subrect, |
|
|
sf::Vector2f |
origin |
|
) |
| |
Adds a frame to the animation, changes sub-rect and sprite origin.
- Parameters
-
relativeDuration | Duration of the frame relative to the other durations. |
subrect | Rectangle of the sf::Texture that is used for the new frame. |
origin | Position of the coordinate system origin. Is useful when frames have rectangles of different sizes. |
template<class Animated >
void thor::FrameAnimation::operator() |
( |
Animated & |
animated, |
|
|
float |
progress |
|
) |
| const |
Animates the object.
- Parameters
-
animated | Object to animate. |
progress | Value in [0,1] determining the progress of the animation. |
- Template Parameters
-
Animated | Class with member functions void setTextureRect(sf::IntRect) and void setOrigin(sf::Vector2f), for example sf::Sprite. |
The documentation for this class was generated from the following file: