]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider.c
Merge branch 'master' into samual/combined_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider.c
index 331a226f45c242fb1c75f803afddad1d01fbca0d..d63fe1c336c8ae2d2577803b67bd12cbfe59b5cb 100644 (file)
@@ -34,20 +34,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)
 {