Skip to main content

GameTimer2UiTextUpdateSystem Class

System for binding game timer values to UI text components. More...

Declaration

class helios::engine::modules::ui::binding::systems::GameTimer2UiTextUpdateSystem { ... }

Public Member Typedefs Index

usingEngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors Index

GameTimer2UiTextUpdateSystem (TimerManager &timerManager)

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

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept

Updates text components with current game timer values. More...

Private Member Attributes Index

TimerManager &timerManager_

Reference to the TimerManager that owns the game timers. More...

Description

System for binding game timer values to UI text components.

Queries entities with GameTimerBindingComponent, TimeFormatterComponent, and UiTextComponent. When the observed timer's revision changes, the formatted time string is propagated to the text component for display.

See Also

TimerManager

See Also

GameTimerBindingComponent

See Also

TimeFormatterComponent

Definition at line 43 of file GameTimer2UiTextUpdateSystem.ixx.

Public Member Typedefs

EngineRoleTag

using helios::engine::modules::ui::binding::systems::GameTimer2UiTextUpdateSystem::EngineRoleTag = helios::engine::common::tags::SystemRole

Public Constructors

GameTimer2UiTextUpdateSystem()

helios::engine::modules::ui::binding::systems::GameTimer2UiTextUpdateSystem::GameTimer2UiTextUpdateSystem (TimerManager & timerManager)
inline explicit

Constructs the system with a reference to the TimerManager.

Parameters
timerManager

The TimerManager providing game timer state.

Definition at line 58 of file GameTimer2UiTextUpdateSystem.ixx.

59 : timerManager_(timerManager) {}

Public Member Functions

update()

void helios::engine::modules::ui::binding::systems::GameTimer2UiTextUpdateSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept

Updates text components with current game timer values.

For each matching entity, compares the timer revision against the observer's cached revision. On mismatch, formats the elapsed/remaining time via the TimeFormatterComponent and updates the UiTextComponent.

Parameters
updateContext

The current frame's update context.

Definition at line 72 of file GameTimer2UiTextUpdateSystem.ixx.

73
74 for (auto [entity, gtc, dfc, txt, active] : updateContext.view<
79 >().whereEnabled()) {
80
81 if (const auto* timer = timerManager_.gameTimer(gtc->gameTimerId());
82 timer->timerRevision() != gtc->timerRevision()) {
83 txt->setText(dfc->format(timer->elapsed(), timer->duration()));
84 gtc->setTimerRevision(timer->timerRevision());
85 }
86
87 }
88 }

Private Member Attributes

timerManager_

TimerManager& helios::engine::modules::ui::binding::systems::GameTimer2UiTextUpdateSystem::timerManager_

Reference to the TimerManager that owns the game timers.

Definition at line 48 of file GameTimer2UiTextUpdateSystem.ixx.

48 TimerManager& timerManager_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.