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

System managing sprite animation playback. More...

#include <AnimationSystem.hpp>

Inheritance diagram for ecs::AnimationSystem:
Inheritance graph
Collaboration diagram for ecs::AnimationSystem:
Collaboration graph

Public Member Functions

 AnimationSystem ()=default
 Default constructor.
 
 ~AnimationSystem () override=default
 Default destructor.
 
void update (Registry &registry, float deltaTime) override
 Updates all entity animations.
 
ComponentMask getComponentMask () const override
 Gets the component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Detailed Description

System managing sprite animation playback.

Updates animation timers, advances frames, handles looping and transitions. Updates Sprite components with current animation frame rectangles. Requires Animation, AnimationSet, and Sprite components.

Definition at line 25 of file AnimationSystem.hpp.

Constructor & Destructor Documentation

◆ AnimationSystem()

ecs::AnimationSystem::AnimationSystem ( )
default

Default constructor.

◆ ~AnimationSystem()

ecs::AnimationSystem::~AnimationSystem ( )
overridedefault

Default destructor.

Member Function Documentation

◆ getComponentMask()

ComponentMask ecs::AnimationSystem::getComponentMask ( ) const
overridevirtual

Gets the component mask for this system.

Returns
ComponentMask requiring Animation, AnimationSet, and Sprite components

Implements ecs::ISystem.

Definition at line 99 of file AnimationSystem.cpp.

Referenced by update().

◆ update()

void ecs::AnimationSystem::update ( Registry registry,
float  deltaTime 
)
overridevirtual

Updates all entity animations.

Updates animation playback for all animated entities.

Performs the following operations per entity:

  • Advances animation timer based on deltaTime
  • Changes animation frame when timer exceeds frame duration
  • Handles animation looping and stopping
  • Transitions to next animation clip if specified
  • Updates Sprite sourceRect to display current frame
Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame (in seconds)

Implements ecs::ISystem.

Definition at line 14 of file AnimationSystem.cpp.

References ecs::AnimationClip::frameDuration, ecs::AnimationClip::frames, ecs::AnimationSet::getClip(), ecs::Registry::getComponent(), getComponentMask(), ecs::Animation::getCurrentClipName(), ecs::Animation::getCurrentFrameIndex(), ecs::Registry::getEntitiesWithMask(), ecs::Animation::getTimer(), ecs::AnimationSet::hasClip(), ecs::Registry::hasComponent(), ecs::Animation::isPlaying(), ecs::AnimationClip::loop, ecs::AnimationClip::nextClip, ecs::Animation::setCurrentClipName(), ecs::Animation::setCurrentFrameIndex(), ecs::Animation::setPlaying(), ecs::Sprite::setSourceRect(), and ecs::Animation::setTimer().

Here is the call graph for this function:

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