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::NuklearUI Class Referencefinal

Manages the nuklear ui state. More...

#include <NuklearUI.hpp>

+ Collaboration diagram for galaxy::ui::NuklearUI:

Public Member Functions

 NuklearUI ()
 Constructor.
 
 ~NuklearUI ()
 Destructor.
 
void on_mouse_pressed (events::MousePressed &e)
 On mouse pressed event handler.
 
void on_mouse_wheel (events::MouseWheel &e)
 On mouse wheel event handler.
 
void on_key_char (events::KeyChar &e)
 On typing event handler.
 
void on_key_press (events::KeyPress &e)
 On keyboad press event.
 
void on_content_scale (const events::ContentScale &e)
 On content scale event.
 
void begin_input () const
 Called before glfwPollEvents.
 
void end_input () const
 Called after glfwPollEvents.
 
void poll_input () const
 Calls begin, end and glfwPollEvents.
 
void new_frame ()
 Called before any nuklear code.
 
void render ()
 Render nuklear.
 
void set_font (const std::string &id)
 Change the active font.
 
void toggle_input (const bool enable)
 Control the input.
 
void show_loading_bar (const char *text, nk_size total, nk_size current)
 Shows a progress bar for loading screens.
 
void show_building_atlas ()
 Part of the loading screen. Informs the user that the atlas is being built.
 
nk_context * ctx () const
 Nuklear Context.
 

Private Member Functions

void scale (const float scale)
 Scale UI to monitor/window.
 

Private Attributes

nk_glfw * m_ctx
 Nuklear context pointer.
 
nk_font_atlas * m_atlas
 Nuklear atlas pointer.
 
std::array< int, 4 > m_viewport_backup
 Viewport backup when rendering.
 
ankerl::unordered_dense::map< std::string, nk_font * > m_fonts
 Fonts used by nuklear.
 

Detailed Description

Manages the nuklear ui state.

Definition at line 27 of file NuklearUI.hpp.

Constructor & Destructor Documentation

◆ NuklearUI()

galaxy::ui::NuklearUI::NuklearUI ( )

Constructor.

Definition at line 25 of file NuklearUI.cpp.

+ Here is the call graph for this function:

◆ ~NuklearUI()

galaxy::ui::NuklearUI::~NuklearUI ( )

Destructor.

Definition at line 38 of file NuklearUI.cpp.

Member Function Documentation

◆ on_mouse_pressed()

void galaxy::ui::NuklearUI::on_mouse_pressed ( events::MousePressed & e)

On mouse pressed event handler.

Parameters
eEvent to process.

Definition at line 45 of file NuklearUI.cpp.

◆ on_mouse_wheel()

void galaxy::ui::NuklearUI::on_mouse_wheel ( events::MouseWheel & e)

On mouse wheel event handler.

Parameters
eEvent to process.

Definition at line 54 of file NuklearUI.cpp.

◆ on_key_char()

void galaxy::ui::NuklearUI::on_key_char ( events::KeyChar & e)

On typing event handler.

Parameters
eEvent to process.

Definition at line 63 of file NuklearUI.cpp.

◆ on_key_press()

void galaxy::ui::NuklearUI::on_key_press ( events::KeyPress & e)

On keyboad press event.

Parameters
eTakes in a key press event.

Definition at line 72 of file NuklearUI.cpp.

◆ on_content_scale()

void galaxy::ui::NuklearUI::on_content_scale ( const events::ContentScale & e)

On content scale event.

Parameters
eTakes in a content scale event.

Definition at line 92 of file NuklearUI.cpp.

+ Here is the call graph for this function:

◆ begin_input()

void galaxy::ui::NuklearUI::begin_input ( ) const

Called before glfwPollEvents.

Definition at line 97 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end_input()

void galaxy::ui::NuklearUI::end_input ( ) const

Called after glfwPollEvents.

Definition at line 105 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ poll_input()

void galaxy::ui::NuklearUI::poll_input ( ) const

Calls begin, end and glfwPollEvents.

Definition at line 130 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_frame()

void galaxy::ui::NuklearUI::new_frame ( )

Called before any nuklear code.

Definition at line 137 of file NuklearUI.cpp.

◆ render()

void galaxy::ui::NuklearUI::render ( )

Render nuklear.

Definition at line 142 of file NuklearUI.cpp.

◆ set_font()

void galaxy::ui::NuklearUI::set_font ( const std::string & id)

Change the active font.

Parameters
idFont file name without extension.

Definition at line 157 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle_input()

void galaxy::ui::NuklearUI::toggle_input ( const bool enable)

Control the input.

Parameters
enableTrue to allow input to nuklear ui.

Definition at line 165 of file NuklearUI.cpp.

+ Here is the caller graph for this function:

◆ show_loading_bar()

void galaxy::ui::NuklearUI::show_loading_bar ( const char * text,
nk_size total,
nk_size current )

Shows a progress bar for loading screens.

Parameters
textMessage to display when loading.
totalTotal size of loading bar.
currentCurrent progress of loading bar.

Definition at line 175 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_building_atlas()

void galaxy::ui::NuklearUI::show_building_atlas ( )

Part of the loading screen. Informs the user that the atlas is being built.

Definition at line 193 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ctx()

nk_context * galaxy::ui::NuklearUI::ctx ( ) const
nodiscard

Nuklear Context.

Returns
Pointer to context. DO NOT FREE.

Definition at line 209 of file NuklearUI.cpp.

+ Here is the caller graph for this function:

◆ scale()

void galaxy::ui::NuklearUI::scale ( const float scale)
private

Scale UI to monitor/window.

Parameters
scaleUsually window content scale.

Definition at line 214 of file NuklearUI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_ctx

nk_glfw* galaxy::ui::NuklearUI::m_ctx
private

Nuklear context pointer.

Definition at line 147 of file NuklearUI.hpp.

◆ m_atlas

nk_font_atlas* galaxy::ui::NuklearUI::m_atlas
private

Nuklear atlas pointer.

Definition at line 152 of file NuklearUI.hpp.

◆ m_viewport_backup

std::array<int, 4> galaxy::ui::NuklearUI::m_viewport_backup
private

Viewport backup when rendering.

Definition at line 157 of file NuklearUI.hpp.

◆ m_fonts

ankerl::unordered_dense::map<std::string, nk_font*> galaxy::ui::NuklearUI::m_fonts
private

Fonts used by nuklear.

Definition at line 162 of file NuklearUI.hpp.


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