diff options
| author | aura <nw@moneybot.cc> | 2026-03-20 20:21:24 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-20 20:21:24 +0100 |
| commit | 8099c2a11fb4010542973bf85359935da19e2192 (patch) | |
| tree | 13f05312aa19e87c9357faeec7f84f864166ab57 /src/gui | |
| parent | a156bc15880e9e250c9c40f0dde431e077109dc1 (diff) | |
move multiple objects
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/base.h | 6 | ||||
| -rw-r--r-- | src/gui/floatinput.cpp | 9 | ||||
| -rw-r--r-- | src/gui/vectorinput.cpp | 10 |
3 files changed, 19 insertions, 6 deletions
diff --git a/src/gui/base.h b/src/gui/base.h index 0418afd..1a1c4cb 100644 --- a/src/gui/base.h +++ b/src/gui/base.h @@ -95,7 +95,8 @@ extern struct GUI_VECTORINPUT* gui_vectorinput( F32 max, F32 step = 1.f, const char* letters = "xyzw", - const char* printfmt = "%.2f" + const char* printfmt = "%.2f", + U8 showval = 1 ); extern struct GUI_COLORINPUT* gui_colorinput( @@ -234,6 +235,7 @@ struct GUI_FLOATINPUT : GUI_BASE { I32 lastmx; U8 heldoutbounds; U8 held; + U8 drawval; // for color sliders CLR bgcol; @@ -329,7 +331,7 @@ struct __gui_internal { GL_BATCH2D* batch; }; -void __gui_internal_vectorinput_init( +extern void __gui_internal_vectorinput_init( GUI_VECTORINPUT* input, I32 x, I32 y, I32 w, const char* title, diff --git a/src/gui/floatinput.cpp b/src/gui/floatinput.cpp index 5ce92fe..095c562 100644 --- a/src/gui/floatinput.cpp +++ b/src/gui/floatinput.cpp @@ -111,11 +111,13 @@ void gui_floatinput_draw_unbound( GUI_FLOATINPUT* input ) { F32 val = *input->pval; gui_draw_str( x + 2, y + 2, ALIGN_L, FNT_JPN12, ui_clr.txt, input->name ); - gui_draw_str( x + w - 2, y + 2, ALIGN_R, FNT_JPN12, ui_clr.txt, input->valfmt, val ); + if( input->drawval ) + gui_draw_str( x + w - 2, y + 2, ALIGN_R, FNT_JPN12, ui_clr.txt, input->valfmt, val ); - I32 t1w, t2w, t3w; + I32 t1w, t2w = 0, t3w; gui_draw_get_str_bounds( &t1w, 0, FNT_JPN12, input->name ); - gui_draw_get_str_bounds( &t2w, 0, FNT_JPN12, input->valfmt, val ); + if( input->drawval ) + gui_draw_get_str_bounds( &t2w, 0, FNT_JPN12, input->valfmt, val ); gui_draw_get_str_bounds( &t3w, 0, FNT_JPN12, "<->" ); I32 stw = t2w + t3w - 2; @@ -336,6 +338,7 @@ struct GUI_FLOATINPUT* gui_floatinput( I32 x, I32 y, I32 w, const char* title, F input->max = max; input->step = step; input->valfmt = valfmt; + input->drawval = 1; input->wraparound = 0; input->customclr = 0; diff --git a/src/gui/vectorinput.cpp b/src/gui/vectorinput.cpp index daed540..ad28c0d 100644 --- a/src/gui/vectorinput.cpp +++ b/src/gui/vectorinput.cpp @@ -106,7 +106,8 @@ GUI_VECTORINPUT* gui_vectorinput( F32 max, F32 step, const char* letters, - const char* printfmt + const char* printfmt, + U8 showval ) { if( !gui_check_target() ) return 0; if( valc > 25 ) { @@ -128,5 +129,12 @@ GUI_VECTORINPUT* gui_vectorinput( printfmt ); + if( !showval ) { + for( auto& it : input->inputview->children ) { + GUI_FLOATINPUT* f = (GUI_FLOATINPUT*)it; + f->drawval = 0; + } + } + return input; } |
