Better scene management.

This commit is contained in:
2025-01-02 12:57:21 -05:00
parent b9afc57e6e
commit 30bdd66086
13 changed files with 78 additions and 47 deletions

View File

@@ -0,0 +1,23 @@
#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;
};