and yet more cleanup...
This commit is contained in:
parent
26e855369d
commit
cf43538518
16 changed files with 80 additions and 107 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "pxl8_gfx.h"
|
||||
#include "pxl8_math.h"
|
||||
#include "pxl8_gui_palette.h"
|
||||
#include "pxl8_mem.h"
|
||||
|
||||
|
|
@ -132,9 +133,7 @@ bool pxl8_gui_slider(pxl8_gui_state* state, pxl8_gfx* gfx, u32 id, i32 x, i32 y,
|
|||
}
|
||||
|
||||
if (is_active && state->cursor_down) {
|
||||
f32 t = (f32)(state->cursor_x - x) / (f32)w;
|
||||
if (t < 0.0f) t = 0.0f;
|
||||
if (t > 1.0f) t = 1.0f;
|
||||
f32 t = pxl8_clamp((f32)(state->cursor_x - x) / (f32)w, 0.0f, 1.0f);
|
||||
f32 new_val = min_val + t * (max_val - min_val);
|
||||
if (new_val != *value) {
|
||||
*value = new_val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue