From c2ea095659dea04663b83fe5313173f209c9bb0b Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Sat, 23 May 2026 10:55:01 -0400 Subject: tyui text input boxes --- dc/dc.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'dc/dc.c') 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(); } -- cgit v1.3-2-g0d8e