ATTRIB(XonoticSlider, cvarName, string, string_null)
METHOD(XonoticSlider, loadCvars, void(entity))
METHOD(XonoticSlider, saveCvars, void(entity))
+ ATTRIB(XonoticSlider, sendCvars, float, 0)
ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
return me;
}
-void configureXonoticSliderXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
+void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
{
- float v, vk, vp;
- v = theValueMin;
- vk = theValueStep;
+ float vp;
vp = theValueStep * 10;
while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
vp *= 10;
+
me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
- me.configureSliderValues(me, theValueMin, v, theValueMax, theValueStep, vk, vp);
+
if(theCvar)
{
+ // Prevent flickering of the slider button by initialising the
+ // slider out of bounds to hide the button before loading the cvar
+ me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
me.cvarName = theCvar;
me.loadCvars(me);
- if(tooltipdb >= 0)
- me.tooltip = getZonedTooltipForIdentifier(theCvar);
+ me.tooltip = getZonedTooltipForIdentifier(theCvar);
}
+ else
+ me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
}
-void setValueXonoticSlider(entity me, float val)
+void XonoticSlider_setValue(entity me, float val)
{
if(val != me.value)
{
- setValueSlider( me, val );
+ SUPER(XonoticSlider).setValue( me, val );
me.saveCvars(me);
}
}
-void loadCvarsXonoticSlider(entity me)
+void XonoticSlider_loadCvars(entity me)
{
- if not(me.cvarName)
+ if (!me.cvarName)
return;
me.setValue( me, cvar(me.cvarName) );
}
-void saveCvarsXonoticSlider(entity me)
+void XonoticSlider_saveCvars(entity me)
{
- if not(me.cvarName)
+ if (!me.cvarName)
return;
cvar_set(me.cvarName, ftos(me.value));
+
+ CheckSendCvars(me, me.cvarName);
}
#endif