Skip to main content

TimerUpdateSystem Class Template

Updates all game timers managed by the TimerManager. More...

Declaration

template <typename TCommandBuffer = NullCommandBuffer> class helios::engine::runtime::timing::systems::TimerUpdateSystem<TCommandBuffer> { ... }

Public Member Typedefs Index

template <typename TCommandBuffer = NullCommandBuffer>
usingEngineRoleTag = helios::engine::runtime::world::tags::SystemRole
template <typename TCommandBuffer = NullCommandBuffer>
usingCommandBuffer_type = TCommandBuffer

Public Constructors Index

template <typename TCommandBuffer = NullCommandBuffer>
TimerUpdateSystem (TimerManager &timerManager)

Constructs the system with a reference to the TimerManager. More...

Public Member Functions Index

template <typename TCommandBuffer = NullCommandBuffer>
voidupdate (helios::engine::runtime::world::UpdateContext &updateContext, TCommandBuffer &cmdBuffer) noexcept

Advances all game timers by the current delta time. More...

Private Member Attributes Index

template <typename TCommandBuffer = NullCommandBuffer>
TimerManager &timerManager_

Reference to the TimerManager owning the timers. More...

Description

Updates all game timers managed by the TimerManager.

Each frame, this system iterates over all registered timers and advances their elapsed time by the current delta time.

See Also

TimerManager

See Also

Timer

Definition at line 45 of file TimerUpdateSystem.ixx.

Public Member Typedefs

CommandBuffer_type

template <typename TCommandBuffer = NullCommandBuffer>
using helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::CommandBuffer_type = TCommandBuffer

Definition at line 56 of file TimerUpdateSystem.ixx.

EngineRoleTag

template <typename TCommandBuffer = NullCommandBuffer>
using helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::EngineRoleTag = helios::engine::runtime::world::tags::SystemRole

Public Constructors

TimerUpdateSystem()

template <typename TCommandBuffer = NullCommandBuffer>
helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::TimerUpdateSystem (TimerManager & timerManager)
inline explicit

Constructs the system with a reference to the TimerManager.

Parameters
timerManager

The manager whose timers are updated.

Definition at line 64 of file TimerUpdateSystem.ixx.

65 : timerManager_(timerManager) {}

Public Member Functions

update()

template <typename TCommandBuffer = NullCommandBuffer>
void helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::update (helios::engine::runtime::world::UpdateContext & updateContext, TCommandBuffer & cmdBuffer)
inline noexcept

Advances all game timers by the current delta time.

Parameters
updateContext

The current frame's update context.

Definition at line 72 of file TimerUpdateSystem.ixx.

73
74 for (auto& timer : timerManager_.timers()) {
75 if (timer.state() == TimerState::Running) {
76
77 timer.update(updateContext.deltaTime());
78
79 if (timer.duration() != 0.0f && timer.elapsed() >= timer.duration()) {
80 auto context = TimerControlContext{timer.timerId(), TimerState::Finished};
82 }
83 }
84 }
85 }

References helios::engine::runtime::registerComponents, helios::engine::runtime::timing::types::TimerControlContext::timerId and helios::engine::runtime::timing::TimerManager::timers.

Private Member Attributes

timerManager_

template <typename TCommandBuffer = NullCommandBuffer>
TimerManager& helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::timerManager_

Reference to the TimerManager owning the timers.

Definition at line 50 of file TimerUpdateSystem.ixx.

50 TimerManager& timerManager_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.