![]() |
Gamedev Framework (gf)
0.10.0
A C++14 framework for 2D games
|
An animation. More...
#include <gf/Animation.h>
Public Member Functions | |
Animation () | |
Default constructor. More... | |
void | addFrame (const Texture &texture, const RectF &bounds, Time duration) |
Add a frame to the animation. More... | |
const Texture & | getCurrentTexture () const |
Get the current texture. More... | |
RectF | getCurrentBounds () const |
Get the current texture rectangle. More... | |
bool | update (Time time) |
Update the state of the animation. More... | |
An animation.
An animation is a collection of frames that are displayed consecutively during a predefined amount of time.
To display an animation, you need a gf::AnimatedSprite.
gf::Animation::Animation | ( | ) |
Default constructor.
Add a frame to the animation.
The frame of an animation is defined by the texture of the frame, the texture rectangle (in texture coordinates) and an amount of time.
texture | The texture where the sprite is |
bounds | The texture rectangle where the sprite is |
duration | The amount of time to display the frame |
RectF gf::Animation::getCurrentBounds | ( | ) | const |
Get the current texture rectangle.
std::runtime_error | If the animation is empty |
const Texture& gf::Animation::getCurrentTexture | ( | ) | const |
Get the current texture.
std::runtime_error | If the animation is empty |
bool gf::Animation::update | ( | Time | time | ) |
Update the state of the animation.
time | The time since the last update |