Class SpriteAnimation#
Defined in File SpriteAnimation.h
Class Documentation#
-
class SpriteAnimation#
Public Functions
-
constexpr SpriteAnimation(std::string name, std::vector<TRAP::Ref<SubTexture2D>> sprites, f32 speed) noexcept#
Constructor. Creates a new sprite animation.
- Parameters:
name – Name for the animation.
sprites – Sprites used by the animation.
speed – Speed of the animation in seconds.
-
constexpr SpriteAnimation(const SpriteAnimation&) noexcept = default#
Copy Constructor.
-
constexpr SpriteAnimation(SpriteAnimation&&) noexcept = default#
Move Constructor.
-
constexpr SpriteAnimation &operator=(const SpriteAnimation&) noexcept = default#
Copy Assignment Operator.
-
constexpr SpriteAnimation &operator=(SpriteAnimation&&) noexcept = default#
Move Assignment Operator.
-
constexpr ~SpriteAnimation() = default#
Destructor.
-
constexpr void OnUpdate(const Utils::TimeStep &deltaTime) noexcept#
Update the sprite animation.
- Parameters:
deltaTime – Delta time.
-
constexpr const std::vector<TRAP::Ref<SubTexture2D>> &GetAllSprites() const noexcept#
Retrieve all sprites used by the animation.
- Returns:
List of sprites.
-
TRAP::Ref<SubTexture2D> GetCurrentSprite()#
Retrieve the current sprite of the animation.
- Returns:
Current sprite.
-
constexpr void SetSpeed(f32 speed) noexcept#
Set the animation speed.
- Parameters:
speed – Speed in seconds.
-
constexpr void Play() noexcept#
Play the animation.
-
constexpr void Pause() noexcept#
Pause the animation.
-
constexpr void Stop() noexcept#
Stop the animation.
Public Static Functions
-
static TRAP::Ref<SpriteAnimation> Create(std::string name, std::vector<TRAP::Ref<SubTexture2D>> sprites, f32 speed)#
Create a sprite animation from a list of sprites.
- Parameters:
name – Name for the animation.
sprites – Sprites to be used by the animation.
speed – Speed of the animation in seconds.
- Returns:
Created SpriteAnimation.
-
constexpr SpriteAnimation(std::string name, std::vector<TRAP::Ref<SubTexture2D>> sprites, f32 speed) noexcept#