Custom immediate-mode graphical widget drawing routines.
More...
#include <stddef.h>
#include "gui_platform.h"
Go to the source code of this file.
|
| int | Gr_DrawButton (GrRect bounds, const char *label, int enabled) |
| | Renders a custom clickable button. More...
|
| |
| int | Gr_DrawRadioButton (float x, float y, int selected, const char *label) |
| | Renders a standard circular radio button with associated text label. More...
|
| |
| int | Gr_DrawTextBox (GrRect bounds, char *text, size_t cap, int active, const char *placeholder) |
| | Renders an interactive input text box. More...
|
| |
| void | Gr_DrawTextInBox (GrRect bounds, const char *text, int font_size, GrColor color) |
| | Utility helper to draw text aligned within a bounding box. More...
|
| |
| int | Gr_DrawCustomSwitch (float x, float y, float w, float h, int active, const char *label) |
| | Draws a slide switch toggle. More...
|
| |
| int | Gr_DrawSegmentedControl (GrRect bounds, const char *opts[], int count, int selected) |
| | Renders a segmented selector bar containing multiple text labels. More...
|
| |
| int | Gr_DrawCustomDropdown (GrRect bounds, const char *label, const char *items[], int count, int *selected, int *open) |
| | Draws a custom drop-down menu selection modal. More...
|
| |
| int | Gr_DrawCustomDropdownScrollable (GrRect bounds, const char *label, const char *items[], int count, int *selected, int *open, int *scroll, int max_visible) |
| | Extended custom dropdown featuring scrollbars for long list selections. More...
|
| |
Custom immediate-mode graphical widget drawing routines.
◆ Gr_DrawButton()
| int Gr_DrawButton |
( |
GrRect |
bounds, |
|
|
const char * |
label, |
|
|
int |
enabled |
|
) |
| |
Renders a custom clickable button.
- Parameters
-
| bounds | Button position and size. |
| label | Text printed on the button. |
| enabled | 1 to allow clicks, 0 to draw grayed out and ignore input. |
- Returns
- 1 if the button was clicked during this frame; 0 otherwise.
◆ Gr_DrawCustomDropdown()
| int Gr_DrawCustomDropdown |
( |
GrRect |
bounds, |
|
|
const char * |
label, |
|
|
const char * |
items[], |
|
|
int |
count, |
|
|
int * |
selected, |
|
|
int * |
open |
|
) |
| |
Draws a custom drop-down menu selection modal.
- Parameters
-
| bounds | Outer selector box boundaries. |
| label | Display text of the active selection when closed. |
| items | Array of options to display when expanded. |
| count | Number of items in array. |
| selected | Pointer to selection index value (mutated in place). |
| open | Pointer to boolean toggle tracking expansion state (mutated in place). |
- Returns
- 1 if selection changed; 0 otherwise.
◆ Gr_DrawCustomDropdownScrollable()
| int Gr_DrawCustomDropdownScrollable |
( |
GrRect |
bounds, |
|
|
const char * |
label, |
|
|
const char * |
items[], |
|
|
int |
count, |
|
|
int * |
selected, |
|
|
int * |
open, |
|
|
int * |
scroll, |
|
|
int |
max_visible |
|
) |
| |
Extended custom dropdown featuring scrollbars for long list selections.
- Parameters
-
| bounds | Outer selector box boundaries. |
| label | Display text of the active selection when closed. |
| items | Array of options to display when expanded. |
| count | Number of items in array. |
| selected | Pointer to selection index value (mutated in place). |
| open | Pointer to boolean toggle tracking expansion state (mutated in place). |
| scroll | Pointer to scroll offset value (mutated in place). |
| max_visible | Maximum items to draw before triggering scrollbars. |
- Returns
- 1 if selection changed; 0 otherwise.
◆ Gr_DrawCustomSwitch()
| int Gr_DrawCustomSwitch |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
w, |
|
|
float |
h, |
|
|
int |
active, |
|
|
const char * |
label |
|
) |
| |
Draws a slide switch toggle.
- Parameters
-
| x | Left coordinate. |
| y | Top coordinate. |
| w | Width. |
| h | Height. |
| active | 1 if switch is turned on, 0 if turned off. |
| label | Toggle description label. |
- Returns
- 1 if switch state was toggled during this frame; 0 otherwise.
◆ Gr_DrawRadioButton()
| int Gr_DrawRadioButton |
( |
float |
x, |
|
|
float |
y, |
|
|
int |
selected, |
|
|
const char * |
label |
|
) |
| |
Renders a standard circular radio button with associated text label.
- Parameters
-
| x | Horizontal center coordinate. |
| y | Vertical center coordinate. |
| selected | 1 if active, 0 otherwise. |
| label | Text printed next to the radio button. |
- Returns
- 1 if the radio button was clicked during this frame; 0 otherwise.
◆ Gr_DrawSegmentedControl()
| int Gr_DrawSegmentedControl |
( |
GrRect |
bounds, |
|
|
const char * |
opts[], |
|
|
int |
count, |
|
|
int |
selected |
|
) |
| |
Renders a segmented selector bar containing multiple text labels.
- Parameters
-
| bounds | Segment container boundaries. |
| opts | Array of label strings representing selectable segments. |
| count | Number of options. |
| selected | Currently active selection index. |
- Returns
- Newly selected segment index, or the original index if no change occurred.
◆ Gr_DrawTextBox()
| int Gr_DrawTextBox |
( |
GrRect |
bounds, |
|
|
char * |
text, |
|
|
size_t |
cap, |
|
|
int |
active, |
|
|
const char * |
placeholder |
|
) |
| |
Renders an interactive input text box.
- Parameters
-
| bounds | Text box coordinates. |
| text | Buffer storing active characters (mutated in place). |
| cap | Maximum capacity of the text buffer. |
| active | 1 if text box has keyboard focus, 0 otherwise. |
| placeholder | Text displayed when the buffer is empty. |
- Returns
- 1 if keyboard focus state changed or text was edited; 0 otherwise.
◆ Gr_DrawTextInBox()
| void Gr_DrawTextInBox |
( |
GrRect |
bounds, |
|
|
const char * |
text, |
|
|
int |
font_size, |
|
|
GrColor |
color |
|
) |
| |
Utility helper to draw text aligned within a bounding box.
- Parameters
-
| bounds | Outer bounding rectangle. |
| text | Message to draw. |
| font_size | Height of font characters in pixels. |
| color | Text color. |