![]() |
Raven Engine v0.1
|
Manages UI lifecycle, panels, and rendering for both editor and runtime. More...
#include <UIManager.h>
Public Member Functions | |
| void | Init () |
| Initializes UI resources and prepares the ImGui renderer. | |
| void | Shutdown () |
| Cleans up resources and shuts down the UI system. | |
| void | Begin () |
| Begins a new UI frame, setting up ImGui and framebuffers. | |
| void | End () |
| Ends the current UI frame, finalizing ImGui rendering. | |
| void | DrawUI () |
| Draws all registered UI panels and menu bars. | |
| void | AddPanel (const std::string &panelName, PanelScope scope, const std::function< void(UIPanelContext &)> &callback, bool startVisible=true) |
| Registers a UI panel. | |
| void | AddMenuBar (float height, const std::function< void(UIPanelContext &)> &callback) |
| Registers a menu bar callback. | |
| void | AddDockspace (bool enabled) |
| Enables or disables ImGui dockspace for UI layout. | |
| void | TogglePanelVisibility (const std::string &panelName) |
| Toggles the visibility state of a registered panel. | |
| void | SetScene (Scene &scene) |
| Sets the active scene pointer for UI context. | |
| void | DeferResourceCleanup (const std::function< void()> &fn, void *fence) |
| Enqueues a function to be called during ImGui cleanup. | |
| void | Resize (u32 width, u32 height) |
| Resizes UI render targets and related resources. | |
Manages UI lifecycle, panels, and rendering for both editor and runtime.
Handles initialization, rendering, and shutdown of the UI system. Supports panel registration with visibility scopes, menu bars, dockspaces, and deferred resource cleanup.
|
inline |
Enables or disables ImGui dockspace for UI layout.
| enabled | True to enable dockspace, false to disable. |
| void Raven::UIManager::AddMenuBar | ( | float | height, |
| const std::function< void(UIPanelContext &)> & | callback ) |
Registers a menu bar callback.
Only one menu bar can be active at a time.
| height | Height of the menu bar in pixels. |
| callback | Function invoked to render the menu bar. |
| void Raven::UIManager::AddPanel | ( | const std::string & | panelName, |
| PanelScope | scope, | ||
| const std::function< void(UIPanelContext &)> & | callback, | ||
| bool | startVisible = true ) |
Registers a UI panel.
| panelName | Name identifier for the panel. |
| scope | Visibility scope of the panel (Editor, Runtime, or both). |
| callback | Function invoked every frame to render panel contents. |
| startVisible | Set the starting Visibility. |
| void Raven::UIManager::Begin | ( | ) |
Begins a new UI frame, setting up ImGui and framebuffers.
| void Raven::UIManager::DeferResourceCleanup | ( | const std::function< void()> & | fn, |
| void * | fence ) |
Enqueues a function to be called during ImGui cleanup.
Used for deferred resource cleanup tasks.
| fn | Function to execute later. |
| fence | The fence used for the frame |
| void Raven::UIManager::DrawUI | ( | ) |
Draws all registered UI panels and menu bars.
| void Raven::UIManager::End | ( | ) |
Ends the current UI frame, finalizing ImGui rendering.
| void Raven::UIManager::Init | ( | ) |
Initializes UI resources and prepares the ImGui renderer.
|
inline |
| void Raven::UIManager::Shutdown | ( | ) |
Cleans up resources and shuts down the UI system.
| void Raven::UIManager::TogglePanelVisibility | ( | const std::string & | panelName | ) |
Toggles the visibility state of a registered panel.
| panelName | Name of the panel to toggle. |