]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/soundlist.qc
Listbox / Picker: Implement item fading in a different way so that it gets influenced...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / soundlist.qc
index e443a53efb42ddcab91cd3d1df8804df0d8b0777..3e37c34f109258f75a508f453911b59f7c0df4a7 100644 (file)
@@ -3,7 +3,7 @@ CLASS(XonoticSoundList) EXTENDS(XonoticListBox)
        METHOD(XonoticSoundList, configureXonoticSoundList, void(entity))
        ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
        METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector))
-       METHOD(XonoticSoundList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool))
        METHOD(XonoticSoundList, getSounds, void(entity))
        METHOD(XonoticSoundList, soundName, string(entity, float))
        METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
@@ -101,11 +101,16 @@ void XonoticSoundList_resizeNotify(entity me, vector relOrigin, vector relSize,
        me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
 }
 
-void XonoticSoundList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticSoundList_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);
+       }
 
        s = me.soundName(me,i);
        if(s == cvar_string("menu_cdtrack")) // current menu track