galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::ui Namespace Reference

Classes

class  NuklearUI
 Manages the nuklear ui state. More...
 

Functions

ImGuiIO & imgui_init_context (const char *ini)
 Initialize ImGui context with galaxy.
 
void imgui_new_frame ()
 New imgui frame with galaxy.
 
void imgui_render ()
 Render imgui with galaxy.
 
void imgui_destroy_context ()
 Cleanup imgui resources used by galaxy.
 
void imgui_set_theme ()
 Set our theme.
 
void imgui_popup (const char *id, bool &open, std::move_only_function< void(void)> &&func)
 Cleaner way of rendering an ImGui popup.
 
void imgui_confirm (const char *msg, std::move_only_function< void(void)> &&yes={}, std::move_only_function< void(void)> &&no={})
 Handles a popup for a yes/no situation.
 
void imgui_center_next_window ()
 Make sure the next window opened is centered on the monitor.
 
void scale_and_load_fonts ()
 Scale and load fonts.
 
bool imgui_loaded ()
 Is ImGui loaded?
 
bool imgui_imagebutton (const graphics::Texture2D &texture, const ImVec2 &size, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
 Render an imgui image button with a galaxy texture.
 
void imgui_image (const graphics::Texture2D &texture, const ImVec2 &size)
 Display a galaxy image with imgui.
 
void imgui_image (const graphics::RenderTexture &texture, const ImVec2 &size)
 Display a galaxy image with imgui.
 
void imgui_notify_success (const char *msg)
 ImGui success notification.
 
void imgui_notify_info (const char *msg)
 ImGui info notification.
 
void imgui_notify_warning (const char *msg)
 ImGui warning notification.
 
void imgui_notify_error (const char *msg)
 ImGui error notification.
 
bool imgui_glm_vec2 (const char *label, glm::vec2 &vec)
 GLM vector 2 widget.
 
bool imgui_glm_vec3 (const char *label, glm::vec3 &vec)
 GLM vector 3 widget.
 
bool imgui_glm_vec4 (const char *label, glm::vec4 &vec)
 GLM vector 4 widget.
 
bool imgui_frect (const char *label, math::fRect &rect)
 fRect widget.
 

Function Documentation

◆ imgui_init_context()

ImGuiIO & galaxy::ui::imgui_init_context ( const char * ini)

Initialize ImGui context with galaxy.

Parameters
iniLayout ini file. Can include a path.
Returns
Reference to initialized imgui io.

Definition at line 43 of file ImGuiHelpers.cpp.

+ Here is the call graph for this function:

◆ imgui_new_frame()

void galaxy::ui::imgui_new_frame ( )

New imgui frame with galaxy.

Definition at line 85 of file ImGuiHelpers.cpp.

◆ imgui_render()

void galaxy::ui::imgui_render ( )

Render imgui with galaxy.

Definition at line 97 of file ImGuiHelpers.cpp.

◆ imgui_destroy_context()

void galaxy::ui::imgui_destroy_context ( )

Cleanup imgui resources used by galaxy.

Definition at line 115 of file ImGuiHelpers.cpp.

◆ imgui_set_theme()

void galaxy::ui::imgui_set_theme ( )

Set our theme.

Definition at line 122 of file ImGuiHelpers.cpp.

+ Here is the caller graph for this function:

◆ imgui_popup()

void galaxy::ui::imgui_popup ( const char * id,
bool & open,
std::move_only_function< void(void)> && func )

Cleaner way of rendering an ImGui popup.

Parameters
idPopup ID.
openControls popup visibility.
funcImGui controls to show on popup.

Definition at line 213 of file ImGuiHelpers.cpp.

+ Here is the call graph for this function:

◆ imgui_confirm()

void galaxy::ui::imgui_confirm ( const char * msg,
std::move_only_function< void(void)> && yes = {},
std::move_only_function< void(void)> && no = {} )

Handles a popup for a yes/no situation.

Parameters
msgText to display on confirmation box.
yesCode to run if user selects yes.
noCode to run if user selects no.

Definition at line 229 of file ImGuiHelpers.cpp.

◆ imgui_center_next_window()

void galaxy::ui::imgui_center_next_window ( )

Make sure the next window opened is centered on the monitor.

Definition at line 259 of file ImGuiHelpers.cpp.

+ Here is the caller graph for this function:

◆ scale_and_load_fonts()

void galaxy::ui::scale_and_load_fonts ( )

Scale and load fonts.

Calc proper window scalings and needs to reload fonts aswell.

Definition at line 265 of file ImGuiHelpers.cpp.

+ Here is the caller graph for this function:

◆ imgui_loaded()

bool galaxy::ui::imgui_loaded ( )
nodiscard

Is ImGui loaded?

Returns
True if imgui context is loaded.

Definition at line 291 of file ImGuiHelpers.cpp.

◆ imgui_imagebutton()

bool galaxy::ui::imgui_imagebutton ( const graphics::Texture2D & texture,
const ImVec2 & size,
const ImVec4 & bg_col = ImVec4(0, 0, 0, 0),
const ImVec4 & tint_col = ImVec4(1, 1, 1, 1) )

Render an imgui image button with a galaxy texture.

Parameters
textureTexture to display.
sizeSize of the button.
bg_colOptional background colour.
tint_colOptional tint colour.
Returns
True if button pressed.

Definition at line 296 of file ImGuiHelpers.cpp.

◆ imgui_image() [1/2]

void galaxy::ui::imgui_image ( const graphics::Texture2D & texture,
const ImVec2 & size )

Display a galaxy image with imgui.

Parameters
textureTexture to display.
sizeSize of the button.

Definition at line 304 of file ImGuiHelpers.cpp.

◆ imgui_image() [2/2]

void galaxy::ui::imgui_image ( const graphics::RenderTexture & texture,
const ImVec2 & size )

Display a galaxy image with imgui.

Parameters
textureRender texture to display.
sizeSize of the button.

Definition at line 310 of file ImGuiHelpers.cpp.

◆ imgui_notify_success()

void galaxy::ui::imgui_notify_success ( const char * msg)

ImGui success notification.

Parameters
msgMessage to display.

Definition at line 316 of file ImGuiHelpers.cpp.

◆ imgui_notify_info()

void galaxy::ui::imgui_notify_info ( const char * msg)

ImGui info notification.

Parameters
msgMessage to display.

Definition at line 321 of file ImGuiHelpers.cpp.

◆ imgui_notify_warning()

void galaxy::ui::imgui_notify_warning ( const char * msg)

ImGui warning notification.

Parameters
msgMessage to display.

Definition at line 326 of file ImGuiHelpers.cpp.

◆ imgui_notify_error()

void galaxy::ui::imgui_notify_error ( const char * msg)

ImGui error notification.

Parameters
msgMessage to display.

Definition at line 331 of file ImGuiHelpers.cpp.

◆ imgui_glm_vec2()

bool galaxy::ui::imgui_glm_vec2 ( const char * label,
glm::vec2 & vec )

GLM vector 2 widget.

Parameters
labelWidget label.
vecVector.
Returns
True if any field is clicked.

Definition at line 336 of file ImGuiHelpers.cpp.

◆ imgui_glm_vec3()

bool galaxy::ui::imgui_glm_vec3 ( const char * label,
glm::vec3 & vec )

GLM vector 3 widget.

Parameters
labelWidget label.
vecVector.
Returns
True if any field is clicked.

Definition at line 358 of file ImGuiHelpers.cpp.

◆ imgui_glm_vec4()

bool galaxy::ui::imgui_glm_vec4 ( const char * label,
glm::vec4 & vec )

GLM vector 4 widget.

Parameters
labelWidget label.
vecVector.
Returns
True if any field is clicked.

Definition at line 385 of file ImGuiHelpers.cpp.

◆ imgui_frect()

bool galaxy::ui::imgui_frect ( const char * label,
math::fRect & rect )

fRect widget.

Parameters
labelWidget label.
rectRectangle.
Returns
True if any field is clicked.

Definition at line 417 of file ImGuiHelpers.cpp.