|
Untitled
|
The standalone UI library that controls text rendering, ui rendering, and events. More...
Go to the source code of this file.
Data Structures | |
| struct | Glyph |
| A single Glyph in a Font. More... | |
| struct | Font |
| A Font and its Glyphs used for rendering TextBoxes. More... | |
| struct | TextBoxGPU |
| The GPU-side representation of a TextBox. More... | |
| struct | UIElementGPU |
| The GPU-side representation of a UIElement. More... | |
| struct | UIContainer |
| UIContainer that contains both TextBoxes and UIElements and can mask and scroll them. More... | |
| struct | TextBox |
| A structure holding a Font ID and text to be rendered and transformed with its properties. More... | |
| struct | UIValue |
| A value that is manipulated in some way when a UIElement receives an event. More... | |
| struct | UICallback |
| Describes function pointers for UIElements that determine behavior on events. More... | |
| struct | UISlider |
| UIElement sliders that interpolate between two points on a line. More... | |
| struct | UIDropdown |
| Unfinished structure for a dropdown that spawns UIElements and TextBoxes when opened. More... | |
| struct | UILabel |
| UIElement UILabels that contain a TextBox reference. More... | |
| struct | UIElement |
| UIElements that are contained within a UIMenu that may receive events, be contained within UIContainers, or be UIContainers themselves. More... | |
| struct | UIMenu |
| The top-most UI structure that contains UIElements, TextBoxes, and UIContainers. More... | |
Macros | |
UI Constants | |
Sizes of UI arrays and UI Scale.
| |
| #define | MAX_UI_ELEMENTS 1024 |
| #define | MAX_UI_CONTAINERS 1024 |
| #define | UI_SCALE_WIDTH 2560 |
| #define | UI_SCALE_HEIGHT 1920 |
| #define | MAX_TEXT_BOXES 1024 |
| #define | MAX_TEXT_BOX_CHARACTERS 256 |
| #define | MAX_UI_CHILDREN 1024 |
| #define | MAX_GLYPHS 256 |
Functions | |
| 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. | |
| 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. | |
| int | create_ui_element (int menu_id) |
| Creates a UIElement on a given UIMenu. | |
| UIContainer * | create_ui_container (UIElement *el, int menu_id) |
| Creates a UIContainer from a given UIElement a given UIMenu. | |
| void | delete_ui_element (int menu, int id) |
| Deletes a UIElement, removing it from its possible parent UIContainer and deleting its own possible UIContainer. | |
| void | delete_ui_container (UIElement *el) |
| Deletes a UIContainer, removing all references to it from existing TextBoxes and UIElements on the same UIMenu. | |
| 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. | |
| void | compute_slider_bounds (UIElement *element) |
| Computes the minimum and maximum in UI space for a UISlider. | |
| void | create_slider (UIElement *element, vec2 dir, float len) |
| Creates a UISlider from a UIElement. | |
| 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. | |
| 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. | |
| void | align_text_box_label (UIElement *el) |
| Aligns a TextBox inside of a UILabel based on its Justify. | |
| 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 | reassign_elements_to_container (UIElement *el) |
| Assigns all children based on current UIContainer children. | |
| void | UI_INIT () |
| Simply frees the MENUS buffer and reinitializes the Vector. | |
| UIMenu * | create_menu () |
| Creates a new UIMenu, expanding the MENUS Vector and sets all arrays to free. | |
| bool | container_is_valid (int container, int menu) |
| Checks if a UIContainer and UIMenu ID pairing is valid. | |
| vec2 | screenspace_to_ui (vec2 pos) |
| Transfers a position to local UI space by multiplying it by a ratio of the two resolutions. | |
Variables | |
| Vector | MENUS |
| All UIMenus. | |
| const char * | JUSTIFY_NAMES [] |
| The names of Justify for the Editor UI. | |
| const char * | UI_INTERACTABLE_NAMES [] |
| UIElement interactable names for the union that describe unique functions. | |
FBO Size | |
The size of the rendering FBO, used to convert from screenspace to local UI space. | |
| int | TEXT_WIDTH |
| int | TEXT_HEIGHT |
Default Structures | |
Safe defaults for each UI structure. | |
| UICallback | DEFAULT_CALLBACK |
| UIElement | DEFAULT_UI_ELEMENT |
| UISlider | DEFAULT_SLIDER |
| UILabel | DEFAULT_LABEL |
| UIContainer | DEFAULT_UI_CONTAINER |
| TextBox | DEFAULT_TEXT_BOX |
The standalone UI library that controls text rendering, ui rendering, and events.
Definition in file ui.h.