2 CLASS(XonoticSlider) EXTENDS(Slider)
3 METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string))
4 METHOD(XonoticSlider, setValue, void(entity, float))
5 ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
6 ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
7 ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
8 ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
9 ATTRIB(XonoticSlider, align, float, 0.5)
10 ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
11 ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
12 ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
13 ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
14 ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
16 ATTRIB(XonoticSlider, cvarName, string, string_null)
17 METHOD(XonoticSlider, loadCvars, void(entity))
18 METHOD(XonoticSlider, saveCvars, void(entity))
19 ATTRIB(XonoticSlider, sendCvars, float, 0)
21 ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
22 ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
23 ENDCLASS(XonoticSlider)
24 entity makeXonoticSlider(float, float, float, string);
28 entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
31 me = spawnXonoticSlider();
32 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
35 void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
38 vp = theValueStep * 10;
39 while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
42 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
46 // Prevent flickering of the slider button by initialising the
47 // slider out of bounds to hide the button before loading the cvar
48 me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
49 me.cvarName = theCvar;
51 me.tooltip = getZonedTooltipForIdentifier(theCvar);
54 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
56 void XonoticSlider_setValue(entity me, float val)
60 SUPER(XonoticSlider).setValue( me, val );
64 void XonoticSlider_loadCvars(entity me)
69 me.setValue( me, cvar(me.cvarName) );
71 void XonoticSlider_saveCvars(entity me)
76 cvar_set(me.cvarName, ftos(me.value));
78 CheckSendCvars(me, me.cvarName);