3 CLASS(XonoticSlider, Slider)
4 METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string))
5 METHOD(XonoticSlider, setValue, void(entity, float))
6 ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
7 ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
8 ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
9 ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
10 ATTRIB(XonoticSlider, align, float, 0.5)
11 ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
12 ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
13 ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
14 ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
15 ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
17 ATTRIB(XonoticSlider, cvarName, string, string_null)
18 METHOD(XonoticSlider, loadCvars, void(entity))
19 METHOD(XonoticSlider, saveCvars, void(entity))
20 ATTRIB(XonoticSlider, sendCvars, float, 0)
22 ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
23 ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
24 ENDCLASS(XonoticSlider)
25 entity makeXonoticSlider(float, float, float, string);
29 entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
32 me = NEW(XonoticSlider);
33 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
36 void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
39 vp = theValueStep * 10;
40 while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
43 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
47 // Prevent flickering of the slider button by initialising the
48 // slider out of bounds to hide the button before loading the cvar
49 me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
50 me.cvarName = theCvar;
52 me.tooltip = getZonedTooltipForIdentifier(theCvar);
55 me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
57 void XonoticSlider_setValue(entity me, float val)
61 SUPER(XonoticSlider).setValue( me, val );
65 void XonoticSlider_loadCvars(entity me)
70 me.setValue( me, cvar(me.cvarName) );
72 void XonoticSlider_saveCvars(entity me)
77 cvar_set(me.cvarName, ftos(me.value));
79 CheckSendCvars(me, me.cvarName);