1#ifndef UTIL_ANIMATION_HPP
2#define UTIL_ANIMATION_HPP
8#include "Core/Drawable.hpp"
10#include "Util/Image.hpp"
38 Animation(
const std::vector<std::string> &paths,
bool play,
39 std::size_t interval,
bool looping =
true,
40 std::size_t cooldown = 100,
bool useAA =
true);
82 glm::vec2
GetSize()
const override {
return m_Frames[m_Index]->GetSize(); }
150 std::vector<std::shared_ptr<Util::Image>> m_Frames;
154 std::size_t m_Cooldown;
155 bool m_IsChangeFrame =
false;
157 unsigned long m_CooldownEndTime = 0;
158 double m_TimeBetweenFrameUpdate = 0;
160 std::size_t m_Index = 0;
Definition: Drawable.hpp:14
Class representing an animation with frames.
Definition: Animation.hpp:17
void Pause()
Pause the animation. If the animation has already been paused, this method won't do anything.
int GetCooldown() const
Get the cooldown time.
Definition: Animation.hpp:58
State
Enum representing the state of the animation.
Definition: Animation.hpp:22
void UseAntiAliasing(bool useAA)
Sets whether anti-aliasing (AA) should be enabled or disabled.
void Play()
Start playing the animation. If the animation is already playing, this method won't do anything....
void Draw(const Core::Matrices &data) override
Draw the current frame.
int GetInterval() const
Get the interval between frames.
Definition: Animation.hpp:46
void SetLooping(bool looping)
Set whether the animation loops.
Definition: Animation.hpp:94
void SetCooldown(int cooldown)
Set the cooldown time.
Definition: Animation.hpp:100
void SetInterval(int interval)
Set the interval between frames.
Definition: Animation.hpp:88
bool GetLooping() const
Check if the animation loops.
Definition: Animation.hpp:52
std::size_t GetCurrentFrameIndex() const
Get the index of the current frame.
Definition: Animation.hpp:64
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.
glm::vec2 GetSize() const override
Get the size of the current frame.
Definition: Animation.hpp:82
State GetState() const
Get the current state of the animation.
Definition: Animation.hpp:76
std::size_t GetFrameCount() const
Get the total number of frames in the animation.
Definition: Animation.hpp:70
void SetCurrentFrame(std::size_t index)
Set the current frame of the animation.
Useful tools for development.
Definition: Animation.hpp:12
Definition: Drawable.hpp:9