aboutsummaryrefslogtreecommitdiff
path: root/dc
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-23 10:55:01 -0400
committeriamcheeseman <[email protected]>2026-05-23 10:55:01 -0400
commitc2ea095659dea04663b83fe5313173f209c9bb0b (patch)
tree9e9d79902a442bdf1bb2ef6b38507217574b673e /dc
parent5d36dcd67478cdb235f39d2aecb3270aba954001 (diff)
tyui text input boxes
Diffstat (limited to 'dc')
-rw-r--r--dc/dc.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/dc/dc.c b/dc/dc.c
index aed4a7c..b0da900 100644
--- a/dc/dc.c
+++ b/dc/dc.c
@@ -69,7 +69,7 @@ void tick(void)
if (tyui_begin_window("Test Window", ty_recti(5, 5, 100, 120), &winid1)) {
tyui_button("before");
- tyui_push_layout((float[]){-50, -1, 0});
+ tyui_push_layout((float[]){-49, -1, 0});
tyui_push_layout((float[]){-1, 0});
tyui_text_ex(TYUI_ALIGN_CENTER, "Buttons");
tyui_button("test1");
@@ -92,20 +92,33 @@ void tick(void)
}
if (tyui_begin_window("2nd Window", ty_recti(110, 5, 100, 120), &winid2)) {
- static float value = 100;
- tyui_slider(0, 100, &value);
- tyui_slider_ex(0, 100, &value, true, TYUI_ALIGN_LEFT);
- tyui_slider_ex(0, 100, &value, true, TYUI_ALIGN_RIGHT);
- tyui_blank_slider(0, 100, &value);
+ static bool opened = false;
- tyui_push_layout((float[]){50, -1, 0});
- tyui_slider(0, 100, &value);
- if (tyui_button("inc"))
- value++;
+ if (tyui_button("sliders"))
+ opened = !opened;
+
+ if (opened) {
+ static float value = 100;
tyui_slider(0, 100, &value);
- if (tyui_button("dec"))
- value--;
- tyui_pop_layout();
+ tyui_slider_ex(0, 100, &value, true, TYUI_ALIGN_LEFT);
+ tyui_slider_ex(0, 100, &value, true, TYUI_ALIGN_RIGHT);
+ tyui_blank_slider(0, 100, &value);
+
+ tyui_push_layout((float[]){50, -1, 0});
+ tyui_slider(0, 100, &value);
+ if (tyui_button("inc"))
+ value++;
+ tyui_slider(0, 100, &value);
+ if (tyui_button("dec"))
+ value--;
+ tyui_pop_layout();
+ }
+
+ static char string[16];
+ static tyui_Text_Input tinput;
+ tinput.chars = string;
+ tinput.max_len = 16;
+ tyui_text_input(&tinput);
tyui_end_window();
}