39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#define IMAGE_ANIMATION typeid(ImageAnimation).name()
|
|
|
|
#include "Image.hpp"
|
|
#include "elements/BehaviourScript.hpp"
|
|
#include "elements/ImageAnimationSet.hpp"
|
|
#include <unordered_map>
|
|
|
|
|
|
namespace TSE
|
|
{
|
|
class ImageAnimation : public BehaviourScript
|
|
{
|
|
private:
|
|
std::unordered_map<string, ImageAnimationSet*> animations;
|
|
string currentAnimation = "";
|
|
int frame = 0;
|
|
float deltatime = 0;
|
|
|
|
public:
|
|
ImageAnimation();
|
|
void SetAnimationSet(ImageAnimationSet* set);
|
|
void SetAnimationSet(string name, ImageAnimationSet* set);
|
|
void StartAnimation(const string name);
|
|
int GetImageAnimationSetCount();
|
|
ImageAnimationSet* GetImageAnimationAt(int& i);
|
|
string& GetCurrentAnimation();
|
|
int& GetCurrentFrame();
|
|
float& GetDeltaTime();
|
|
void RemoveAnimationSet(std::string& name);
|
|
void OnUpdate() override;
|
|
inline const char* GetName() override
|
|
{
|
|
return "Image Animation";
|
|
}
|
|
};
|
|
} // namespace TSE
|