23 lines
765 B
C++
23 lines
765 B
C++
#pragma once
|
|
|
|
#include "JGL/types/Texture.h"
|
|
|
|
using JGL::Texture;
|
|
|
|
class Animation {
|
|
protected:
|
|
std::string name{};
|
|
float ms_between_frames = 1.0f;
|
|
std::vector<Texture> textures{};
|
|
public:
|
|
[[nodiscard]] std::string GetName() const;
|
|
[[nodiscard]] float GetMsBetweenFrames() const;
|
|
|
|
/// @param animation_time a float from 0 to 1. 0 being the beginning of the animation and 1 being the end.
|
|
[[nodiscard]] const JGL::Texture* GetTexture(float animation_time) const;
|
|
public:
|
|
void SetMsBetweenFrames(float new_ms_between_frames);
|
|
public:
|
|
Animation(const std::string& name, float ms_between_frames, std::vector<Texture>& textures) : name(name), ms_between_frames(ms_between_frames), textures(textures) {};
|
|
~Animation() = default;
|
|
}; |