guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::systems::Animation Class Reference

Moves every running animation forward by the time of one frame. More...

#include <headers/guillaume/systems/animation.hpp>

Inheritance diagram for guillaume::systems::Animation:
Collaboration diagram for guillaume::systems::Animation:

Public Member Functions

 Animation (utility::Engine &engine)
 Create the system, in the Event phase.
 ~Animation (void) override=default
 Default destructor.
void prepare (void) override
 Read the time of the current frame, once per frame.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Advance the animation of one entity by the frame time, clamped to theme::MotionScale::MaxFrameStep.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::Animation >
 SystemFiller (Phase phase)
 Create the system and set its signature from ComponentTypes.
virtual ~SystemFiller (void)=default
 Virtual destructor.
Public Member Functions inherited from guillaume::ecs::System
 System (Phase phase)
 Create a system that runs in a given phase, with an empty signature.
virtual ~System (void)=default
 Virtual destructor.
Phase getPhase (void) const noexcept
 Get the phase of the frame in which the system runs.
Entity::Signature getSignature (void) const noexcept
 Get the component types an entity must declare to be visited by this system.
void routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler)
 Run the system once over a scene: prepare(), update() on each matching entity, cleanup().
void bindComponentRegistry (ecs::ComponentRegistry &componentRegistry)
 Bind a component registry so update() can be called directly, without routine().
void unbindComponentRegistry (void)
 Drop the binding made by bindComponentRegistry().
virtual void cleanup (void)
 Called once per pass, after the last update().

Additional Inherited Members

Protected Member Functions inherited from guillaume::ecs::System
template<InheritFromComponent... ComponentTypes>
void setSignature (void)
 Replace the signature by the one made of the given component types.
ecs::EntityRegistry & getEntityRegistry (void)
 Get the entity registry of the scene being processed.
const ecs::EntityRegistry & getEntityRegistry (void) const
 Get the entity registry of the scene being processed, read-only.
ecs::ComponentRegistry & getComponentRegistry (void)
 Get the component registry of the scene being processed.
const ecs::ComponentRegistry & getComponentRegistry (void) const
 Get the component registry of the scene being processed, read-only.
template<InheritFromComponent ComponentType>
bool hasComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Tell whether an entity has a component, in the bound registry.
template<InheritFromComponent ComponentType>
ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier)
 Get a component of an entity from the bound registry, to read or modify it.
template<InheritFromComponent ComponentType>
const ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Get a component of an entity from the bound registry, read-only.
template<InheritFromComponent ComponentType>
bool requireComponent (const ecs::Entity::Identifier &entityIdentifier)
 Tell whether an entity has a component, and log a warning naming the entity and the component when it does not.

Detailed Description

Moves every running animation forward by the time of one frame.

Runs in the Event phase on each entity with a components::Animation. It reads the frame time and calls components::Animation::advance, which updates the animation progress and calls its sample and completion handlers. The system writes nothing else: what an animation changes (a color, a position) is decided by the handlers set on the component.

The frame time comes from utility::Engine::getDeltaTime when the engine reports a positive value, and from a steady clock otherwise. It is clamped to theme::MotionScale::MaxFrameStep, so a stalled frame slows an animation down instead of skipping it.

See also
components::Animation

Definition at line 53 of file animation.hpp.

Constructor & Destructor Documentation

◆ Animation()

guillaume::systems::Animation::Animation ( utility::Engine & engine)

Create the system, in the Event phase.

Parameters
engineThe engine providing the frame time. It must outlive the system.

Definition at line 30 of file animation.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ prepare()

void guillaume::systems::Animation::prepare ( void )
overridevirtual

Read the time of the current frame, once per frame.

Uses the engine's delta time when it is positive, otherwise the time elapsed on the steady clock since the previous fallback read.

Reimplemented from guillaume::ecs::System.

Definition at line 38 of file animation.cpp.

◆ update()

void guillaume::systems::Animation::update ( const ecs::Entity::Identifier & entityIdentifier)
overridevirtual

Advance the animation of one entity by the frame time, clamped to theme::MotionScale::MaxFrameStep.

Parameters
entityIdentifierThe entity holding the components::Animation.

Implements guillaume::ecs::System.

Definition at line 53 of file animation.cpp.

Here is the call graph for this function:

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