METHOD(ListBox, configureListBox, void(entity, float, float))
METHOD(ListBox, draw, void(entity))
METHOD(ListBox, keyDown, float(entity, float, float, float))
+ METHOD(ListBox, mouseMove, float(entity, vector))
METHOD(ListBox, mousePress, float(entity, vector))
METHOD(ListBox, mouseDrag, float(entity, vector))
METHOD(ListBox, mouseRelease, float(entity, vector))
METHOD(ListBox, focusLeave, void(entity))
ATTRIB(ListBox, focusable, float, 1)
+ ATTRIB(ListBox, highlightedItem, int, -1)
+ ATTRIB(ListBox, highlightedItemTime, float, 0)
ATTRIB(ListBox, allowFocusSound, float, 1)
ATTRIB(ListBox, selectedItem, int, 0)
ATTRIB(ListBox, size, vector, '0 0 0')
ATTRIB(ListBox, lastClickedItem, float, -1)
ATTRIB(ListBox, lastClickedTime, float, 0)
- METHOD(ListBox, drawListBoxItem, void(entity, float, vector, float)) // item number, width/height, selected
+ METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, float)) // item number, width/height, isSelected, highlightedTime
METHOD(ListBox, clickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)) // item number, relative clickpos
METHOD(ListBox, setSelected, void(entity, float))
return 0;
return 1;
}
+float ListBox_mouseMove(entity me, vector pos)
+{
+ if(pos_x < 0) return 0;
+ if(pos_y < 0) return 0;
+ if(pos_x >= 1) return 0;
+ if(pos_y >= 1) return 0;
+ if(pos_x < 1 - me.controlWidth)
+ {
+ float x;
+ x = me.highlightedItem;
+ me.highlightedItem = me.getItemAtPos(me, me.scrollPos + pos.y);
+ if(x != me.highlightedItem)
+ me.highlightedItemTime = time;
+ }
+ return 1;
+}
float ListBox_mouseDrag(entity me, vector pos)
{
float hit;
// by a mouse click on an item of the list
// for example showing a dialog on right click
me.pressed = 0;
+ me.highlightedItem = -1;
}
void ListBox_updateControlTopBottom(entity me)
{
draw_SetClip();
oldshift = draw_shift;
oldscale = draw_scale;
+
float y;
i = me.getItemAtPos(me, me.scrollPos);
y = me.getItemStart(me, i) - me.scrollPos;
vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i);
absSize = boxToGlobalSize(relSize, me.size);
draw_scale = boxToGlobalSize(relSize, oldscale);
- me.drawListBoxItem(me, i, absSize, (me.selectedItem == i));
+ me.drawListBoxItem(me, i, absSize, (me.selectedItem == i), (me.highlightedItem == i) ? me.highlightedItemTime : 0);
y += relSize.y;
}
draw_ClearClip();
// template method
}
-void ListBox_drawListBoxItem(entity me, float i, vector absSize, float selected)
+void ListBox_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
- draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (selected ? '0 1 0' : '1 1 1'), 1, 0);
+ draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (isSelected ? '0 1 0' : '1 1 1'), 1, 0);
}
#endif
METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity))
ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
METHOD(XonoticCampaignList, draw, void(entity))
- METHOD(XonoticCampaignList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticCampaignList, setSelected, void(entity, float))
{
CampaignList_LoadMap(me, me);
}
-void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
vector theColor;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
if(draw_PictureSize(strcat("/maps/", campaign_mapname[i])) == '0 0 0')
draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity))
ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
METHOD(XonoticCreditsList, draw, void(entity))
- METHOD(XonoticCreditsList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float))
METHOD(XonoticCreditsList, destroy, void(entity))
me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
}
-void XonoticCreditsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticCreditsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
// layout: Ping, Credits name, Map name, NP, TP, MP
string s;
CLASS(XonoticCvarList) EXTENDS(XonoticListBox)
METHOD(XonoticCvarList, configureXonoticCvarList, void(entity))
ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
- METHOD(XonoticCvarList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticCvarList, keyDown, float(entity, float, float, float))
me.setSelected(me, me.selectedItem);
}
-void XonoticCvarList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticCvarList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string k, v, d;
float t;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
k = bufstr_get(me.handle, i);
METHOD(XonoticDemoList, configureXonoticDemoList, void(entity))
ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(XonoticDemoList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticDemoList, getDemos, void(entity))
METHOD(XonoticDemoList, startDemo, void(entity))
METHOD(XonoticDemoList, timeDemo, void(entity))
me.columnNameSize = 1 - 2 * me.realFontSize.x;
}
-void XonoticDemoList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticDemoList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = me.demoName(me,i);
s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
CLASS(XonoticGametypeList) EXTENDS(XonoticListBox)
METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity))
ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
- METHOD(XonoticGametypeList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticGametypeList, setSelected, void(entity, float))
METHOD(XonoticGametypeList, loadCvars, void(entity))
owner.gameTypeChangeNotify(owner);
}
}
-void XonoticGametypeList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s1, s2;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
draw_Picture(me.columnIconOrigin * eX, GameType_GetIcon(i), me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
s1 = GameType_GetName(i);
CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
- METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticKeyBinder, setSelected, void(entity, float))
}
return r;
}
-void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
int j, n;
else
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
}
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
+
theAlpha = SKINALPHA_KEYGRABBER_KEYS;
theColor = SKINCOLOR_KEYGRABBER_KEYS;
extraMargin = me.realFontSize.x * 0.5;
CLASS(XonoticLanguageList) EXTENDS(XonoticListBox)
METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity))
ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
- METHOD(XonoticLanguageList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticLanguageList, setSelected, void(entity, float))
METHOD(XonoticLanguageList, loadCvars, void(entity))
me.loadCvars(me);
}
-void XonoticLanguageList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticLanguageList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s, p;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = me.languageParameter(me, i, LANGPARM_NAME_LOCALIZED);
METHOD(XonoticMapList, configureXonoticMapList, void(entity))
ATTRIB(XonoticMapList, rowsPerItem, float, 4)
METHOD(XonoticMapList, draw, void(entity))
- METHOD(XonoticMapList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector))
METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector))
}
}
-void XonoticMapList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticMapList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
// layout: Ping, Map name, Map name, NP, TP, MP
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
- else if(included)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_MAPLIST_INCLUDEDBG, SKINALPHA_MAPLIST_INCLUDEDBG);
+ else
+ {
+ 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_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
+ }
if(draw_PictureSize(strcat("/maps/", MapInfo_Map_bspname)) == '0 0 0')
draw_Picture(me.columnPreviewOrigin * eX, "nopreview_map", me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
CLASS(XonoticPlayerList) EXTENDS(XonoticListBox)
ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(XonoticPlayerList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, float))
ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
me.columnScoreOrigin = me.columnNameOrigin + me.columnNameSize + me.realFontSize.x;
}
-void XonoticPlayerList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticPlayerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
string score;
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, float))
METHOD(XonoticPlayList, stopSound, void(entity))
METHOD(XonoticPlayList, startSound, void(entity, float))
METHOD(XonoticPlayList, resumeSound, void(entity))
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, float highlightedTime)
{
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
if(i == me.playingTrack)
{
METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticScreenshotList, setSelected, void(entity, float))
METHOD(XonoticScreenshotList, draw, void(entity))
- METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticScreenshotList, getScreenshots, void(entity))
METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
METHOD(XonoticScreenshotList, startScreenshot, void(entity))
}
}
-void XonoticScreenshotList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticScreenshotList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = me.screenshotName(me,i);
s = draw_TextShortenToWidth(s, me.columnNameSize, 0, me.realFontSize);
METHOD(XonoticServerList, configureXonoticServerList, void(entity))
ATTRIB(XonoticServerList, rowsPerItem, float, 1)
METHOD(XonoticServerList, draw, void(entity))
- METHOD(XonoticServerList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticServerList, keyDown, float(entity, float, float, float))
{
ServerList_Connect_Click(NULL, me);
}
-void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
+void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
// layout: Ping, Server name, Map name, NP, TP, MP
float p;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = gethostcachestring(SLIST_FIELD_QCSTATUS, i);
m = tokenizebyseparator(s, ":");
METHOD(XonoticSkinList, configureXonoticSkinList, void(entity))
ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(XonoticSkinList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticSkinList, getSkins, void(entity))
METHOD(XonoticSkinList, setSkin, void(entity))
METHOD(XonoticSkinList, loadCvars, void(entity))
me.columnNameSize = 1 - me.columnPreviewSize - 2 * me.realFontSize.x;
}
-void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticSkinList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = me.skinParameter(me, i, SKINPARM_PREVIEW);
draw_Picture(me.columnPreviewOrigin * eX, s, me.columnPreviewSize * eX + eY, '1 1 1', 1);
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, float))
METHOD(XonoticSoundList, getSounds, void(entity))
METHOD(XonoticSoundList, soundName, string(entity, float))
METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, float, vector))
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, float highlightedTime)
{
string s;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
s = me.soundName(me,i);
if(s == cvar_string("menu_cdtrack")) // current menu track
METHOD(XonoticStatsList, configureXonoticStatsList, void(entity))
ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(XonoticStatsList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticStatsList, getStats, void(entity))
METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticStatsList, keyDown, float(entity, float, float, float))
#endif
}
-void XonoticStatsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
string data = bufstr_get(me.listStats, i);
string s = car(data);
e.configureXonoticTextSliderValues(e);
}
+#define FADE_TIME 0.5
+#define MAX_ALPHA_INCREASE 0.1
+#define TRESHOLD_TIME 0.1
+float getHighlightAlpha(float baseAlpha, float highlightedTime)
+{
+ float alphaIncrease;
+ if (time - highlightedTime - TRESHOLD_TIME < FADE_TIME)
+ {
+ alphaIncrease = max(0, (time - highlightedTime - TRESHOLD_TIME) / FADE_TIME);
+ alphaIncrease = (1 - alphaIncrease) * MAX_ALPHA_INCREASE;
+ }
+ else
+ alphaIncrease = 0;
+ return baseAlpha + alphaIncrease;
+}
+
void CheckSendCvars(entity me, string cvarnamestring)
{
if(me.sendCvars)
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable panel"))); \
DIALOG_HUDPANEL_COMMON_NOTOGGLE()
+float getHighlightAlpha(float baseAlpha, float highlightedTime);
+
string _Nex_ExtResponseSystem_BannedServers;
float _Nex_ExtResponseSystem_BannedServersNeedsRefresh;
string _Nex_ExtResponseSystem_PromotedServers;
METHOD(XonoticWeaponsList, toString, string(entity))
ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
METHOD(XonoticWeaponsList, draw, void(entity))
- METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, float, vector, float))
+ METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, float))
METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float))
ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
}
return substring(s, 0, strlen(s) - 2);
}
-void XonoticWeaponsList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticWeaponsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
{
entity e;
if(isSelected)
draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ else if(highlightedTime)
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
e = get_weaponinfo(stof(argv(i)));
string msg = e.message;
if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)