]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/playlist.qc
Listbox / Picker: Implement item fading in a different way so that it gets influenced...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / playlist.qc
index 18b4fc3fae944b21c0ea6b1e4c20b190ac5d53ab..b297489304d03fdb75ac238dbd1a0f83f2ce4c4f 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
        METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticPlayList, draw, void(entity))
-       METHOD(XonoticPlayList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticPlayList, stopSound, void(entity))
        METHOD(XonoticPlayList, startSound, void(entity, float))
        METHOD(XonoticPlayList, resumeSound, void(entity))
@@ -88,7 +88,7 @@ void XonoticPlayList_addToPlayList(entity me, string track)
 
 void XonoticPlayList_removeSelectedFromPlayList(entity me)
 {
-       float i, cpt = FALSE;
+       float i, cpt = false;
        string s = "";
        me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
        if(me.nItems == 0)
@@ -102,7 +102,7 @@ void XonoticPlayList_removeSelectedFromPlayList(entity me)
                        if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
                        {
                                if(cvar("music_playlist_current0") == i)
-                                       cpt = TRUE; // current playing track (we can't start next track here because startSound calls tokenize_console)
+                                       cpt = true; // current playing track (we can't start next track here because startSound calls tokenize_console)
                                else if(cvar("music_playlist_current0") > i)
                                        cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1));
                        }
@@ -170,11 +170,16 @@ void XonoticPlayList_draw(entity me)
        SUPER(XonoticPlayList).draw(me);
 }
 
-void XonoticPlayList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticPlayList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else 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(i == me.playingTrack)
        {