R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ecs::AnimationSet Class Reference

Component containing all available animations for an entity. More...

#include <AnimationSet.hpp>

Inheritance diagram for ecs::AnimationSet:
Inheritance graph
Collaboration diagram for ecs::AnimationSet:
Collaboration graph

Public Member Functions

 AnimationSet (const std::string &textureKey)
 Constructor with texture key.
 
 ~AnimationSet () override=default
 
std::string getTextureKey () const
 Get the texture key.
 
const std::unordered_map< std::string, AnimationClip > & getClips () const
 Get all animation clips.
 
const AnimationClipgetClip (const std::string &clipName) const
 Get a specific animation clip.
 
bool hasClip (const std::string &clipName) const
 Check if a clip exists.
 
void setTextureKey (const std::string &textureKey)
 Set the texture key.
 
void addClip (const std::string &clipName, const AnimationClip &clip)
 Add an animation clip.
 
void removeClip (const std::string &clipName)
 Remove an animation clip.
 
ComponentType getType () const override
 Get the component type ID.
 
- Public Member Functions inherited from ecs::IComponent
virtual ~IComponent ()=default
 Virtual destructor.
 

Private Attributes

std::string _textureKey
 Texture identifier for animations.
 
std::unordered_map< std::string, AnimationClip_clips
 Map of animation clips.
 

Detailed Description

Component containing all available animations for an entity.

Stores the texture key and a map of named animation clips. This component defines what animations an entity can play.

Definition at line 54 of file AnimationSet.hpp.

Constructor & Destructor Documentation

◆ AnimationSet()

ecs::AnimationSet::AnimationSet ( const std::string &  textureKey)
inlineexplicit

Constructor with texture key.

Parameters
textureKeyTexture identifier for all animations

Definition at line 60 of file AnimationSet.hpp.

◆ ~AnimationSet()

ecs::AnimationSet::~AnimationSet ( )
overridedefault

Member Function Documentation

◆ addClip()

void ecs::AnimationSet::addClip ( const std::string &  clipName,
const AnimationClip clip 
)
inline

◆ getClip()

const AnimationClip * ecs::AnimationSet::getClip ( const std::string &  clipName) const
inline

Get a specific animation clip.

Parameters
clipNameName of the animation clip
Returns
const AnimationClip* Pointer to clip, or nullptr if not found.

Definition at line 81 of file AnimationSet.hpp.

References _clips.

Referenced by ecs::AnimationSystem::update().

◆ getClips()

const std::unordered_map< std::string, AnimationClip > & ecs::AnimationSet::getClips ( ) const
inline

Get all animation clips.

Returns
const std::unordered_map<std::string, AnimationClip>& Map of clip names to clips.

Definition at line 74 of file AnimationSet.hpp.

References _clips.

◆ getTextureKey()

std::string ecs::AnimationSet::getTextureKey ( ) const
inline

Get the texture key.

Returns
std::string The texture identifier.

Definition at line 68 of file AnimationSet.hpp.

References _textureKey.

◆ getType()

ComponentType ecs::AnimationSet::getType ( ) const
inlineoverridevirtual

Get the component type ID.

Returns
ComponentType Unique ID for AnimationSet component.

Implements ecs::IComponent.

Definition at line 116 of file AnimationSet.hpp.

◆ hasClip()

bool ecs::AnimationSet::hasClip ( const std::string &  clipName) const
inline

Check if a clip exists.

Parameters
clipNameName of the animation clip
Returns
bool True if clip exists.

Definition at line 91 of file AnimationSet.hpp.

References _clips.

Referenced by ecs::AnimationSystem::update().

◆ removeClip()

void ecs::AnimationSet::removeClip ( const std::string &  clipName)
inline

Remove an animation clip.

Parameters
clipNameName of the clip to remove

Definition at line 110 of file AnimationSet.hpp.

References _clips.

◆ setTextureKey()

void ecs::AnimationSet::setTextureKey ( const std::string &  textureKey)
inline

Set the texture key.

Parameters
textureKeyNew texture identifier

Definition at line 97 of file AnimationSet.hpp.

References _textureKey.

Member Data Documentation

◆ _clips

std::unordered_map<std::string, AnimationClip> ecs::AnimationSet::_clips
private

Map of animation clips.

Definition at line 120 of file AnimationSet.hpp.

Referenced by addClip(), getClip(), getClips(), hasClip(), and removeClip().

◆ _textureKey

std::string ecs::AnimationSet::_textureKey
private

Texture identifier for animations.

Definition at line 119 of file AnimationSet.hpp.

Referenced by getTextureKey(), and setTextureKey().


The documentation for this class was generated from the following file: