Skip to main content

UiStyleUpdateSystem.ixx File

System for updating UI text element bounds. 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...

namespacewidgets

UI widget components and systems. More...

namespacesystems

UI widget processing systems. More...

Classes Index

classUiStyleUpdateSystem

System for updating UI text element bounds. More...

Description

System for updating UI text element bounds.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file UiStyleUpdateSystem.ixx
3 * @brief System for updating UI text element bounds.
4 */
5module;
6
7
8
9export module helios.engine.modules.ui.widgets.systems.UiStyleUpdateSystem;
10
11
12import helios.engine.modules.ui.widgets.components.UiTextComponent;
13import helios.engine.modules.ui.widgets.components.UiStyleComponent;
14import helios.engine.modules.ui.widgets.components.UiStateComponent;
15
16import helios.engine.runtime.world.GameWorld;
17import helios.engine.runtime.world.UpdateContext;
18
19import helios.rendering.text.TextShaderPropertiesOverride;
20
21import helios.engine.mechanics.lifecycle.components.Active;
22
23
24import helios.engine.common.tags.SystemRole;
25
27
28
29 /**
30 * @brief System for updating UI text element bounds.
31 *
32 * Monitors UiTextComponent for resize requests and updates the associated
33 * ModelAabbComponent with the new text bounds from the underlying TextRenderable.
34 */
36
37 public:
38
39
41
42 /**
43 * @brief Updates AABB bounds for text components that need resizing.
44 *
45 * @param updateContext The current frame's update context.
46 */
48
49 for (auto [entity, txt, usy, usc, active] : updateContext.view<
54 >().whereEnabled()) {
55
56
57 auto* renderable = txt->renderable();
58 auto& mesh = renderable->textMesh();
59
60 auto properties = renderable->textShaderPropertiesOverride();
61
62 if (!properties) {
64 properties->baseColor = usy->normalColor();
65 } else {
66 properties = properties->withBaseColor(usy->normalColor());
67 }
68
69 mesh.setFontScale(usy->normalScale());
70
71 if (usc->isSelected()) {
72 properties = properties->withBaseColor(usy->selectedColor());
73 mesh.setFontScale(usy->selectedScale());
74 }
75
76 renderable->setTextShaderPropertiesOverride(properties.value());
77
78 }
79 }
80
81 };
82
83}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.