]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/maplist.qc
Listbox / Picker: Implement item fading in a different way so that it gets influenced...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / maplist.qc
index 4003a36d78f682a894a3a0ef9596d0f72bfc8f95..1e2039b795d0f89761260b1e8547267dc8d28415 100644 (file)
@@ -3,7 +3,7 @@ CLASS(XonoticMapList) EXTENDS(XonoticListBox)
        METHOD(XonoticMapList, configureXonoticMapList, void(entity))
        ATTRIB(XonoticMapList, rowsPerItem, float, 4)
        METHOD(XonoticMapList, draw, void(entity))
-       METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, float))
+       METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
        METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
        METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
@@ -159,7 +159,7 @@ void XonoticMapList_doubleClickListBoxItem(entity me, float i, vector where)
                }
 }
 
-void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        // layout: Ping, Map name, Map name, NP, TP, MP
        string s;
@@ -181,8 +181,11 @@ void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSel
        {
                if(included)
                        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG);
-               if(highlightedTime)
-                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+               if(isFocused)
+               {
+                       me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+                       draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
+               }
        }
 
        if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0')