ImGuiOverlay Class
Central manager for ImGui widgets rendered via a specific backend. More...
Declaration
Private Constructors Index
| ImGuiOverlay (ImGuiBackend *backend) | |
|
Constructs an ImGuiOverlay instance with a specified backend. More... | |
Public Member Functions Index
| void | addWidget (ImGuiWidget *widget) |
|
Adds a widget to the overlay. More... | |
| void | setDockSpaceEnabled (bool enabled) noexcept |
|
Enables or disables the full-viewport DockSpace. More... | |
| void | render () |
|
Renders all registered widgets using the backend. More... | |
Private Member Attributes Index
| std::vector< helios::imgui::ImGuiWidget * > | widgets_ |
|
Container for dynamically registered ImGui widgets. More... | |
| ImGuiBackend * | backend_ |
|
Pointer to the backend used for rendering ImGui widgets. More... | |
| bool | enableDockSpace_ = true |
|
Whether to enable a full-viewport DockSpace for docking widgets. More... | |
Public Static Functions Index
| static ImGuiOverlay & | forBackend (ImGuiBackend *backend) |
|
Retrieves the singleton overlay instance for a given backend. More... | |
Description
Central manager for ImGui widgets rendered via a specific backend.
The overlay is a singleton per backend. Widgets can be registered dynamically, and all widgets are rendered in the order they were added.
This class is implemented as a singleton using forBackend(). Direct construction is not allowed.
Definition at line 29 of file ImGuiOverlay.ixx.
Private Constructors
ImGuiOverlay()
| inline explicit |
Constructs an ImGuiOverlay instance with a specified backend.
This constructor initializes the overlay with the provided ImGui backend. It is private to enforce the singleton pattern of the overlay.
- Parameters
-
backend Pointer to the ImGuiBackend implementation. Must remain valid for the lifetime of the overlay.
Definition at line 71 of file ImGuiOverlay.ixx.
Public Member Functions
addWidget()
| inline |
Adds a widget to the overlay.
Widgets are rendered in the order they were added. The overlay does not take ownership; the caller must ensure the widget remains valid.
- Parameters
-
widget Pointer to the widget. Must remain valid for the lifetime of the overlay.
Definition at line 99 of file ImGuiOverlay.ixx.
render()
| inline |
Renders all registered widgets using the backend.
Calls newFrame() on the backend, optionally creates a DockSpace, invokes draw() on each widget, then finalizes rendering via ImGui::Render() and renderDrawData().
Definition at line 122 of file ImGuiOverlay.ixx.
References helios::imgui::ImGuiBackend::newFrame and helios::imgui::ImGuiBackend::renderDrawData.
Referenced by helios::imgui::systems::ImGuiOverlayRenderSystem::update.
setDockSpaceEnabled()
| inline noexcept |
Enables or disables the full-viewport DockSpace.
When enabled, widgets can be docked to the edges of the main viewport.
- Parameters
-
enabled True to enable docking, false to disable.
Definition at line 111 of file ImGuiOverlay.ixx.
Private Member Attributes
backend_
|
Pointer to the backend used for rendering ImGui widgets.
Represents the platform-specific implementation of ImGui functionality (e.g., OpenGL, Vulkan, etc.). The backend facilitates frame management, new frame initialization, and rendering draw data.
This pointer is initialized via the ImGuiOverlay constructor and must remain a valid instance for the lifetime of the ImGuiOverlay.
Definition at line 55 of file ImGuiOverlay.ixx.
enableDockSpace_
|
Whether to enable a full-viewport DockSpace for docking widgets.
Definition at line 60 of file ImGuiOverlay.ixx.
widgets_
|
Container for dynamically registered ImGui widgets.
Stores pointers to widgets that are managed and rendered by the ImGuiOverlay. Widgets are added in the order they are registered and must remain valid for the lifetime of the overlay. The container does not take ownership of the widgets.
This is a private member of ImGuiOverlay and is utilized for managing the rendering lifecycle of widgets.
Definition at line 43 of file ImGuiOverlay.ixx.
Public Static Functions
forBackend()
| inline static |
Retrieves the singleton overlay instance for a given backend.
- Parameters
-
backend Pointer to the ImGui backend (e.g., GLFW+OpenGL). Must remain valid.
- Returns
Reference to the singleton overlay instance.
Definition at line 84 of file ImGuiOverlay.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.