34 #include <glm/vec2.hpp>
35 #include <glm/mat4x4.hpp>
37 #include "eng3d/shader.hpp"
38 #include "eng3d/rectangle.hpp"
39 #include "eng3d/color.hpp"
68 glm::ivec2 cursor_pos;
70 glm::ivec2 get_pos(
UI::Widget& w, glm::ivec2 offset);
72 bool check_hover_recursive(
UI::Widget& w, glm::ivec2 mouse_pos, glm::ivec2 offset);
74 bool check_wheel_recursive(
UI::Widget& w, glm::ivec2 mouse_pos, glm::ivec2 offset,
int y);
82 std::function<void(glm::ivec2 start_mouse_pos, glm::ivec2 current_mouse_pos)> on_drag =
nullptr;
85 Widget* mouse_pressed_widget =
nullptr;
87 glm::ivec2 start_drag_mouse_position;
89 std::vector<std::unique_ptr<UI::Widget>> widgets;
90 std::vector<std::unique_ptr<UI::Widget>> no_eval_widgets;
101 void resize(
const int width,
const int height);
145 void prompt(
const std::string& title,
const std::string& text);
The UI context that handles all the ui widgets.
std::shared_ptr< Eng3D::Texture > cursor_tex
std::mutex prompt_queue_mutex
std::shared_ptr< Eng3D::Texture > button_border
void set_eval(UI::Widget &widget, bool eval)
Moves a widget from evaluable to non-evaluable making a widget non-evaluable has side effects,...
std::shared_ptr< Eng3D::Texture > foreground
std::shared_ptr< Eng3D::TrueType::Font > default_font
std::vector< std::pair< std::string, std::string > > prompt_queue
std::shared_ptr< Eng3D::Texture > tooltip_tex
void render_all()
Render all widgets.
void use_tooltip(Tooltip *tooltip, glm::ivec2 pos)
void do_tick()
Will call on_tick on all widgets.
std::shared_ptr< Eng3D::Texture > button
bool check_mouse_released(glm::ivec2 mouse_pos)
Release the dragging of the widget.
std::unique_ptr< Eng3D::OpenGL::Program > obj_shader
std::shared_ptr< Eng3D::Texture > background
void remove_widget(UI::Widget *widget)
void prompt(const std::string &title, const std::string &text)
std::shared_ptr< Eng3D::Texture > piechart_overlay
void resize(const int width, const int height)
bool check_text_input(const char *input)
Will give keyboard input to Input Widget if one is selected.
void check_drag(glm::ivec2 mouse_pos)
Check for on_drag events, will move Window widgets with is_pinned = false.
bool check_wheel(glm::ivec2 mouse_pos, int y)
Check if the mouse is above a widget and scroll widget.
std::unique_ptr< Eng3D::OpenGL::Program > piechart_shader
std::shared_ptr< Eng3D::Texture > window_top
void add_widget(UI::Widget *widget)
bool 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 toolti...
bool 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 poss...
void clear()
Removes all widgets.
void clear_dead()
Removes all widgets that have been killed.
std::shared_ptr< Eng3D::Texture > border_tex
void set_cursor_pos(glm::ivec2 pos)
void(* Callback)(UI::Widget &)