Gamedev Framework (gf)
0.3.0
A C++11 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, float 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 (float dt) |
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.
const Texture* gf::Animation::getCurrentTexture | ( | ) | const |
Get the current texture.
nullptr
if the animation is empty bool gf::Animation::update | ( | float | dt | ) |
Update the state of the animation.
dt | The time (in seconds) since the last update |