Handler for a single sprite based frame animation.
More...
#include <VAnimation.h>
Handler for a single sprite based frame animation.
◆ VAnimation()
VAnimation::VAnimation |
( |
const std::vector< int > & |
Frames, |
|
|
float |
FramesPerSecond, |
|
|
bool |
Looping, |
|
|
bool |
Reverse |
|
) |
| |
- Parameters
-
Frames | The list of Frames the animation will have, you can pass in an std::vector<int> object or an array of ints using braces (e.g. { 0, 3, 7, 8 }). |
FramesPerSecond | The amount of frames to play per second in time. This gets converted to a frameDelay using 1 / FramesPerSecond. Must be greater than 0. |
Looping | Whether the animation should loop or not. |
Reverse | Whether the animation should reverse or not. |
◆ GetCurrentFrame()
int VAnimation::GetCurrentFrame |
( |
| ) |
|
- Returns
- returns the currently used frame number.
◆ GetFrameCount()
int VAnimation::GetFrameCount |
( |
| ) |
|
- Returns
- returns the total amount of frames in the frame list.
◆ Reset()
void VAnimation::Reset |
( |
std::function< void()> |
onComplete = nullptr | ) |
|
Resets the animation to the beginning.
- Parameters
-
onComplete | A callback function used when an animation reaches its end (assuming the animation isn't Looping). |
◆ SetCurrentFrame()
void VAnimation::SetCurrentFrame |
( |
int |
NewFrame | ) |
|
Sets the current frame index the animation uses. Do not use this to set the animation's frame number, as this is specified in the frame list.
- Parameters
-
NewFrame | the frame index the animation should use. This must be greater than 0 and less than the total amount of frames specified in the frame list. |
◆ SetLooping()
void VAnimation::SetLooping |
( |
bool |
Looping | ) |
|
- Parameters
-
Looping | If true, the animation will now loop, else it won't loop. |
◆ SetReverse()
void VAnimation::SetReverse |
( |
bool |
Reverse | ) |
|
- Parameters
-
Reverse | If true, the animation will now play in reverse, else it won't. |
◆ Update()
void VAnimation::Update |
( |
float |
dt | ) |
|
Updates the animation, handles changing of frame, callbacks and passing of time.
- Parameters
-
dt | Delta Time between the current and previous frame in the game. |
The documentation for this class was generated from the following file:
- D:/Development/Libs/Vigilante-Game-Framework/VFrame/VAnimation.h