summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/base.h6
-rw-r--r--src/gui/floatinput.cpp9
-rw-r--r--src/gui/vectorinput.cpp10
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;
}