Skip to main content

Score2UiTextUpdateSystem.ixx File

System for binding score values to UI text components. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespaceui

User interface components and systems for game entities. More...

namespacebinding

Data binding systems for UI components. More...

namespacesystems

UI data binding systems. More...

Classes Index

classScore2UiTextUpdateSystem

System for binding score values to UI text components. More...

Description

System for binding score values to UI text components.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Score2UiTextUpdateSystem.ixx
3 * @brief System for binding score values to UI text components.
4 */
5module;
6
7
8#include <format>
9
10
11
12export module helios.engine.modules.ui.binding.systems.Score2UiTextUpdateSystem;
13
14import helios.engine.mechanics.scoring.components;
15
16import helios.engine.runtime.world.GameWorld;
17import helios.engine.runtime.world.UpdateContext;
18
19
20import helios.engine.modules.ui.widgets.components.UiTextComponent;
21
22import helios.engine.modules.ui.layout.components.NumberFormatterComponent;
23
24import helios.engine.mechanics.lifecycle.components.Active;
25
26
27import helios.engine.common.tags.SystemRole;
28
30
31 /**
32 * @brief System for binding score values to UI text components.
33 *
34 * Queries entities with ScoreObserverComponent, NumberFormatterComponent,
35 * and UiTextComponent. When the score observer signals an update, the
36 * formatted total score is propagated to the text component for display.
37 *
38 * @see ScoreObserverComponent
39 * @see NumberFormatterComponent
40 */
42
43 public:
44
46
47 /**
48 * @brief Updates text components with current score values.
49 *
50 * @param updateContext The current frame's update context.
51 */
53
54 for (auto [entity, soc, nfc, txt, active] : updateContext.view<
59 >().whereEnabled()) {
60
61 if (!soc->hasUpdate()) {
62 continue;
63 }
64
65 txt->setText(nfc->format<double>(soc->totalScore()));
66 }
67 }
68
69 };
70
71}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.