diff options
| author | iamcheeseman <[email protected]> | 2026-05-18 21:06:42 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-18 21:06:42 -0400 |
| commit | 51a249763e2a28a0c0a0f182fb3752aac9380317 (patch) | |
| tree | 3ff4f552e2ba8e372a222eff3b9791702be67c65 /teensy/teensy_ui.c | |
| parent | dcfe8e6f08b1722639ad8e64db7553c60d3c7d11 (diff) | |
add rounding to sliders
Diffstat (limited to 'teensy/teensy_ui.c')
| -rw-r--r-- | teensy/teensy_ui.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c index e8d71eb..918d203 100644 --- a/teensy/teensy_ui.c +++ b/teensy/teensy_ui.c @@ -1,6 +1,7 @@ #include "teensy_ui.h" #include <assert.h> +#include <math.h> #include <stdarg.h> #include "teensy_list.h" @@ -417,6 +418,7 @@ void tyui_slider(float min, float max, float step, float *value) if (hovered && ty_button_down(TY_BTN_DB_LMB)) { float new_val = (float)(mouse_pos.x - bar_rect.x) / bar_rect.w * (max - min) + min; + new_val = round(new_val / step) * step; *value = new_val; } } |
