|
Untitled
|
#include "utilities/types.h"#include "utilities/utilities.h"#include <math.h>#include <omp.h>#include "ui/ui.h"#include "ui/fonts.h"Go to the source code of this file.
Functions | |
| int | find_empty_element_slot (UIMenu *m) |
| int | find_empty_container_slot (UIMenu *m) |
| int | create_ui_element (int menu_id) |
| Creates a UIElement on a given UIMenu. | |
| void | delete_ui_container (UIElement *el) |
| Deletes a UIContainer, removing all references to it from existing TextBoxes and UIElements on the same UIMenu. | |
| void | reassign_elements_to_container (UIElement *el) |
| Assigns all children based on current UIContainer children. | |
| void | remove_element_from_container (UIContainer *c, UIElement *el) |
| Removes a UIElement from a UIContainer. | |
| void | remove_text_box_from_container (UIContainer *c, TextBox *tb) |
| Removes a TextBox from a UIContainer. | |
| void | delete_ui_element (int menu, int id) |
| Deletes a UIElement, removing it from its possible parent UIContainer and deleting its own possible UIContainer. | |
| UIContainer * | create_ui_container (UIElement *el, int menu_id) |
| Creates a UIContainer from a given UIElement a given UIMenu. | |
| void | scroll_container (UIContainer *c, UISlider *slider, UIMenu *m) |
| int | find_ui_element_in_menu (UIMenu *m, const char *id) |
| Finds a UIElement inside of a UIMenu via name. | |
| int | find_text_box_in_menu (UIMenu *m, const char *id) |
| Finds a TextBox inside of a UIMenu via name. | |
| int | find_container_in_menu (UIMenu *m, const char *id) |
| Finds a UIContainer inside of a UIMenu via name. | |
| int | move_element_to_menu (int element_idx, int current_menu, int target_menu) |
| Moves a UIElement from its current UIMenu to another UIMenu. | |
| int | move_text_box_to_menu (int tb_idx, int current_menu, int target_menu) |
| Moves a TextBox from its current UIMenu to another UIMenu. | |
| void | assign_element_to_container (UIElement *el, UIContainer *c) |
| Assigns a UIElement to be parented to a UIContainer. | |
| void | assign_text_box_to_container (TextBox *tb, UIContainer *c) |
| Assigns a TextBox to be parented to a UIContainer. | |
| void | align_text_box_label (UIElement *el) |
| Aligns a TextBox inside of a UILabel based on its Justify. | |
| bool | point_inside_ui_element (UIElement *el, vec2 pos) |
| vec2 | screenspace_to_ui_element_local (UIElement *el, float scale_x, float scale_y, vec2 pos) |
| bool | is_hovering_ui_element (UIElement *el, vec2 pos) |
| int | get_text_box_from_coords (vec2 pos, int *menu_idx) |
| Finds a TextBox based on a screen position. | |
| int | get_ui_element_from_coords (vec2 pos, int *menu_idx) |
| Finds a UIElement based on a screen position. | |
| void | process_ui_event (UICallback *callback) |
| void | compute_slider_bounds (UIElement *element) |
| Computes the minimum and maximum in UI space for a UISlider. | |
| void | create_label (UIElement *element, int box, int parent_dropdown, Justify justify) |
| void | create_slider (UIElement *element, vec2 dir, float len) |
| Creates a UISlider from a UIElement. | |
| void | handle_ui_event (SDL_Event event, int mouse_x, int mouse_y) |
| Handles an incoming UI event. | |
| void | update_ui_state (float mouse_x, float mouse_y) |
| Handles the persistent UI state from previous frames. | |
Variables | |
| int | TEXT_WIDTH = 1280 |
| int | TEXT_HEIGHT = 720 |
| Vector | MENUS = {0} |
| All UIMenus. | |
| int find_empty_element_slot | ( | UIMenu * | m | ) |
Definition at line 16 of file ui.c.
References UIMenu::elements, find_empty_element_slot(), UIElement::free, and MAX_UI_ELEMENTS.
Referenced by create_ui_element(), find_empty_element_slot(), and move_element_to_menu().
| int find_empty_container_slot | ( | UIMenu * | m | ) |
Definition at line 27 of file ui.c.
References UIMenu::containers, find_empty_container_slot(), UIContainer::free, and MAX_UI_CONTAINERS.
Referenced by create_ui_container(), and find_empty_container_slot().
| void scroll_container | ( | UIContainer * | c, |
| UISlider * | slider, | ||
| UIMenu * | m ) |
Definition at line 224 of file ui.c.
References UIElement::base_pos, UIContainer::child_count, UIContainer::children, UIContainer::delta_scroll_offset, UIMenu::elements, lerp(), UISlider::max_val, UISlider::min_val, scroll_container(), UIContainer::scroll_dir, UIContainer::scroll_offset, UISlider::scroll_scale, UIElement::translation, UISlider::val, vec2_add(), vec2_scale(), vec2_sub(), vec2::x, and vec2::y.
Referenced by scroll_container(), and update_ui_state().
Definition at line 470 of file ui.c.
References UIElement::center, point_inside_ui_element(), UIElement::radius, SDF_circle(), SDF_rect(), UIElement::size, UIElement::type, UIELEMENT_CIRCLE, and UIELEMENT_RECT.
Referenced by get_ui_element_from_coords(), is_hovering_ui_element(), and point_inside_ui_element().
Definition at line 492 of file ui.c.
References UIElement::scale, screenspace_to_ui_element_local(), UIElement::translation, vec2_sub(), vec2::x, and vec2::y.
Referenced by get_ui_element_from_coords(), is_hovering_ui_element(), and screenspace_to_ui_element_local().
Definition at line 506 of file ui.c.
References is_hovering_ui_element(), point_inside_ui_element(), screenspace_to_ui_element_local(), TEXT_HEIGHT, TEXT_WIDTH, UI_SCALE_HEIGHT, and UI_SCALE_WIDTH.
Referenced by handle_ui_event(), and is_hovering_ui_element().
| void process_ui_event | ( | UICallback * | callback | ) |
Definition at line 611 of file ui.c.
References UICallback::action_fn, UIValue::behavior, UIValue::data, UIValue::inc_val, MAX, UIValue::max_val, MIN, UIValue::min_val, process_ui_event(), UIValue::type, UIVAL_BOOL, UIVAL_CALLBACK, UIVAL_FLOAT, UIVAL_INT, UIVAL_NONE, UIVALBEHAVIOR_CLAMP, UIVALBEHAVIOR_NONE, UIVALBEHAVIOR_WRAP, and UICallback::val.
Referenced by handle_ui_event(), process_ui_event(), and update_ui_state().
Definition at line 673 of file ui.c.
References UIElement::as, and create_label().
Referenced by create_label().