The UI context that handles all the ui widgets.
More...
#include <ui.hpp>
The UI context that handles all the ui widgets.
Definition at line 63 of file ui.hpp.
◆ Context() [1/2]
◆ Context() [2/2]
◆ ~Context()
UI::Context::~Context |
( |
| ) |
|
◆ add_widget()
void UI::Context::add_widget |
( |
UI::Widget * |
widget | ) |
|
◆ check_click()
bool UI::Context::check_click |
( |
glm::ivec2 |
mouse_pos | ) |
|
Check for on_click events. Check if the mouse is above a widget and call the widgets on_click if possible. Also move the clicked window to the top, only works for Window widget with is_pinned = false.
- Parameters
-
mouse_pos | The mouse position |
- Returns
- true if the mouse position was above a ui widget
Definition at line 498 of file ui.cpp.
◆ check_drag()
void UI::Context::check_drag |
( |
glm::ivec2 |
mouse_pos | ) |
|
Check for on_drag events, will move Window widgets with is_pinned = false.
- Parameters
-
mouse_pos | The mouse position |
Definition at line 555 of file ui.cpp.
◆ check_hover()
bool UI::Context::check_hover |
( |
glm::ivec2 |
mouse_pos | ) |
|
Check for on_hover events If the mouse is above a widget call the widgets on_hover or show its tooltip if possible.
- Parameters
-
mouse_pos | The mouse position |
- Returns
- true if the mouse position was above a ui widget
Definition at line 400 of file ui.cpp.
◆ check_mouse_released()
bool UI::Context::check_mouse_released |
( |
glm::ivec2 |
mouse_pos | ) |
|
Release the dragging of the widget.
- Parameters
-
mouse_pos | The mouse position |
Definition at line 530 of file ui.cpp.
◆ check_text_input()
bool UI::Context::check_text_input |
( |
const char * |
input | ) |
|
Will give keyboard input to Input Widget if one is selected.
- Parameters
-
input | The input characters |
- Returns
- true if there is a currently selected input widget
Definition at line 573 of file ui.cpp.
◆ check_wheel()
bool UI::Context::check_wheel |
( |
glm::ivec2 |
mouse_pos, |
|
|
int |
y |
|
) |
| |
Check if the mouse is above a widget and scroll widget.
- Parameters
-
mouse_pos | The mouse position |
y | The mouse scroll wheel amount |
- Returns
- true if the mouse position was above a ui widget
Definition at line 625 of file ui.cpp.
◆ clear()
void UI::Context::clear |
( |
| ) |
|
Removes all widgets.
Definition at line 121 of file ui.cpp.
◆ clear_dead()
void UI::Context::clear_dead |
( |
| ) |
|
Removes all widgets that have been killed.
Definition at line 146 of file ui.cpp.
◆ do_tick()
void UI::Context::do_tick |
( |
| ) |
|
Will call on_tick on all widgets.
These functions are called on each world tick - this is to allow to update widgets on each world tick, and are also framerate independent and thus more reliable than doing the usual if (tick % ticks_per_month == 24) {}
, which can cause issues on slow PCs or very fast hosts.
Definition at line 635 of file ui.cpp.
◆ load_textures()
void UI::Context::load_textures |
( |
| ) |
|
◆ prompt()
void UI::Context::prompt |
( |
const std::string & |
title, |
|
|
const std::string & |
text |
|
) |
| |
◆ remove_widget()
void UI::Context::remove_widget |
( |
UI::Widget * |
widget | ) |
|
◆ render_all()
void UI::Context::render_all |
( |
| ) |
|
Render all widgets.
Definition at line 323 of file ui.cpp.
◆ resize()
void UI::Context::resize |
( |
const int |
width, |
|
|
const int |
height |
|
) |
| |
◆ set_cursor_pos()
void UI::Context::set_cursor_pos |
( |
glm::ivec2 |
pos | ) |
|
◆ set_eval()
void UI::Context::set_eval |
( |
UI::Widget & |
widget, |
|
|
bool |
eval |
|
) |
| |
Moves a widget from evaluable to non-evaluable making a widget non-evaluable has side effects, don't delete widgets that have been set to not-evaluable, otherwise you risk destructing objects the UI manager thinks doesn't exist. Compare being non-evaluable with not existing.
Definition at line 165 of file ui.cpp.
◆ use_tooltip()
void UI::Context::use_tooltip |
( |
UI::Tooltip * |
tooltip, |
|
|
glm::ivec2 |
pos |
|
) |
| |
◆ Widget
◆ background
◆ border_tex
◆ button
◆ button_border
◆ cursor_tex
◆ default_font
◆ foreground
◆ hover_update
uint32_t UI::Context::hover_update = 1 |
◆ model
glm::mat4 UI::Context::model |
◆ obj_shader
◆ piechart_overlay
◆ piechart_shader
◆ projection
glm::mat4 UI::Context::projection |
◆ prompt_queue
std::vector<std::pair<std::string, std::string> > UI::Context::prompt_queue |
◆ prompt_queue_mutex
std::mutex UI::Context::prompt_queue_mutex |
◆ tooltip_tex
◆ view
glm::mat4 UI::Context::view |
◆ window_top
The documentation for this class was generated from the following files: