From 2b0e522adf9cb34ca45769241c3532f16ded2f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 28 Nov 2023 14:34:34 +0100 Subject: [PATCH] improve sliders --- demos/art/gui/golden.ase | Bin 48629 -> 48623 bytes engine/joint/v4k.h | 2 +- engine/split/v4k_gui.c | 2 +- engine/v4k.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/art/gui/golden.ase b/demos/art/gui/golden.ase index 17f0297dd2aa2f54627830a86974888db4082c00..d6147fb9e45b754d9a604f86c31f3264fb4152e9 100644 GIT binary patch delta 2777 zcmYjS3pkW%8~)HitF-Ya|8Cf_U6X2*vdLl0wnR}gwX9QOky`m{oDUB@26W(uO^IUi6w7&~j}mOULj=4e;drE-Af*89z@9gdb1? zyr^r6gAapwb}2pW>$$;}z{K!;jwqYrHa*B~(0c_|iZ0Kk8%$a;ppmdTY2v(N@Y&S( zmWQG7aoc4stsH+_tkh*3cLaRjZz3k$w|*DCw;z1c7&&^%{kmNsTk)B36Fb3K#7t`5 zk3O15agVE)4zLTn40hShT|SsC2Pa)Yr{69Ho;}liC?J&*TcwO(rVj7#E!3oST z9uOQ{nr&(ac9sP&pxHRyEX2~@Q5U@tBvu^bO4J2Sr{M=oYINNYZb#Cs!S0do4!j{M zk)2syXbfhbYWov&c?UmVS)GZEjl&%bkoOZX0x^MpW@6P zQxed_G=lHwh?&9MQD3mK9V)OZu5=&A|CQg_Q`!k;vv5!BG6t#dg3tXr&o=-*UJvg@ z4T}57CD;$dH8HTE4Tw(?Drs++Lseq`v`aU6n+5rtUdOLC5^)<#g)^zSi@e}HM>+f zE9W1%VOG@Ep>I5H)U0X`2GSloD%v3@?<{P_i;7aoe~Us49!=whF%wv|*I$R=NRT5*ZrXkfc;VjRYJPKu3;sDs@*fB`*vU=bS4>_ zv2~J8!%Cevir7N&15xVUtJbUr=kv{vT*x)?NO?c+NAZuZ7otIqflV zz8b)5AMZ6t4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)XUUXRtjQmX*~=kK%< zw|;zeE%bq0L!C7MC_T74^1?4V`ucwUP)_Ch+u9SsY6_RXl@$GjW zwQ;KGc$I0>nfR)2&QF2@s}8-H-e1yJmgn4Zm_+?4tG0&EaMzk}ct=kzuAZ&)0TjT%Z!!nW0)MrL=J>cFRk4Vt^Q zkKy!|?S4-{^p{*VT-))_g`uaaip$O&(0`UNPUkbww~)8bG*tAKltjVEz-5f$4Lh) jPL^JcxkE-cT=?;ylXqU|9tmS)em;UpQfcjv`NsH9|LUpS diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 62d6a58..5ca9f9d 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -359072,7 +359072,7 @@ bool gui_slider_id(int id, vec4 rect, const char *skin, float min, float max, fl *value = posx2slider(usablerect, min, max, input(MOUSE_X), step); } float sliderx = slider2posx(min, max, *value, step, usablerect.z); - vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.5f, (slidersize.y*.5f - cursorsize.y*.5f)); + vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.75f, (slidersize.y*.5f - cursorsize.y*.5f)); vec4 cursorrect = rect; cursorrect.x += cursorpos.x; cursorrect.y += cursorpos.y; diff --git a/engine/split/v4k_gui.c b/engine/split/v4k_gui.c index 2811546..1fbf33f 100644 --- a/engine/split/v4k_gui.c +++ b/engine/split/v4k_gui.c @@ -227,7 +227,7 @@ bool gui_slider_id(int id, vec4 rect, const char *skin, float min, float max, fl *value = posx2slider(usablerect, min, max, input(MOUSE_X), step); } float sliderx = slider2posx(min, max, *value, step, usablerect.z); - vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.5f, (slidersize.y*.5f - cursorsize.y*.5f)); + vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.75f, (slidersize.y*.5f - cursorsize.y*.5f)); vec4 cursorrect = rect; cursorrect.x += cursorpos.x; cursorrect.y += cursorpos.y; diff --git a/engine/v4k.c b/engine/v4k.c index 8ff251a..9d0ebc9 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -11237,7 +11237,7 @@ bool gui_slider_id(int id, vec4 rect, const char *skin, float min, float max, fl *value = posx2slider(usablerect, min, max, input(MOUSE_X), step); } float sliderx = slider2posx(min, max, *value, step, usablerect.z); - vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.5f, (slidersize.y*.5f - cursorsize.y*.5f)); + vec2 cursorpos = vec2(sliderx+usablerect.x*.5f-cursorsize.x*.75f, (slidersize.y*.5f - cursorsize.y*.5f)); vec4 cursorrect = rect; cursorrect.x += cursorpos.x; cursorrect.y += cursorpos.y;