Unravel Engine C++ Reference
Loading...
Searching...
No Matches
ui_document_component.cpp
Go to the documentation of this file.
2
3#include <RmlUi/Core/ElementDocument.h>
4
5namespace unravel
6{
7
8// The ui_document_component is now primarily a data container.
9// All loading/unloading logic is handled by the ui_system in its update loop.
10
12{
13 return {static_cast<float>(size.width) / pixels_per_world_unit, static_cast<float>(size.height) / pixels_per_world_unit};
14}
15
16
18{
20 math::bbox bbox;
21 bbox.min.x = -scale.x * 0.5f;
22 bbox.min.y = scale.y * 0.5f;
23 bbox.min.z = 0;
24 bbox.max.x = scale.x * 0.5f;
25 bbox.max.y = -scale.y * 0.5f;
26 bbox.max.z = 0.001f;
27 return bbox;
28}
30{
31 return document != nullptr;
32}
33
35{
36 return enabled_;
37}
38
40{
41 enabled_ = enabled;
42}
43
44} // namespace unravel
Definition bbox.cpp:5
std::vector< float > scale
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
vec3 min
The minimum vector value of the bounding box.
Definition bbox.h:306
T width
Definition basetypes.hpp:55
T height
Definition basetypes.hpp:56
void set_enabled(bool enabled)
Set the enabled state of the document.
auto get_world_space_scale() const -> math::vec2
Rml::ElementDocument * document
Loaded RmlUi document (owned by context)
auto is_enabled() const -> bool
Check if document is currently enabled.
float pixels_per_world_unit
Pixels per world unit for world-space rendering (default: 100, Unity-style)
auto get_bounds() const -> math::bbox
Gets the bounding box of the document.
auto is_loaded() const -> bool
Check if document is currently loaded.
bool enabled