![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Animation system for sprite-based 2D animations. More...
#include <ECS_Systems_Animation.h>
Inheritance diagram for AnimationSystem:
Collaboration diagram for AnimationSystem:Public Member Functions | |
| AnimationSystem () | |
| virtual void | Process () override |
| void | PlayAnimation (EntityID entity, const std::string &animName, bool restart=false) |
| Play a specific animation on an entity. | |
| void | PauseAnimation (EntityID entity) |
| Pause animation playback. | |
| void | ResumeAnimation (EntityID entity) |
| Resume paused animation. | |
| void | StopAnimation (EntityID entity) |
| Stop animation playback. | |
| void | SetPlaybackSpeed (EntityID entity, float speed) |
| Set playback speed multiplier. | |
| int | GetCurrentFrame (EntityID entity) const |
| bool | IsAnimationComplete (EntityID entity) const |
Public Member Functions inherited from ECS_System | |
| ECS_System () | |
| virtual void | Render () |
| virtual void | RenderDebug () |
| void | AddEntity (EntityID entity) |
| void | RemoveEntity (EntityID entity) |
Private Member Functions | |
| void | UpdateEntity (EntityID entity, VisualAnimation_data &animData, VisualSprite_data &spriteData) |
| Update a single entity's animation. | |
| bool | ResolveAnimationSequence (VisualAnimation_data &animData) |
| Resolve animation sequence pointer from AnimationManager. | |
| void | AdvanceFrame (VisualAnimation_data &animData, float dt) |
| void | UpdateSpriteRect (VisualSprite_data &spriteData, const VisualAnimation_data &animData) |
Additional Inherited Members | |
Public Attributes inherited from ECS_System | |
| ComponentSignature | requiredSignature |
| std::set< EntityID > | m_entities |
Animation system for sprite-based 2D animations.
Requires: VisualAnimation_data + VisualSprite_data
Responsibilities:
Definition at line 28 of file ECS_Systems_Animation.h.
| AnimationSystem::AnimationSystem | ( | ) |
Definition at line 19 of file ECS_Systems_Animation.cpp.
References GetComponentTypeID_Static(), and ECS_System::requiredSignature.
Here is the call graph for this function:
|
private |
Pause animation playback.
| entity | Entity ID |
Definition at line 298 of file ECS_Systems_Animation.cpp.
References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and VisualAnimation_data::isPaused.
Here is the call graph for this function:| void AnimationSystem::PlayAnimation | ( | EntityID | entity, |
| const std::string & | animName, | ||
| bool | restart = false |
||
| ) |
Play a specific animation on an entity.
| entity | Entity ID |
| animName | Animation name to play |
| restart | If true, restart animation even if already playing |
Definition at line 269 of file ECS_Systems_Animation.cpp.
References VisualAnimation_data::currentAnimName, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and ResolveAnimationSequence().
Referenced by UpdateEntity().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from ECS_System.
Definition at line 33 of file ECS_Systems_Animation.cpp.
References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), ECS_System::m_entities, and UpdateEntity().
Here is the call graph for this function:
|
private |
Resolve animation sequence pointer from AnimationManager.
| animData | Animation component |
Definition at line 242 of file ECS_Systems_Animation.cpp.
References OlympeAnimation::AnimationManager::Get(), OlympeAnimation::AnimationManager::GetAnimationSequence(), GetComponentTypeID_Static(), and SYSTEM_LOG.
Referenced by PlayAnimation(), and UpdateEntity().
Here is the call graph for this function:
Here is the caller graph for this function:Resume paused animation.
| entity | Entity ID |
Definition at line 309 of file ECS_Systems_Animation.cpp.
References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and VisualAnimation_data::isPaused.
Here is the call graph for this function:Set playback speed multiplier.
| entity | Entity ID |
| speed | Speed multiplier (1.0 = normal, 2.0 = double speed, etc.) |
Definition at line 334 of file ECS_Systems_Animation.cpp.
References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and VisualAnimation_data::playbackSpeed.
Here is the call graph for this function:Stop animation playback.
| entity | Entity ID |
Definition at line 320 of file ECS_Systems_Animation.cpp.
References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and VisualAnimation_data::isPlaying.
Here is the call graph for this function:
|
private |
Update a single entity's animation.
| entity | Entity ID |
| animData | Animation component |
| spriteData | Sprite component |
Definition at line 54 of file ECS_Systems_Animation.cpp.
References Olympe::AnimationFrame::duration, GameEngine::fDt, OlympeAnimation::AnimationManager::Get(), DataManager::Get(), OlympeAnimation::AnimationManager::GetBank(), GetComponentTypeID_Static(), DataManager::GetSprite(), Olympe::AnimationFrame::hotSpot, PlayAnimation(), ResolveAnimationSequence(), Olympe::AnimationSequence::speed, Olympe::AnimationFrame::srcRect, and SYSTEM_LOG.
Referenced by Process().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |