![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Manages the nuklear ui state. More...
#include <NuklearUI.hpp>
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. | |
Manages the nuklear ui state.
Definition at line 27 of file NuklearUI.hpp.
galaxy::ui::NuklearUI::NuklearUI | ( | ) |
galaxy::ui::NuklearUI::~NuklearUI | ( | ) |
Destructor.
Definition at line 38 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::on_mouse_pressed | ( | events::MousePressed & | e | ) |
On mouse pressed event handler.
e | Event to process. |
Definition at line 45 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::on_mouse_wheel | ( | events::MouseWheel & | e | ) |
On mouse wheel event handler.
e | Event to process. |
Definition at line 54 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::on_key_char | ( | events::KeyChar & | e | ) |
void galaxy::ui::NuklearUI::on_key_press | ( | events::KeyPress & | e | ) |
On keyboad press event.
e | Takes in a key press event. |
Definition at line 72 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::on_content_scale | ( | const events::ContentScale & | e | ) |
On content scale event.
e | Takes in a content scale event. |
Definition at line 92 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::begin_input | ( | ) | const |
Called before glfwPollEvents.
Definition at line 97 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::end_input | ( | ) | const |
Called after glfwPollEvents.
Definition at line 105 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::poll_input | ( | ) | const |
Calls begin, end and glfwPollEvents.
Definition at line 130 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::new_frame | ( | ) |
Called before any nuklear code.
Definition at line 137 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::render | ( | ) |
Render nuklear.
Definition at line 142 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::set_font | ( | const std::string & | id | ) |
Change the active font.
id | Font file name without extension. |
Definition at line 157 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::toggle_input | ( | const bool | enable | ) |
Control the input.
enable | True to allow input to nuklear ui. |
Definition at line 165 of file NuklearUI.cpp.
void galaxy::ui::NuklearUI::show_loading_bar | ( | const char * | text, |
nk_size | total, | ||
nk_size | current ) |
Shows a progress bar for loading screens.
text | Message to display when loading. |
total | Total size of loading bar. |
current | Current progress of loading bar. |
Definition at line 175 of file NuklearUI.cpp.
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.
|
nodiscard |
Nuklear Context.
Definition at line 209 of file NuklearUI.cpp.
|
private |
Scale UI to monitor/window.
scale | Usually window content scale. |
Definition at line 214 of file NuklearUI.cpp.
|
private |
Nuklear context pointer.
Definition at line 147 of file NuklearUI.hpp.
|
private |
Nuklear atlas pointer.
Definition at line 152 of file NuklearUI.hpp.
|
private |
Viewport backup when rendering.
Definition at line 157 of file NuklearUI.hpp.
|
private |
Fonts used by nuklear.
Definition at line 162 of file NuklearUI.hpp.