]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/util.qc
Listbox / Picker: Implement item fading in a different way so that it gets influenced...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / util.qc
index 58d1d934f521f4e6d1624c7e4424ce7b8beeb09f..a80b03fe1890d8dd47d4976f4cd87c5f05fd5c48 100644 (file)
@@ -768,19 +768,13 @@ void dialog_hudpanel_common_notoggle(entity me, string panelname)
                                e.configureXonoticTextSliderValues(e);
 }
 
                                e.configureXonoticTextSliderValues(e);
 }
 
-#define FADE_TIME 0.5
-#define TRESHOLD_TIME 0.1
-float getHighlightAlpha(float startAlpha, float targetAlpha, float highlightedTime)
+float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
 {
 {
-       float theAlpha;
-       if((time - highlightedTime - TRESHOLD_TIME) < FADE_TIME)
-       {
-               float f = max(0, (time - highlightedTime - TRESHOLD_TIME) / FADE_TIME);
-               theAlpha = startAlpha + f * (targetAlpha - startAlpha);
-       }
+       if(startAlpha < targetAlpha)
+               currentAlpha = min(currentAlpha + frametime * 0.5, targetAlpha);
        else
        else
-               theAlpha = targetAlpha;
-       return theAlpha;
+               currentAlpha = max(currentAlpha - frametime * 0.5, targetAlpha);
+       return currentAlpha;
 }
 
 void CheckSendCvars(entity me, string cvarnamestring)
 }
 
 void CheckSendCvars(entity me, string cvarnamestring)