|
Unravel Engine C++ Reference
|
System responsible for managing user interface components and rendering. More...
#include <ui_system.h>
Classes | |
| struct | ui_pointer_dispatch_result |
Public Member Functions | |
| auto | init (rtti::context &ctx) -> bool |
| Initializes the UI system with the given context. | |
| auto | deinit (rtti::context &ctx) -> bool |
| Deinitializes the UI system with the given context. | |
| void | update_world_space (rtti::context &ctx, entt::handle camera_entity, scene &scn, bool &process_input) |
| Update world-space UI documents (common + world-space specific). Call before render_world_space. | |
| void | render_world_space (rtti::context &ctx, entt::handle camera_entity, scene &scn, delta_t dt) |
| Render world-space UI documents (sort + frame-state render). Call after update_world_space. | |
| void | update_screen_space (rtti::context &ctx, entt::handle camera_entity, scene &scn, bool &process_input) |
| Update screen-space UI documents (common + screen-space specific). Call before render_screen_space. | |
| void | render_screen_space (rtti::context &ctx, const gfx::frame_buffer::ptr &output, entt::handle camera_entity, scene &scn, delta_t dt) |
| Render screen-space overlay UI documents to output. Call after update_screen_space. | |
| void | on_os_event (rtti::context &ctx, os::event &event) |
| Handle OS events and forward to RmlUi. | |
| void | load_fonts () |
| Load fonts. | |
| void | release_resources () |
| void | register_component_callbacks (rtti::context &ctx) |
| Register component creation/destruction callbacks with ECS. | |
| auto | is_debugger_enabled () const -> bool |
| void | set_debugger_enabled (bool enabled) |
| void | update_ui_documents (rtti::context &ctx, scene &scn) |
| Update UI documents (load, reload, visibility). No camera dependency. | |
| void | update_world_space_document (rtti::context &ctx, scene &scn, entt::handle handle, ui_document_component &comp, const camera &cam, float dp_ratio, bool process_input, bool &hit_found) |
| Update a single world-space document (dimensions, density, input). Call from render path, back-to-front. | |
| void | update_screen_space_document (rtti::context &ctx, Rml::Context *context, int viewport_width, int viewport_height, float dp_ratio, scene &scn, bool process_input, bool &hit_found) |
| Update a single screen-space document (dimensions, density, input). Call from render path. | |
| void | update_ui_document_common (entt::handle handle, ui_document_component &ui_comp, bool is_playing) |
| auto | load_ui_document (entt::handle entity, ui_document_component &component, bool log_error=true) -> bool |
| Load a UI document for a specific component. | |
| auto | is_not_root_element (scene &scn, Rml::Element *element) -> bool |
| auto | find_keyboard_context (scene &scn) const -> Rml::Context * |
| auto | try_consume_keyboard_event (scene &scn, os::event &event) -> bool |
| auto | dispatch_pointer_event (rtti::context &ctx, scene &scn, os::event &event) -> ui_pointer_dispatch_result |
| void | apply_mouse_press_focus (scene &scn, os::event &event, Rml::Context *target_context, bool input_allowed) |
| void | blur_ui_context (Rml::Context *context) const |
| void | refresh_mouse_state (rtti::context &ctx, scene &scn) |
| auto | process_mouse_move (scene &scn, Rml::Context *context, int x, int y) -> bool |
| auto | process_event (scene &scn, Rml::Context *context, os::event &event) -> bool |
| void | load_font (const std::string &path) |
| void | ensure_document_framebuffer (ui_document_component &comp) |
| Ensure framebuffer exists for document; create or resize if needed. | |
Static Public Member Functions | |
| static void | on_create_component (entt::registry &r, entt::entity e) |
| static void | on_load_component (entt::registry &r, entt::entity e) |
| static void | on_destroy_component (entt::registry &r, entt::entity e) |
System responsible for managing user interface components and rendering.
This system integrates RmlUi for HTML/CSS-based user interfaces with the engine's rendering and input systems. It provides a high-level API for loading and managing UI documents.
Definition at line 38 of file ui_system.h.
| void unravel::ui_system::apply_mouse_press_focus | ( | scene & | scn, |
| os::event & | event, | ||
| Rml::Context * | target_context, | ||
| bool | input_allowed ) |
Definition at line 182 of file ui_system_input.cpp.
| void unravel::ui_system::blur_ui_context | ( | Rml::Context * | context | ) | const |
Definition at line 296 of file ui_system_input.cpp.
| auto unravel::ui_system::deinit | ( | rtti::context & | ctx | ) | -> bool |
Deinitializes the UI system with the given context.
| ctx | The context to deinitialize. |
Definition at line 123 of file ui_system.cpp.
| auto unravel::ui_system::dispatch_pointer_event | ( | rtti::context & | ctx, |
| scene & | scn, | ||
| os::event & | event ) -> ui_pointer_dispatch_result |
Definition at line 149 of file ui_system_input.cpp.
| void unravel::ui_system::ensure_document_framebuffer | ( | ui_document_component & | comp | ) |
Ensure framebuffer exists for document; create or resize if needed.
Definition at line 694 of file ui_system.cpp.
| auto unravel::ui_system::find_keyboard_context | ( | scene & | scn | ) | const -> Rml::Context* |
Definition at line 116 of file ui_system_input.cpp.
| auto unravel::ui_system::init | ( | rtti::context & | ctx | ) | -> bool |
Initializes the UI system with the given context.
| ctx | The context to initialize with. |
Definition at line 68 of file ui_system.cpp.
| auto unravel::ui_system::is_debugger_enabled | ( | ) | const -> bool |
Definition at line 573 of file ui_system.cpp.
| auto unravel::ui_system::is_not_root_element | ( | scene & | scn, |
| Rml::Element * | element ) -> bool |
Definition at line 226 of file ui_system_input.cpp.
| void unravel::ui_system::load_font | ( | const std::string & | path | ) |
Definition at line 502 of file ui_system.cpp.
| void unravel::ui_system::load_fonts | ( | ) |
Load fonts.
Definition at line 509 of file ui_system.cpp.
| auto unravel::ui_system::load_ui_document | ( | entt::handle | entity, |
| ui_document_component & | component, | ||
| bool | log_error = true ) -> bool |
Load a UI document for a specific component.
| entity | Entity owning the component |
| component | The ui_document_component to load the document for |
Definition at line 632 of file ui_system.cpp.
|
static |
Definition at line 521 of file ui_system.cpp.
|
static |
Definition at line 539 of file ui_system.cpp.
|
static |
Definition at line 527 of file ui_system.cpp.
| void unravel::ui_system::on_os_event | ( | rtti::context & | ctx, |
| os::event & | event ) |
Handle OS events and forward to RmlUi.
| ctx | Engine context |
| event | OS event to process |
Definition at line 96 of file ui_system_input.cpp.
| auto unravel::ui_system::process_event | ( | scene & | scn, |
| Rml::Context * | context, | ||
| os::event & | event ) -> bool |
Definition at line 268 of file ui_system_input.cpp.
| auto unravel::ui_system::process_mouse_move | ( | scene & | scn, |
| Rml::Context * | context, | ||
| int | x, | ||
| int | y ) -> bool |
Definition at line 249 of file ui_system_input.cpp.
| void unravel::ui_system::refresh_mouse_state | ( | rtti::context & | ctx, |
| scene & | scn ) |
Definition at line 312 of file ui_system_input.cpp.
| void unravel::ui_system::register_component_callbacks | ( | rtti::context & | ctx | ) |
Register component creation/destruction callbacks with ECS.
| ctx | Engine context |
Definition at line 557 of file ui_system.cpp.
| void unravel::ui_system::release_resources | ( | ) |
Definition at line 565 of file ui_system.cpp.
| void unravel::ui_system::render_screen_space | ( | rtti::context & | ctx, |
| const gfx::frame_buffer::ptr & | output, | ||
| entt::handle | camera_entity, | ||
| scene & | scn, | ||
| delta_t | dt ) |
Render screen-space overlay UI documents to output. Call after update_screen_space.
Definition at line 443 of file ui_system.cpp.
| void unravel::ui_system::render_world_space | ( | rtti::context & | ctx, |
| entt::handle | camera_entity, | ||
| scene & | scn, | ||
| delta_t | dt ) |
Render world-space UI documents (sort + frame-state render). Call after update_world_space.
Definition at line 330 of file ui_system.cpp.
| void unravel::ui_system::set_debugger_enabled | ( | bool | enabled | ) |
Definition at line 577 of file ui_system.cpp.
| auto unravel::ui_system::try_consume_keyboard_event | ( | scene & | scn, |
| os::event & | event ) -> bool |
Definition at line 135 of file ui_system_input.cpp.
| void unravel::ui_system::update_screen_space | ( | rtti::context & | ctx, |
| entt::handle | camera_entity, | ||
| scene & | scn, | ||
| bool & | process_input ) |
Update screen-space UI documents (common + screen-space specific). Call before render_screen_space.
Definition at line 382 of file ui_system.cpp.
| void unravel::ui_system::update_screen_space_document | ( | rtti::context & | ctx, |
| Rml::Context * | context, | ||
| int | viewport_width, | ||
| int | viewport_height, | ||
| float | dp_ratio, | ||
| scene & | scn, | ||
| bool | process_input, | ||
| bool & | hit_found ) |
Update a single screen-space document (dimensions, density, input). Call from render path.
| ctx | Engine context for input |
| comp | UI document component |
| viewport_width | Viewport width |
| viewport_height | Viewport height |
| dp_ratio | Density-independent pixel ratio |
| scn | Scene for process_mouse_move |
| hit_found | In/out: true if a previous doc already consumed the mouse |
Definition at line 240 of file ui_system.cpp.
| void unravel::ui_system::update_ui_document_common | ( | entt::handle | handle, |
| ui_document_component & | ui_comp, | ||
| bool | is_playing ) |
Definition at line 159 of file ui_system.cpp.
| void unravel::ui_system::update_ui_documents | ( | rtti::context & | ctx, |
| scene & | scn ) |
Update UI documents (load, reload, visibility). No camera dependency.
| ctx | Engine context |
| scn | Scene containing UI documents |
Definition at line 582 of file ui_system.cpp.
| void unravel::ui_system::update_world_space | ( | rtti::context & | ctx, |
| entt::handle | camera_entity, | ||
| scene & | scn, | ||
| bool & | process_input ) |
Update world-space UI documents (common + world-space specific). Call before render_world_space.
State between update_world_space and render_world_space
Definition at line 263 of file ui_system.cpp.
| void unravel::ui_system::update_world_space_document | ( | rtti::context & | ctx, |
| scene & | scn, | ||
| entt::handle | handle, | ||
| ui_document_component & | comp, | ||
| const camera & | cam, | ||
| float | dp_ratio, | ||
| bool | process_input, | ||
| bool & | hit_found ) |
Update a single world-space document (dimensions, density, input). Call from render path, back-to-front.
| ctx | Engine context for input |
| scn | Scene for process_mouse_move |
| handle | Entity handle with ui_document_component and transform_component |
| comp | UI document component |
| cam | Camera for projection |
| dp_ratio | Density-independent pixel ratio |
| hit_found | In/out: true if a closer doc already consumed the mouse |
Definition at line 202 of file ui_system.cpp.