3 entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
6 me = NEW(XonoticSlider);
7 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar, theTooltip);
10 entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
12 return makeXonoticSlider_T(theValueMin, theValueMax, theValueStep, theCvar, string_null);
14 void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
17 vp = theValueStep * 10;
18 while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
21 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
23 me.controlledCvar = (theCvar) ? theCvar : string_null;
25 // Prevent flickering of the slider button by initialising the
26 // slider out of bounds to hide the button before loading the cvar
27 me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
29 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
31 setZonedTooltip(me, theTooltip, theCvar);
33 void XonoticSlider_setValue(entity me, float val)
37 SUPER(XonoticSlider).setValue( me, val );
41 void XonoticSlider_setValue_noAnim(entity me, float val)
45 SUPER(XonoticSlider).setValue_noAnim(me, val);
49 void XonoticSlider_loadCvars(entity me)
51 if (!me.controlledCvar)
54 me.setValue_noAnim(me, cvar(me.controlledCvar));
56 void XonoticSlider_saveCvars(entity me)
58 if (!me.controlledCvar)
61 cvar_set(me.controlledCvar, ftos_mindecimals(me.value));
63 CheckSendCvars(me, me.controlledCvar);