Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::ui_document_component Struct Reference

Component that holds a reference to a UI document for RmlUi rendering. More...

#include <ui_document_component.h>

Inheritance diagram for unravel::ui_document_component:
unravel::component_crtp< ui_document_component, owned_component > unravel::owned_component unravel::basic_component

Public Member Functions

auto get_world_space_scale () const -> math::vec2
 
auto get_bounds () const -> math::bbox
 Gets the bounding box of the document.
 
auto is_loaded () const -> bool
 Check if document is currently loaded.
 
auto is_enabled () const -> bool
 Check if document is currently enabled.
 
void set_enabled (bool enabled)
 Set the enabled state of the document.
 
- Public Member Functions inherited from unravel::owned_component
auto operator= (const owned_component &other) -> owned_component &=default
 
void set_owner (entt::handle owner)
 Sets the owner of the component.
 
auto get_owner () const noexcept -> entt::const_handle
 Gets the owner of the component.
 
auto get_owner () noexcept -> entt::handle
 Gets the owner of the component.
 
- Public Member Functions inherited from unravel::basic_component
void touch ()
 Marks the component as 'touched'.
 

Public Attributes

asset_handle< ui_treeasset
 Path to the UI document file (HTML/RML)
 
Rml::Context * context = nullptr
 Per-document RmlUi context (owned by this component)
 
Rml::ElementDocument * document = nullptr
 Loaded RmlUi document (owned by context)
 
uint64_t version = 0
 
ui_render_mode render_mode = ui_render_mode::screen_space_overlay
 Rendering mode: screen or world.
 
usize32_t size = {512, 512}
 Document resolution (pixels). For screen-space: viewport size. For world-space: configurable (e.g. 512×512)
 
float pixels_per_world_unit = UI_DEFAULT_PIXELS_PER_WORLD_UNIT
 Pixels per world unit for world-space rendering (default: 100, Unity-style)
 
gfx::frame_buffer::ptr framebuffer
 Framebuffer for world-space render-to-texture (owned by component)
 
uint32_t last_render_frame = 0
 Last frame this world-space document was rendered (for render-once-per-frame)
 
std::shared_ptr< RmlUi_RenderLayerStackrender_layer_stack
 Render layer stack for this document (owned by component, used during render pass)
 
- Public Attributes inherited from unravel::basic_component
bool eto {}
 Disable empty type optimizations.
 

Additional Inherited Members

- Public Types inherited from unravel::component_crtp< ui_document_component, owned_component >
using base
 
- Static Public Member Functions inherited from unravel::owned_component
template<typename T >
static void on_create_component (entt::registry &r, entt::entity e)
 
template<typename T >
static void on_destroy_component (entt::registry &r, entt::entity e)
 
- Static Public Attributes inherited from unravel::component_crtp< ui_document_component, owned_component >
static constexpr bool in_place_delete
 Indicates if the component can be deleted in place.
 

Detailed Description

Component that holds a reference to a UI document for RmlUi rendering.

Supports both screen-space and world-space rendering via context-per-document and render-to-texture. Each document has its own RmlUi context and framebuffer.

Definition at line 41 of file ui_document_component.h.

Member Function Documentation

◆ get_bounds()

auto unravel::ui_document_component::get_bounds ( ) const -> math::bbox

Gets the bounding box of the document.

Returns
The bounding box in local space

Definition at line 17 of file ui_document_component.cpp.

◆ get_world_space_scale()

auto unravel::ui_document_component::get_world_space_scale ( ) const -> math::vec2

Definition at line 11 of file ui_document_component.cpp.

◆ is_enabled()

auto unravel::ui_document_component::is_enabled ( ) const -> bool
nodiscard

Check if document is currently enabled.

Returns
True if document is enabled

Definition at line 34 of file ui_document_component.cpp.

◆ is_loaded()

auto unravel::ui_document_component::is_loaded ( ) const -> bool
nodiscard

Check if document is currently loaded.

Returns
True if document is loaded and valid

Definition at line 29 of file ui_document_component.cpp.

◆ set_enabled()

void unravel::ui_document_component::set_enabled ( bool enabled)

Set the enabled state of the document.

Parameters
enabledTrue if document should be enabled

Definition at line 39 of file ui_document_component.cpp.

Member Data Documentation

◆ asset

asset_handle<ui_tree> unravel::ui_document_component::asset

Path to the UI document file (HTML/RML)

Definition at line 44 of file ui_document_component.h.

◆ context

Rml::Context* unravel::ui_document_component::context = nullptr

Per-document RmlUi context (owned by this component)

Definition at line 47 of file ui_document_component.h.

◆ document

Rml::ElementDocument* unravel::ui_document_component::document = nullptr

Loaded RmlUi document (owned by context)

Definition at line 50 of file ui_document_component.h.

◆ framebuffer

gfx::frame_buffer::ptr unravel::ui_document_component::framebuffer

Framebuffer for world-space render-to-texture (owned by component)

Definition at line 63 of file ui_document_component.h.

◆ last_render_frame

uint32_t unravel::ui_document_component::last_render_frame = 0

Last frame this world-space document was rendered (for render-once-per-frame)

Definition at line 66 of file ui_document_component.h.

◆ pixels_per_world_unit

float unravel::ui_document_component::pixels_per_world_unit = UI_DEFAULT_PIXELS_PER_WORLD_UNIT

Pixels per world unit for world-space rendering (default: 100, Unity-style)

Definition at line 60 of file ui_document_component.h.

◆ render_layer_stack

std::shared_ptr<RmlUi_RenderLayerStack> unravel::ui_document_component::render_layer_stack

Render layer stack for this document (owned by component, used during render pass)

Definition at line 69 of file ui_document_component.h.

◆ render_mode

ui_render_mode unravel::ui_document_component::render_mode = ui_render_mode::screen_space_overlay

Rendering mode: screen or world.

Definition at line 55 of file ui_document_component.h.

◆ size

usize32_t unravel::ui_document_component::size = {512, 512}

Document resolution (pixels). For screen-space: viewport size. For world-space: configurable (e.g. 512×512)

Definition at line 58 of file ui_document_component.h.

◆ version

uint64_t unravel::ui_document_component::version = 0

Definition at line 52 of file ui_document_component.h.


The documentation for this struct was generated from the following files: