11#include <unordered_map>
74 const std::unordered_map<std::string, AnimationClip> &
getClips()
const {
return _clips; }
82 auto it =
_clips.find(clipName);
83 return (it !=
_clips.end()) ? &it->second :
nullptr;
120 std::unordered_map<std::string, AnimationClip>
_clips;
Component containing all available animations for an entity.
AnimationSet(const std::string &textureKey)
Constructor with texture key.
std::unordered_map< std::string, AnimationClip > _clips
Map of animation clips.
const std::unordered_map< std::string, AnimationClip > & getClips() const
Get all animation clips.
ComponentType getType() const override
Get the component type ID.
void removeClip(const std::string &clipName)
Remove an animation clip.
void setTextureKey(const std::string &textureKey)
Set the texture key.
void addClip(const std::string &clipName, const AnimationClip &clip)
Add an animation clip.
bool hasClip(const std::string &clipName) const
Check if a clip exists.
~AnimationSet() override=default
std::string _textureKey
Texture identifier for animations.
std::string getTextureKey() const
Get the texture key.
const AnimationClip * getClip(const std::string &clipName) const
Get a specific animation clip.
Base interface for all ECS components.
Maximum number of distinct component types supported by the Registry.
std::size_t ComponentType
Type alias for component identification.
Defines a sequence of frames for an animation.
std::string nextClip
Next clip name after completion (optional)
AnimationClip()
Default constructor.
AnimationClip(const std::vector< Rectangle > &frames, float duration=0.1f, bool loop=true, const std::string &nextClip="")
Constructor with all parameters.
bool loop
Whether animation loops.
float frameDuration
Duration per frame in seconds.
std::vector< Rectangle > frames
Frame rectangles in the texture.