Steps through frames over time, to use with a SpriteSheet.
More...
#include <sprite_sheet.h>
Steps through frames over time, to use with a SpriteSheet.
Definition at line 76 of file sprite_sheet.h.
◆ Animation() [1/2]
| asw::Animation::Animation |
( |
| ) |
|
|
default |
Create an animation with a single frame.
◆ Animation() [2/2]
| asw::Animation::Animation |
( |
int | frame_count, |
|
|
float | frame_duration, |
|
|
bool | loop = true ) |
Create an animation.
- Parameters
-
| frame_count | The number of frames. |
| frame_duration | Seconds each frame is shown. |
| loop | Whether to start over after the last frame. |
Definition at line 73 of file sprite_sheet.cpp.
◆ get_frame()
| int asw::Animation::get_frame |
( |
| ) |
const |
Get the frame to draw.
- Returns
- The frame index.
Definition at line 102 of file sprite_sheet.cpp.
◆ is_finished()
| bool asw::Animation::is_finished |
( |
| ) |
const |
Check if a non looping animation has reached its last frame.
- Returns
- True when finished, always false for looping animations.
Definition at line 113 of file sprite_sheet.cpp.
◆ reset()
| void asw::Animation::reset |
( |
| ) |
|
◆ set_frame_duration()
| void asw::Animation::set_frame_duration |
( |
float | frame_duration | ) |
|
Set seconds each frame is shown.
- Parameters
-
| frame_duration | The duration in seconds. |
Definition at line 97 of file sprite_sheet.cpp.
◆ update()
| void asw::Animation::update |
( |
float | dt | ) |
|
Advance the animation.
- Parameters
-
| dt | The time in seconds since the last update. |
Definition at line 80 of file sprite_sheet.cpp.
◆ elapsed
| float asw::Animation::elapsed { 0.0F } |
|
private |
◆ frame_count
| int asw::Animation::frame_count { 1 } |
|
private |
◆ frame_duration
| float asw::Animation::frame_duration { 0.1F } |
|
private |
◆ loop
| bool asw::Animation::loop { true } |
|
private |
The documentation for this class was generated from the following files: