From: Severin Meyer Date: Fri, 14 Nov 2014 14:04:08 +0000 (+0100) Subject: Prevent the slider button from flickering when changing gametype X-Git-Tag: xonotic-v0.8.0~148^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=824bfa586c5812097a27916337c30564f180c0a6;p=xonotic%2Fxonotic-data.pk3dir.git Prevent the slider button from flickering when changing gametype --- diff --git a/qcsrc/menu/xonotic/slider.c b/qcsrc/menu/xonotic/slider.c index 0577207ca..aba15ecae 100644 --- a/qcsrc/menu/xonotic/slider.c +++ b/qcsrc/menu/xonotic/slider.c @@ -33,20 +33,24 @@ entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueSte } 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); me.tooltip = getZonedTooltipForIdentifier(theCvar); } + else + me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp); } void XonoticSlider_setValue(entity me, float val) {