Class representing an animation with frames.
More...
#include <Animation.hpp>
|
| | Animation (const std::vector< std::string > &paths, bool play, std::size_t interval, bool looping=true, std::size_t cooldown=100, bool useAA=true) |
| | Constructor for Animation class. More...
|
| |
| int | GetInterval () const |
| | Get the interval between frames. More...
|
| |
| bool | GetLooping () const |
| | Check if the animation loops. More...
|
| |
| int | GetCooldown () const |
| | Get the cooldown time. More...
|
| |
| std::size_t | GetCurrentFrameIndex () const |
| | Get the index of the current frame. More...
|
| |
| std::size_t | GetFrameCount () const |
| | Get the total number of frames in the animation. More...
|
| |
| State | GetState () const |
| | Get the current state of the animation. More...
|
| |
| glm::vec2 | GetSize () const override |
| | Get the size of the current frame. More...
|
| |
| void | SetInterval (int interval) |
| | Set the interval between frames. More...
|
| |
| void | SetLooping (bool looping) |
| | Set whether the animation loops. More...
|
| |
| void | SetCooldown (int cooldown) |
| | Set the cooldown time. More...
|
| |
| void | UseAntiAliasing (bool useAA) |
| | Sets whether anti-aliasing (AA) should be enabled or disabled. More...
|
| |
| void | SetCurrentFrame (std::size_t index) |
| | Set the current frame of the animation. More...
|
| |
| void | Draw (const Core::Matrices &data) override |
| | Draw the current frame. More...
|
| |
|
void | Play () |
| | Start playing the animation. If the animation is already playing, this method won't do anything. If the animation has ended and looping is set to false, this would replay the animation once.
|
| |
|
void | Pause () |
| | Pause the animation. If the animation has already been paused, this method won't do anything.
|
| |
| virtual void | Draw (const Core::Matrices &data)=0 |
| |
| virtual glm::vec2 | GetSize () const =0 |
| |
Class representing an animation with frames.
◆ State
Enum representing the state of the animation.
◆ Animation()
| Util::Animation::Animation |
( |
const std::vector< std::string > & |
paths, |
|
|
bool |
play, |
|
|
std::size_t |
interval, |
|
|
bool |
looping = true, |
|
|
std::size_t |
cooldown = 100, |
|
|
bool |
useAA = true |
|
) |
| |
Constructor for Animation class.
- Parameters
-
| paths | Vector of file paths for the frames. |
| play | Whether the animation should play right away. |
| interval | Interval between frames in milliseconds. |
| looping | Whether the animation should loop. |
| cooldown | Cooldown time in milliseconds before the animation can restart. |
◆ Draw()
Draw the current frame.
- Parameters
-
| transform | Transformation matrix for drawing. |
| zIndex | Z-index for drawing. |
Implements Core::Drawable.
◆ GetCooldown()
| int Util::Animation::GetCooldown |
( |
| ) |
const |
|
inline |
Get the cooldown time.
- Returns
- Cooldown time in milliseconds.
◆ GetCurrentFrameIndex()
| std::size_t Util::Animation::GetCurrentFrameIndex |
( |
| ) |
const |
|
inline |
Get the index of the current frame.
- Returns
- Index of the current frame.
◆ GetFrameCount()
| std::size_t Util::Animation::GetFrameCount |
( |
| ) |
const |
|
inline |
Get the total number of frames in the animation.
- Returns
- Total number of frames.
◆ GetInterval()
| int Util::Animation::GetInterval |
( |
| ) |
const |
|
inline |
Get the interval between frames.
- Returns
- Interval between frames in milliseconds.
◆ GetLooping()
| bool Util::Animation::GetLooping |
( |
| ) |
const |
|
inline |
Check if the animation loops.
- Returns
- True if the animation loops, false otherwise.
◆ GetSize()
| glm::vec2 Util::Animation::GetSize |
( |
| ) |
const |
|
inlineoverridevirtual |
Get the size of the current frame.
- Returns
- Size of the current frame.
Implements Core::Drawable.
◆ GetState()
| State Util::Animation::GetState |
( |
| ) |
const |
|
inline |
Get the current state of the animation.
- Returns
- The current state of the animation
◆ SetCooldown()
| void Util::Animation::SetCooldown |
( |
int |
cooldown | ) |
|
|
inline |
Set the cooldown time.
- Parameters
-
| cooldown | Cooldown time in milliseconds. |
◆ SetCurrentFrame()
| void Util::Animation::SetCurrentFrame |
( |
std::size_t |
index | ) |
|
Set the current frame of the animation.
- Parameters
-
| index | Index of the frame to set as current. |
◆ SetInterval()
| void Util::Animation::SetInterval |
( |
int |
interval | ) |
|
|
inline |
Set the interval between frames.
- Parameters
-
| interval | Interval between frames in milliseconds. |
◆ SetLooping()
| void Util::Animation::SetLooping |
( |
bool |
looping | ) |
|
|
inline |
Set whether the animation loops.
- Parameters
-
| looping | True to enable looping, false to disable. |
◆ UseAntiAliasing()
| void Util::Animation::UseAntiAliasing |
( |
bool |
useAA | ) |
|
Sets whether anti-aliasing (AA) should be enabled or disabled.
- Parameters
-
| useAA | A boolean value indicating whether anti-aliasing should be enabled (true) or disabled (false). |
- Note
- This function only sets the internal flag for anti-aliasing and does not directly affect rendering. The actual effect of anti-aliasing depends on the rendering pipeline and the graphics hardware capabilities.
- See also
- https://en.wikipedia.org/wiki/Spatial_anti-aliasing
The documentation for this class was generated from the following file: