Skip to main content

UiTransformComponent.ixx File

Component for viewport-relative UI positioning. 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...

namespacetransform

UI transform components and positioning systems. More...

namespacecomponents

UI transform state components. More...

Classes Index

classUiTransformComponent

Component for viewport-relative UI positioning. More...

Description

Component for viewport-relative UI positioning.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file UiTransformComponent.ixx
3 * @brief Component for viewport-relative UI positioning.
4 */
5module;
6
7#include <cmath>
8
9export module helios.engine.modules.ui.transform.components.UiTransformComponent;
10
11
12
13import helios.engine.modules.ui.layout.Anchor;
14
15import helios.engine.ecs.types.ComponentTypeId;
16import helios.engine.common.types;
17
18import helios.math;
19
20import helios.core;
21import helios.engine.core;
22
24
25
26 /**
27 * @brief Component for viewport-relative UI positioning.
28 *
29 * Stores positioning parameters for UI elements including anchor point,
30 * pivot point, offsets, and the target viewport. Used by UiTransformSystem
31 * to compute screen positions.
32 */
34
35 /**
36 * @brief Anchor point relative to the viewport.
37 */
39
40 /**
41 * @brief Pivot point of this element for positioning calculations.
42 */
44
45 /**
46 * @brief ID of the viewport this element is positioned relative to.
47 */
49
50 /**
51 * @brief Offsets from anchor point (top, right, bottom, left).
52 */
53 helios::math::vec4f offsets_{};
54
55 /**
56 * @brief Whether this component is enabled.
57 */
58 bool isEnabled_ = true;
59
60 public:
61
62 /**
63 * @brief Checks whether this component is enabled.
64 *
65 * @return True if enabled, false otherwise.
66 */
67 [[nodiscard]] bool isEnabled() const noexcept {
68 return isEnabled_;
69 }
70
71 /**
72 * @brief Enables this component.
73 */
74 void enable() noexcept {
75 isEnabled_ = true;
76 }
77
78 /**
79 * @brief Disables this component.
80 */
81 void disable() noexcept {
82 isEnabled_ = false;
83 }
84
85 /**
86 * @brief Default constructor.
87 */
89
90 /**
91 * @brief Copy constructor.
92 */
94
95 /**
96 * @brief Copy assignment operator.
97 */
99
100 /**
101 * @brief Move constructor.
102 */
104
105 /**
106 * @brief Move assignment operator.
107 */
108 UiTransformComponent& operator=(UiTransformComponent&&) noexcept = default;
109
110
111 /**
112 * @brief Sets the anchor point.
113 *
114 * @param anchor The anchor point relative to the viewport.
115 */
116 void setAnchor(const helios::engine::modules::ui::layout::Anchor anchor) noexcept {
117 anchor_ = anchor;
118 }
119
120 /**
121 * @brief Returns the current anchor point.
122 *
123 * @return The anchor point relative to the viewport.
124 */
125 [[nodiscard]] helios::engine::modules::ui::layout::Anchor anchor() const noexcept {
126 return anchor_;
127 }
128
129 /**
130 * @brief Sets the viewport ID.
131 *
132 * @param viewportId The ID of the viewport for positioning.
133 */
135 viewportId_ = viewportId;
136 }
137
138 /**
139 * @brief Sets the offsets from the anchor point.
140 *
141 * @param offsets Offsets as vec4f (top, right, bottom, left).
142 */
143 void setOffsets(const helios::math::vec4f offsets) noexcept {
144 offsets_ = offsets;
145 }
146
147 /**
148 * @brief Returns the current offsets.
149 *
150 * @return Offsets as vec4f (top, right, bottom, left).
151 */
152 [[nodiscard]] helios::math::vec4f offsets() const noexcept {
153 return offsets_;
154 }
155
156 /**
157 * @brief Sets the pivot point.
158 *
159 * @param pivot The pivot point of this element.
160 */
162 pivot_ = pivot;
163 }
164
165 /**
166 * @brief Returns the current pivot point.
167 *
168 * @return The pivot point of this element.
169 */
170 [[nodiscard]] helios::engine::modules::ui::layout::Anchor pivot() const noexcept {
171 return pivot_;
172 }
173
174 /**
175 * @brief Returns the viewport ID.
176 *
177 * @return The ID of the viewport this element is positioned relative to.
178 */
180 return viewportId_;
181 }
182
183
184
185 };
186
187}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.