Untitled
Loading...
Searching...
No Matches
ui.h
Go to the documentation of this file.
1
5
6#ifndef UI_H
7#define UI_H
8
10#include "SDL2/SDL.h"
11
21extern int TEXT_WIDTH;
22extern int TEXT_HEIGHT;
24
25extern Vector MENUS;
26
33#define MAX_UI_ELEMENTS 1024
34#define MAX_UI_CONTAINERS 1024
35#define UI_SCALE_WIDTH 2560
36#define UI_SCALE_HEIGHT 1920
37#define MAX_TEXT_BOXES 1024
38#define MAX_TEXT_BOX_CHARACTERS 256
39#define MAX_UI_CHILDREN 1024
40#define MAX_GLYPHS 256
42
43
52typedef struct {
53
54 int id;
55 float u0;
56 float v0;
57 float u1;
58 float v1;
59 int width;
60 int height;
61 int xoffset;
62 int yoffset;
64
65} Glyph;
66
74typedef struct Font {
75
76 int id;
77 size_t texture;
79 size_t glyph_count;
80 int tex_w;
81 int tex_h;
84 char name[256];
85
86} Font;
87
94typedef struct TextBoxGPU
95{
96
97 uint32_t visible;
98 uint32_t hovered;
99 uint32_t shadow;
101 uint32_t container_id;
102 uint32_t mask;
104 uint32_t state;
105 uint32_t pad0;
106 uint32_t pad1;
107 uint32_t pad2;
111
112} TextBoxGPU;
113
145
146typedef struct UIElement UIElement;
147
166
170static const char * JUSTIFY_NAMES[] =
171{
172 "JUSTIFY_CENTER",
173 "JUSTIFY_LEFT",
174 "JUSTIFY_RIGHT",
175 "JUSTIFY_TOP_CENTER",
176 "JUSTIFY_TOP_LEFT",
177 "JUSTIFY_TOP_RIGHT",
178 "JUSTIFY_BOTTOM_CENTER",
179 "JUSTIFY_BOTTOM_LEFT",
180 "JUSTIFY_BOTTOM_RIGHT"
181};
182
193
207
211static const char * UI_INTERACTABLE_NAMES[] =
212{
213 "UI_INTERACTABLE_NONE",
214 "UI_INTERACTABLE_SLIDER",
215 "UI_INTERACTABLE_DROPDOWN",
216 "UI_INTERACTABLE_LABEL"
217};
218
248
255typedef struct TextBox
256{
257
258 bool hovered;
259 bool shadow;
260 bool visible;
261 bool free;
263 uint32_t uID;
265 char * text;
267 float text_size;
268 float w;
269 float h;
270 float shadow_dist;
272
279 float angle;
282
285 vec4 color;
286 vec4 fill;
287 uint32_t layer;
289 int menu;
291 char id[256];
292
293} TextBox;
294
295
305
306
322
336
337
343typedef struct {
344
350 union
351 {
352 int min_int;
353 float min_flt;
354 } min_val;
355
359 union
360 {
361 int max_int;
362 float max_flt;
363 } max_val;
367 union
368 {
369 int inc_int;
370 float inc_flt;
371 } inc_val;
372 void * data;
373
374} UIValue;
375
382typedef struct {
383
385 bool one_shot;
387 void (*action_fn)(void *);
388 void (*unaction_fn)(void *);
389 void * (*bind_fn)(void*, void *);
390 void * data;
391 void (*free_data)(void*);
392 char id[256];
393
394} UICallback;
395
405 //#ffff0
457
461typedef struct UIDropdown {
462
463 // int selected_index;
464 // struct TextBox * selected_option;
465 // char selected_option_id[128];
466 // char options[MAX_DROPDOWN_ELEMENTS][MAX_CHARACTERS];
467 // size_t option_count;
468 // bool expanded;
469 // struct UIElement * children[MAX_DROPDOWN_ELEMENTS];
470 // size_t child_count;
471
472 // TextAlign alignment;
473 // float text_size;
474 // int font_id;
475 // RGBA color;
476 // RGBA fill;
477 // int render_group_id;
478 // int material_id;
479
480
481} UIDropdown;
482
490typedef struct UILabel {
491
492 int box;
495
496} UILabel;
497
505struct UIElement
506{
507
508 bool shadow;
510 float shadow_dist;
511 bool visible;
512 bool free;
514 uint32_t uID;
515 float radius;
523 float angle;
524 vec2 scale;
526
528 vec2 size;
529 vec4 color;
530 vec4 fill;
531
532 uint32_t layer;
537
538 int menu;
541
542 char id[256];
543
545 union
546 {
550 } as;
551
552};
553
554
571
572
578
580{
581 .id = "empty",
582 .action_fn = NULL,
583 .unaction_fn = NULL,
584 .bind_fn = NULL,
585 .bind_self = true,
586 .data = NULL,
587 .free_data = NULL,
588 .val.data = NULL,
589 .val.type = UIVAL_NONE,
590 .one_shot = false
591};
592
594{
595 .free = 0,
596 .color = (vec4){0,0,1,1},
597 .fill = (vec4){0,0,0,0},
598 .size = (vec2){0.5,0.5},
599 .center = (vec2){0,0},
600 .uID = 0,
601 .angle = 0,
602 .scale = (vec2){50,50},
603 .shadow_dir = (vec2){0.5, 0.5},
604 .shadow = true,
605 .shadow_dist = 20,
606 .translation = (vec2){20,100},
607 .base_pos = (vec2){20,100},
608 .type = UIELEMENT_RECT,
609 .radius = 0.0f,
610 .visible = true,
611 .layer = 0,
612 .already_hovered = false,
613 .state = UISTATE_NONE,
614 .container = -1,
615 .parent_container = -1,
616 .id = "default",
617 .interactable = UI_INTERACTABLE_NONE
618};
619
621{
622
623 .container = -1,
624 .len = 100,
625 .dir = (vec2){0, 1},
626 .scroll_scale = 1,
627 .min_val = 0,
628 .max_val = 100
629
630};
631
633{
634
635 .box = -1,
636 .parent_dropdown = -1,
637 .align = JUSTIFY_CENTER
638
639};
640
641
643{
644 .free = 0,
645 .uID = -1,
646 .scroll_offset = (vec2){0,0},
647 .delta_scroll_offset = (vec2){0,0},
648 .scroll_dir = (vec2){0,1},
649 .wrap = false,
650 .padding = (vec4){0,0,0,0},
651 .mask = true,
652 .children = {0},
653 .child_count = 0,
654 .box_children = {0},
655 .box_count = 0,
656 .element = -1,
657 .scrollbar = -1,
658 .id = "default"
659};
660
662{
663 .free = 0,
664 .color = (vec4){1,1,1,1},
665 .fill = (vec4){0,0,0,0},
666 .font_id = 0,
667 .w = 500,
668 .h = 500,
669 .start = (vec2){0,0},
670 .center = (vec2){0,0},
671 .uID = 0,
672 .text_size = 0.6,
673 .angle = 0,
674 .scale = (vec2){1,1},
675 .shadow_dir = (vec2){0.5, -0.5},
676 .shadow = true,
677 .shadow_dist = 20,
678 .translation = (vec2){0,0},
679 .text = NULL,
680 .justify = JUSTIFY_CENTER,
681 .visible = true,
682 .parent_container = -1,
683 .menu = -1,
684 .id = "default",
685 .text_cap = 0,
686 .layer = 0
687};
688
690
698int move_element_to_menu(int element_idx, int current_menu, int target_menu);
699
707int move_text_box_to_menu(int tb_idx, int current_menu, int target_menu);
708
717int get_text_box_from_coords(vec2 pos, int * menu_idx);
718
727int get_ui_element_from_coords(vec2 pos, int * menu_idx);
728
729
735int create_ui_element(int menu_id);
736
744UIContainer * create_ui_container(UIElement * el, int menu_id);
745
751void delete_ui_element(int menu, int id);
752
759
766void handle_ui_event(SDL_Event event, int mouse_x, int mouse_y);
767
774void update_ui_state(float mouse_x, float mouse_y);
775
780void compute_slider_bounds(UIElement * element);
781
788void create_slider(UIElement * element, vec2 dir, float len);
789
796
803
810int find_ui_element_in_menu(UIMenu * m, const char * id);
811
818int find_text_box_in_menu(UIMenu * m, const char * id);
819
826int find_container_in_menu(UIMenu * m, const char * id);
827
828
835
836
843
850
857
858
859
860
864static inline void UI_INIT()
865{
866
867 if (MENUS.buffer) free(MENUS.buffer);
868 init_vector(&MENUS, 0, sizeof(UIMenu));
869
870}
871
875static inline UIMenu * create_menu() {
876
877 UIMenu * menu = vector_expand(&MENUS, 1);
878
879 for (int i = 0; i < MAX_UI_ELEMENTS; i++)
880 {
881 menu->elements[i].free = true;
882 }
883 for (int i = 0; i < MAX_TEXT_BOXES; i++)
884 {
885 menu->text_boxes[i].free = true;
886 }
887 for (int i = 0; i < MAX_UI_CONTAINERS; i++)
888 {
889 menu->containers[i].free = true;
890 }
891
892 menu->uID = MENUS.count-1;
893 menu->id[0] = '\0';
894
895 return menu;
896}
897
905static inline bool container_is_valid(int container, int menu)
906{
907 if (menu < 0 || menu >= MENUS.count) return false;
908
909 UIMenu * ms = CAST_VEC(MENUS, UIMenu);
910 UIMenu * m = &ms[menu];
911
912 if (container >= 0 && container < MAX_UI_CONTAINERS)
913 {
914
915 UIContainer * conts = m->containers;
916
917 UIContainer * c = &conts[container];
918 if (c->uID != -1 && !c->free)
919 {
920 return true;
921 }
922
923 }
924
925 return false;
926
927}
928
934static inline vec2 screenspace_to_ui(vec2 pos)
935{
936 return (vec2)
937 {
938 pos.x * ((float)UI_SCALE_WIDTH / TEXT_WIDTH),
939 pos.y * ((float)UI_SCALE_HEIGHT / TEXT_HEIGHT)
940 };
941}
942
944
945
946#endif
uint state
Definition text.vert:40
int uID
The ID inside of UIMenu.containers.
Definition ui.h:227
vec2 drag_center_start
The translation of the UISlider on initial drag.
Definition ui.h:431
int parent_dropdown
The dropdown parent.
Definition ui.h:494
uint hovered
Definition text.vert:8
bool free
If this UIContainer is empty or can be replaced.
Definition ui.h:228
float shadow_dist
Definition ui.h:100
vec2 max
The max in pixel space.
Definition ui.h:410
uint32_t visible
Definition ui.h:123
vec2 delta_scroll_offset
The difference between this frame's scroll offset and the current.
Definition ui.h:231
int box
The TextBox index inside of the UIMenu.
Definition ui.h:492
uint32_t shadow
Definition ui.h:99
uint32_t hovered
Definition ui.h:124
uint type
Definition text.vert:41
bool mask
If the UIElements and TextBoxes contained should not be rendered if outside.
Definition ui.h:236
uint32_t pad1
Definition ui.h:106
vec2 scroll_dir
The direction this container moves in when scrolled.
Definition ui.h:232
float prev_val
The previous value.
Definition ui.h:425
void(*) free_data(void *)
The function that frees the bound data.
Definition ui.h:391
float h
The height of the box after pseudo-rendering in determine_text_box_dimensions().
Definition ui.h:269
UIInteractableType interactable
The special interactable type this UIElement may be.
Definition ui.h:544
int id
The ID of the Font in FONTS.
Definition ui.h:76
bool dragging
If we are dragging this UISlider.
Definition ui.h:429
vec2 size
Definition ui.h:128
bool already_hovered
To avoid triggering hover events multiple times if not necessary.
Definition ui.h:535
float v0
.
Definition ui.h:56
uint32_t container_id
Definition ui.h:139
float angle
Angle of rotation.
Definition ui.h:523
uint32_t state
Definition ui.h:130
uint shadow
Definition text.vert:35
float w
The width of the box after pseudo-rendering in determine_text_box_dimensions().
Definition ui.h:268
uint32_t mask
Definition ui.h:102
float angle
The angle to transform this box to.
Definition ui.h:279
int xadvance
How much the x advances when it is typed.
Definition ui.h:63
UIValueType type
The type of value that is inside of data.
Definition ui.h:345
vec4 fill
Definition ui.h:109
vec2 translation
Definition ui.h:135
float min_val
The minimum value of the slider.
Definition ui.h:426
int font_id
The Font ID inside of FONTS.
Definition ui.h:262
float v1
.
Definition ui.h:58
int container
The UIContainer this UIElement may control.
Definition ui.h:539
bool wrap
If UIElements and TextBoxes wrap around the container (unused).
Definition ui.h:234
union UIElement::@017317244344356306005252125357265110320354311371 as
TextBox text_boxes[1024]
The TextBoxes.
Definition ui.h:567
uint32_t masked
Definition ui.h:138
float shadow_dist
Unused.
Definition text.vert:36
vec4 color
Definition ui.h:108
int container
The UIContainer that this UISlider scrolls.
Definition ui.h:454
uint32_t visible
Definition ui.h:97
int tex_w
The texture dimensions.
Definition ui.h:80
vec4 color
Definition ui.h:132
mat4 model
Definition ui.h:110
vec2 size
Size of the SDF.
Definition text.vert:38
char name[256]
The name of the file path.
Definition ui.h:84
vec4 padding
Definition ui.h:134
vec2 min
The min in pixel space.
Definition ui.h:409
vec4 fill
Definition ui.h:133
float scroll_scale
How much the scroll is supposed to influence the UIContainer.
Definition ui.h:428
vec2 start
The start of the text in relation to .
Definition ui.h:284
mat4 model
Definition ui.h:141
UIElement elements[1024]
The UIElements.
Definition ui.h:566
Glyph * glyphs
Glyphs for each character.
Definition ui.h:78
float radius
Definition ui.h:137
float val
The current value between min and max val.
Definition ui.h:424
vec2 translation
X and Y coords where Y+ is down.
Definition text.vert:45
int scrollbar
The scrollbar UISlider UIElement.
Definition ui.h:244
vec2 translation
Where to place the center of the TextBox on the GPU.
Definition ui.h:278
UICallback action_callback
The event to occur on action (press or hold) or unaction.
Definition ui.h:533
vec4 padding
The padding before UIElements and TextBoxes are wrapped or masked.
Definition ui.h:235
uint32_t container_id
Definition ui.h:101
vec2 shadow_dir
Which direction to offset the drop shadow in.
Definition text.vert:13
int text_cap
The amount of characters allocated.
Definition ui.h:266
uint32_t uID
The index inside of MENUS.
Definition ui.h:564
int parent_container
The UIContainer that contains this UIElement.
Definition ui.h:540
vec2 center
The center in relation to .
Definition ui.h:283
int menu
The UIMenu this UIElement is inside.
Definition ui.h:538
vec4 color
The color of the text.
Definition text.vert:18
Justify justify
How the text is centered in relation to and/or its UILabel.
Definition ui.h:264
uint32_t pad0
Definition ui.h:140
Justify align
How the TextBox is justified within this UIElement.
Definition ui.h:493
int height
.
Definition ui.h:60
float len
The length in pixel space.
Definition ui.h:411
uint32_t type
Definition ui.h:131
vec2 scale
Scale.
Definition text.vert:46
uint32_t layer
The layer of the UIElement.
Definition ui.h:532
UIContainer containers[1024]
The UIContainers.
Definition ui.h:568
vec2 center
The center.
Definition ui.h:527
bool bind_self
If the UIElement should bind itself to this callback.
Definition ui.h:384
int xoffset
The x offset before the character.
Definition ui.h:61
bool one_shot
If this event only occurs on initial event.
Definition ui.h:385
uint32_t layer
Rendering sort key (lower drawn first).
Definition ui.h:287
UICallback hover_callback
The event to occur on hover or unhover.
Definition ui.h:534
int id
This ID == '<char>' when looking up which Glyph to use (ascii).
Definition ui.h:54
int parent_container
The UIContainer that contains this TextBox.
Definition ui.h:290
vec2 shadow_dir
Definition ui.h:103
void(*) unaction_fn(void *)
The function called when action is stopped (if there is one).
Definition ui.h:388
int yoffset
The y offset before the character.
Definition ui.h:62
int width
.
Definition ui.h:59
uint32_t uID
The ID inside of UIMenu.text_boxes.
Definition ui.h:263
char * text
The characters to render.
Definition ui.h:265
vec4 fill
The fill of the text.
Definition text.vert:19
size_t glyph_count
The amount of Glyphs.
Definition ui.h:79
vec2 scroll_offset
The current offset from .
Definition ui.h:230
vec4 fill
Unused.
Definition text.vert:43
size_t box_count
The amount of TextBoxes contained.
Definition ui.h:241
uint32_t pad0
Definition ui.h:105
uint state
Definition text.vert:14
int element
Which UIElement owns this UIContainer.
Definition ui.h:243
vec2 scale
The scale for this box on the GPU.
Definition ui.h:280
vec2 drag_mouse_start
The mouse position on initial drag.
Definition ui.h:430
void(*) action_fn(void *)
The function called on action (if there is one).
Definition ui.h:387
int children[1024]
The IDs for UIElements contained.
Definition ui.h:238
vec2 scale
Definition ui.h:136
uint32_t pad2
Definition ui.h:107
vec2 shadow_dir
Definition ui.h:129
void * data
The bind data.
Definition ui.h:390
size_t child_count
The amount of UIElements contained.
Definition ui.h:239
UIValueBehavior behavior
The control upon reaching min or max.
Definition ui.h:346
bool free
If this TextBox is empty and can be overwritten.
Definition ui.h:261
bool free
If the UIElement can be replaced or is empty.
Definition ui.h:512
uint32_t uID
The ID inside of UIMenu.
Definition ui.h:514
size_t texture
The Image ID.
Definition ui.h:77
char id[256]
The unique name of this menu.
Definition ui.h:565
uint visible
Definition text.vert:33
vec2 dir
The direction it slides in.
Definition ui.h:408
int box_children[1024]
The IDs of TextBoxes contained.
Definition ui.h:240
int highest_dist
Used to determine the amount of space to cursor shift for newlines.
Definition ui.h:83
UIValue val
The value to change.
Definition ui.h:386
int menu
The UIMenu that this box is within.
Definition ui.h:289
float max_proj
The maximum projected scalar value.
Definition ui.h:452
uint shadow
Definition text.vert:9
vec2 base_pos
Where the element was before it was scrolled or manipulated somehow.
Definition ui.h:522
float u0
.
Definition ui.h:55
vec2 shadow_dir
Unused.
Definition text.vert:39
float radius
The radius of the circle OR the radius of a rectangle's corners.
Definition text.vert:47
float drag_start_scalar
The scalar value the slider starts at based on initial drag position.
Definition ui.h:443
int tex_h
The texture dimensions.
Definition ui.h:81
vec2 pos
Definition ui.h:127
uint32_t hovered
Definition ui.h:98
uint32_t state
Definition ui.h:104
float text_size
The size to render the Font.
Definition ui.h:267
uint visible
Definition text.vert:7
vec4 color
Color of the shape.
Definition text.vert:42
uint32_t shadow
Definition ui.h:125
void * data
The data, which may be simply a pointer that is passed into a function instead of manipulated directl...
Definition ui.h:372
float max_val
The maximum value of the slider.
Definition ui.h:427
int highest_y
Used to determine the amount of space to cursor shift for newlines.
Definition ui.h:82
float shadow_dist
How far the drop shadow is.
Definition text.vert:10
float shadow_dist
Definition ui.h:126
float u1
.
Definition ui.h:57
int get_ui_element_from_coords(vec2 pos, int *menu_idx)
Finds a UIElement based on a screen position.
Definition ui.c:570
void assign_element_to_container(UIElement *el, UIContainer *c)
Assigns a UIElement to be parented to a UIContainer.
Definition ui.c:367
const char * JUSTIFY_NAMES[]
The names of Justify for the Editor UI.
Definition ui.h:170
#define MAX_UI_ELEMENTS
Definition ui.h:33
#define MAX_TEXT_BOXES
Definition ui.h:37
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.
Definition ui.c:329
int move_element_to_menu(int element_idx, int current_menu, int target_menu)
Moves a UIElement from its current UIMenu to another UIMenu.
Definition ui.c:299
UIState
UIStates for UIElements.
Definition ui.h:187
UIValueType
Types of values that may be controlled by a UI event function pointer.
Definition ui.h:313
void delete_ui_element(int menu, int id)
Deletes a UIElement, removing it from its possible parent UIContainer and deleting its own possible U...
Definition ui.c:176
void remove_element_from_container(UIContainer *c, UIElement *el)
Removes a UIElement from a UIContainer.
Definition ui.c:139
int create_ui_element(int menu_id)
Creates a UIElement on a given UIMenu.
Definition ui.c:39
UIValueBehavior
Types of ways that UIValues may be controlled when they reach a minimum or maximum value.
Definition ui.h:329
#define MAX_UI_CONTAINERS
Definition ui.h:34
int find_text_box_in_menu(UIMenu *m, const char *id)
Finds a TextBox inside of a UIMenu via name.
Definition ui.c:261
UICallback DEFAULT_CALLBACK
Definition ui.h:579
UIElement DEFAULT_UI_ELEMENT
Definition ui.h:593
UIInteractableType
UIElement types for the union that describe unique functions.
Definition ui.h:198
TextBox DEFAULT_TEXT_BOX
Definition ui.h:661
UIContainer DEFAULT_UI_CONTAINER
Definition ui.h:642
void update_ui_state(float mouse_x, float mouse_y)
Handles the persistent UI state from previous frames.
Definition ui.c:816
void align_text_box_label(UIElement *el)
Aligns a TextBox inside of a UILabel based on its Justify.
Definition ui.c:410
Vector MENUS
All UIMenus.
Definition ui.c:13
void create_slider(UIElement *element, vec2 dir, float len)
Creates a UISlider from a UIElement.
Definition ui.c:682
void delete_ui_container(UIElement *el)
Deletes a UIContainer, removing all references to it from existing TextBoxes and UIElements on the sa...
Definition ui.c:68
#define MAX_UI_CHILDREN
Definition ui.h:39
int TEXT_HEIGHT
Definition ui.c:12
int find_container_in_menu(UIMenu *m, const char *id)
Finds a UIContainer inside of a UIMenu via name.
Definition ui.c:280
const char * UI_INTERACTABLE_NAMES[]
UIElement interactable names for the union that describe unique functions.
Definition ui.h:211
UILabel DEFAULT_LABEL
Definition ui.h:632
void UI_INIT()
Simply frees the MENUS buffer and reinitializes the Vector.
Definition ui.h:864
void remove_text_box_from_container(UIContainer *c, TextBox *tb)
Removes a TextBox from a UIContainer.
Definition ui.c:157
void reassign_elements_to_container(UIElement *el)
Assigns all children based on current UIContainer children.
Definition ui.c:114
UIContainer * create_ui_container(UIElement *el, int menu_id)
Creates a UIContainer from a given UIElement a given UIMenu.
Definition ui.c:197
#define UI_SCALE_HEIGHT
Definition ui.h:36
#define UI_SCALE_WIDTH
Definition ui.h:35
Justify
Options for Justifying TextBoxes inside of containers but also around the origin .
Definition ui.h:152
UIMenu * create_menu()
Creates a new UIMenu, expanding the MENUS Vector and sets all arrays to free.
Definition ui.h:875
void assign_text_box_to_container(TextBox *tb, UIContainer *c)
Assigns a TextBox to be parented to a UIContainer.
Definition ui.c:388
int TEXT_WIDTH
Definition ui.c:11
int find_ui_element_in_menu(UIMenu *m, const char *id)
Finds a UIElement inside of a UIMenu via name.
Definition ui.c:242
void compute_slider_bounds(UIElement *element)
Computes the minimum and maximum in UI space for a UISlider.
Definition ui.c:663
bool container_is_valid(int container, int menu)
Checks if a UIContainer and UIMenu ID pairing is valid.
Definition ui.h:905
UIElementType
Types of SDF shapes that are handled on the GPU.
Definition ui.h:302
void handle_ui_event(SDL_Event event, int mouse_x, int mouse_y)
Handles an incoming UI event.
Definition ui.c:696
vec2 screenspace_to_ui(vec2 pos)
Transfers a position to local UI space by multiplying it by a ratio of the two resolutions.
Definition ui.h:934
UISlider DEFAULT_SLIDER
Definition ui.h:620
int get_text_box_from_coords(vec2 pos, int *menu_idx)
Finds a TextBox based on a screen position.
Definition ui.c:515
@ UISTATE_NONE
Definition ui.h:188
@ UISTATE_SELECTED
If the UIElement is selected in the Editor.
Definition ui.h:191
@ UISTATE_PRESSED
Definition ui.h:190
@ UISTATE_HOVERED
Definition ui.h:189
@ UIVAL_INT
Definition ui.h:317
@ UIVAL_CALLBACK
Definition ui.h:319
@ UIVAL_NONE
Definition ui.h:315
@ UIVAL_FLOAT
Definition ui.h:318
@ UIVAL_BOOL
Definition ui.h:316
@ UIVALBEHAVIOR_WRAP
Definition ui.h:332
@ UIVALBEHAVIOR_NONE
Definition ui.h:331
@ UIVALBEHAVIOR_CLAMP
Definition ui.h:333
@ UI_INTERACTABLE_MAX
Definition ui.h:204
@ UI_INTERACTABLE_SLIDER
UISlider that can interpolate on a plane.
Definition ui.h:201
@ UI_INTERACTABLE_LABEL
References a TextBox that is Justified.
Definition ui.h:203
@ UI_INTERACTABLE_NONE
Normal UIElement.
Definition ui.h:200
@ UI_INTERACTABLE_DROPDOWN
Unfinished type.
Definition ui.h:202
@ JUSTIFY_MAX
Definition ui.h:163
@ JUSTIFY_RIGHT
Definition ui.h:156
@ JUSTIFY_TOP_LEFT
Definition ui.h:158
@ JUSTIFY_LEFT
Definition ui.h:155
@ JUSTIFY_BOTTOM_LEFT
Definition ui.h:161
@ JUSTIFY_TOP_RIGHT
Definition ui.h:159
@ JUSTIFY_CENTER
Definition ui.h:154
@ JUSTIFY_BOTTOM_CENTER
Definition ui.h:160
@ JUSTIFY_BOTTOM_RIGHT
Definition ui.h:162
@ JUSTIFY_TOP_CENTER
Definition ui.h:157
@ UIELEMENT_CIRCLE
Definition ui.h:303
@ UIELEMENT_RECT
Definition ui.h:303
@ UIELEMENT_TYPE_MAX
Definition ui.h:303
A Font and its Glyphs used for rendering TextBoxes.
Definition ui.h:74
A single Glyph in a Font.
Definition ui.h:52
A structure holding a Font ID and text to be rendered and transformed with its properties.
Definition text.vert:5
The GPU-side representation of a TextBox.
Definition ui.h:95
Describes function pointers for UIElements that determine behavior on events.
Definition ui.h:382
UIContainer that contains both TextBoxes and UIElements and can mask and scroll them.
Definition ui.h:225
Unfinished structure for a dropdown that spawns UIElements and TextBoxes when opened.
Definition ui.h:461
UIElements that are contained within a UIMenu that may receive events, be contained within UIContaine...
Definition text.vert:31
The GPU-side representation of a UIElement.
Definition ui.h:121
UIElement UILabels that contain a TextBox reference.
Definition ui.h:490
The top-most UI structure that contains UIElements, TextBoxes, and UIContainers.
Definition ui.h:562
UIElement sliders that interpolate between two points on a line.
Definition ui.h:406
A value that is manipulated in some way when a UIElement receives an event.
Definition ui.h:343
float x
Definition types.h:11
float y
Definition types.h:11
size_t count
Definition types.h:209
void * buffer
Definition types.h:210
Definition types.h:21
Definition types.h:11
Definition types.h:13
void init_vector(Vector *v, size_t i, size_t type_size)
Definition utilities.c:74
void * vector_expand(Vector *v, size_t i)
Definition utilities.c:49
#define CAST_VEC(vec, type)
Definition utilities.h:134