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) {
22 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
24 me.cvarName = (theCvar) ? theCvar : string_null;
26 // Prevent flickering of the slider button by initialising the
27 // slider out of bounds to hide the button before loading the cvar
28 me.configureSliderValues(me, theValueMin, theValueMin - theValueStep, theValueMax, theValueStep, theValueStep, vp);
30 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
33 setZonedTooltip(me, theTooltip, theCvar);
35 void XonoticSlider_setValue(entity me, float val)
37 if (val != me.value) {
38 SUPER(XonoticSlider).setValue(me, val);
42 void XonoticSlider_setValue_noAnim(entity me, float val)
44 if (val != me.value) {
45 SUPER(XonoticSlider).setValue_noAnim(me, val);
49 void XonoticSlider_loadCvars(entity me)
55 me.setValue_noAnim(me, cvar(me.cvarName));
57 void XonoticSlider_saveCvars(entity me)
63 cvar_set(me.cvarName, ftos_mindecimals(me.value));
65 CheckSendCvars(me, me.cvarName);