Skip to main content

MaxScore2UiTextUpdateSystem.ixx File

System for binding high 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

classMaxScore2UiTextUpdateSystem

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

Description

System for binding high score values to UI text components.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file MaxScore2UiTextUpdateSystem.ixx
3 * @brief System for binding high score values to UI text components.
4 */
5module;
6
7
8#include <format>
9
10
11
12export module helios.engine.modules.ui.binding.systems.MaxScore2UiTextUpdateSystem;
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.layout.components.NumberFormatterComponent;
21
22import helios.engine.modules.ui.widgets.components.UiTextComponent;
23
24import helios.engine.mechanics.lifecycle.components.Active;
25
27
28import helios.engine.common.tags.SystemRole;
29
31
32 /**
33 * @brief System for binding high score values to UI text components.
34 *
35 * Queries entities with MaxScoreObserverComponent, NumberFormatterComponent,
36 * and UiTextComponent. When the max score observer signals an update, the
37 * formatted high score is propagated to the text component for display.
38 *
39 * @see MaxScoreObserverComponent
40 * @see NumberFormatterComponent
41 */
43
44 public:
45
46
48 /**
49 * @brief Updates text components with current high score values.
50 *
51 * Skips entities whose MaxScoreObserverComponent has no pending update.
52 * Otherwise formats the max score via NumberFormatterComponent and
53 * writes the result to UiTextComponent.
54 *
55 * @param updateContext The current frame's update context.
56 */
58
59 for (auto [entity, soc, nfc, txt, active] : updateContext.view<
64 >().whereEnabled()) {
65
66
67 if (!soc->hasUpdate()) {
68 continue;
69 }
70
71 txt->setText(nfc->format<double>(soc->maxScore()));
72 }
73 }
74
75 };
76
77}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.