Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::UIManager Class Reference

Manages UI lifecycle, panels, and rendering for both editor and runtime. More...

#include <UIManager.h>

Public Member Functions

FRAMEWORK_API void Init ()
 Initializes UI resources and prepares the ImGui renderer.
FRAMEWORK_API void Shutdown ()
 Cleans up resources and shuts down the UI system.
FRAMEWORK_API void Begin ()
 Begins a new UI frame, setting up ImGui and framebuffers.
FRAMEWORK_API void End ()
 Ends the current UI frame, finalizing ImGui rendering.
FRAMEWORK_API void DrawUI ()
 Draws all registered UI panels and menu bars.
FRAMEWORK_API void AddPanel (const std::string &panelName, const std::function< void(UIPanelContext &)> &callback, bool startVisible=true)
 Registers a UI panel.
FRAMEWORK_API 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.
FRAMEWORK_API void TogglePanelVisibility (std::string_view panelName)
 Toggles the visibility state of a registered panel.
void SetScene (Scene &scene)
 Sets the active scene pointer for UI context.
FRAMEWORK_API void DeferResourceCleanup (const std::function< void()> &fn)
 Enqueues a function to be called during ImGui cleanup.
FRAMEWORK_API void SetImGuiStyle ()
 Configures ImGui style settings to the engine's preferred theme.
ImGuiContext * GetContext ()

Detailed Description

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.

Member Function Documentation

◆ AddDockspace()

void Raven::UIManager::AddDockspace ( bool enabled)
inline

Enables or disables ImGui dockspace for UI layout.

Parameters
enabledTrue to enable dockspace, false to disable.

◆ AddMenuBar()

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.

Parameters
heightHeight of the menu bar in pixels.
callbackFunction invoked to render the menu bar.

◆ AddPanel()

void Raven::UIManager::AddPanel ( const std::string & panelName,
const std::function< void(UIPanelContext &)> & callback,
bool startVisible = true )

Registers a UI panel.

Parameters
panelNameName identifier for the panel.
callbackFunction invoked every frame to render panel contents.
startVisibleSet the starting Visibility.
Note
If startVisible is set to false, the TogglePanelVisibility function must be invoked to display it.

◆ Begin()

void Raven::UIManager::Begin ( )

Begins a new UI frame, setting up ImGui and framebuffers.

◆ DeferResourceCleanup()

void Raven::UIManager::DeferResourceCleanup ( const std::function< void()> & fn)

Enqueues a function to be called during ImGui cleanup.

Used for deferred resource cleanup tasks.

Parameters
fnFunction to execute later.

◆ DrawUI()

void Raven::UIManager::DrawUI ( )

Draws all registered UI panels and menu bars.

◆ End()

void Raven::UIManager::End ( )

Ends the current UI frame, finalizing ImGui rendering.

◆ GetContext()

ImGuiContext * Raven::UIManager::GetContext ( )
inline
Returns
Returns the current ImGui Context

◆ Init()

void Raven::UIManager::Init ( )

Initializes UI resources and prepares the ImGui renderer.

◆ SetImGuiStyle()

void Raven::UIManager::SetImGuiStyle ( )

Configures ImGui style settings to the engine's preferred theme.

Applies colors, padding, and other style parameters for consistent UI appearance.

Colours

Style

◆ SetScene()

void Raven::UIManager::SetScene ( Scene & scene)
inline

Sets the active scene pointer for UI context.

Parameters
sceneReference to the active Scene.

◆ Shutdown()

void Raven::UIManager::Shutdown ( )

Cleans up resources and shuts down the UI system.

◆ TogglePanelVisibility()

void Raven::UIManager::TogglePanelVisibility ( std::string_view panelName)

Toggles the visibility state of a registered panel.

Parameters
panelNameName of the panel to toggle.

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