METHOD(ListBox, focusLeave, void(entity))
ATTRIB(ListBox, focusable, float, 1)
ATTRIB(ListBox, focusedItem, int, -1)
- ATTRIB(ListBox, focusedItemTime, float, 0)
+ ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
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, int, vector, bool, float)) // item number, width/height, isSelected, highlightedTime
+ METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, bool)) // item number, width/height, isSelected, isFocused
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))
x = me.focusedItem;
me.focusedItem = me.getItemAtPos(me, me.scrollPos + pos.y);
if(x != me.focusedItem)
- me.focusedItemTime = time;
+ me.focusedItemAlpha = SKINALPHA_LISTBOX_FOCUSED;
}
return 1;
}
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.focusedItem == i) ? me.focusedItemTime : 0);
+ me.drawListBoxItem(me, i, absSize, (me.selectedItem == i), (me.focusedItem == i));
y += relSize.y;
}
draw_ClearClip();
// template method
}
-void ListBox_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+void ListBox_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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);
}
METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity))
ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
METHOD(XonoticCampaignList, draw, void(entity))
- METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, float highlightedTime)
+void XonoticCampaignList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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(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(XonoticCharmap, cellSelect, void(entity, vector))
METHOD(XonoticCharmap, cellIsValid, bool(entity, vector))
- METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector, float))
+ METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector))
METHOD(XonoticCharmap, charOffset, vector)
ENDCLASS(XonoticCharmap)
entity makeXonoticCharmap(entity controlledInputBox);
return true;
}
-void XonoticCharmap_cellDraw(entity me, vector cell, vector cellPos, float highlightedTime)
+void XonoticCharmap_cellDraw(entity me, vector cell, vector cellPos)
{
draw_CenterText(cellPos + me.charOffset, charmap_cellToChar(me, cell), me.realFontSize, SKINCOLOR_CHARMAP_CHAR, SKINALPHA_CHARMAP_CHAR, 0);
}
METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity))
ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
METHOD(XonoticCreditsList, draw, void(entity))
- METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticCreditsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
// layout: Ping, Credits name, Map name, NP, TP, MP
string s;
METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector))
METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector))
- METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector, float))
+ METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector))
ENDCLASS(XonoticCrosshairPicker)
entity makeXonoticCrosshairPicker();
#endif
return true;
}
-void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos, float highlightedTime)
+void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
{
vector sz, rgb;
string cross = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
CLASS(XonoticCvarList) EXTENDS(XonoticListBox)
METHOD(XonoticCvarList, configureXonoticCvarList, void(entity))
ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
- METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticCvarList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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);
+ }
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, int, vector, bool, float))
+ METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticDemoList_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(highlightedTime)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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.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, int, vector, bool, float))
+ METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticGametypeList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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);
+ }
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, int, vector, bool, float))
+ METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool))
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, float highlightedTime)
+void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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);
+ }
theAlpha = SKINALPHA_KEYGRABBER_KEYS;
theColor = SKINCOLOR_KEYGRABBER_KEYS;
CLASS(XonoticLanguageList) EXTENDS(XonoticListBox)
METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity))
ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
- METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticLanguageList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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.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, 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))
}
}
-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;
{
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')
METHOD(XonoticPicker, moveFocus, void(entity, vector, vector))
METHOD(XonoticPicker, cellSelect, void(entity, vector))
- METHOD(XonoticPicker, cellDraw, void(entity, vector, vector, float))
+ METHOD(XonoticPicker, cellDraw, void(entity, vector, vector))
METHOD(XonoticPicker, cellIsValid, bool(entity, vector))
ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
+ ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
ATTRIB(XonoticPicker, focusedCellTime, float, 0)
ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
ENDCLASS(XonoticPicker)
}
if(me.focusedCell != prevFocusedCell)
- me.focusedCellTime = time;
+ me.focusedCellAlpha = SKINALPHA_LISTBOX_FOCUSED;
return 1;
}
return true;
}
-void XonoticPicker_cellDraw(entity me, vector cell, vector cellPos, float highlightTime)
+void XonoticPicker_cellDraw(entity me, vector cell, vector cellPos)
{
}
else if(cell == me.focusedCell && me.focused)
{
if(!me.pressed || me.focusedCell == me.pressedCell)
- draw_Fill(cellPos, me.realCellSize, SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, me.focusedCellTime));
+ {
+ me.focusedCellAlpha = getFadedAlpha(me.focusedCellAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+ draw_Fill(cellPos, me.realCellSize, SKINCOLOR_LISTBOX_FOCUSED, me.focusedCellAlpha);
+ }
}
- me.cellDraw(me, cell, cellPos, (me.focusedCell == cell) ? me.focusedCellTime : 0);
+ me.cellDraw(me, cell, cellPos);
}
}
CLASS(XonoticPlayerList) EXTENDS(XonoticListBox)
ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticPlayerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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, int, vector, bool, 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))
SUPER(XonoticPlayList).draw(me);
}
-void XonoticPlayList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+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(highlightedTime)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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)
{
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, int, vector, bool, float))
+ METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, bool))
METHOD(XonoticScreenshotList, getScreenshots, void(entity))
METHOD(XonoticScreenshotList, previewScreenshot, void(entity))
METHOD(XonoticScreenshotList, startScreenshot, void(entity))
}
}
-void XonoticScreenshotList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticScreenshotList_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(highlightedTime)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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.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, int, vector, bool, float))
+ METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, float highlightedTime)
+void XonoticServerList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
// 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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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 = 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, int, vector, bool, float))
+ METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticSkinList_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(highlightedTime)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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.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, int, vector, bool, 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))
me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
}
-void XonoticSoundList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
+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(highlightedTime)
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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
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, int, vector, bool, float))
+ METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticStatsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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);
+ }
string data = bufstr_get(me.listStats, i);
string s = car(data);
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
- theAlpha = targetAlpha;
- return theAlpha;
+ currentAlpha = max(currentAlpha - frametime * 0.5, targetAlpha);
+ return currentAlpha;
}
void CheckSendCvars(entity me, string cvarnamestring)
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable panel"))); \
DIALOG_HUDPANEL_COMMON_NOTOGGLE()
-float getHighlightAlpha(float startAlpha, float targetAlpha, float highlightedTime);
+float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha);
string _Nex_ExtResponseSystem_BannedServers;
float _Nex_ExtResponseSystem_BannedServersNeedsRefresh;
METHOD(XonoticWeaponsList, toString, string(entity))
ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
METHOD(XonoticWeaponsList, draw, void(entity))
- METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, float))
+ METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool))
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, int i, vector absSize, bool isSelected, float highlightedTime)
+void XonoticWeaponsList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
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_FOCUSED, getHighlightAlpha(SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED, highlightedTime));
+ 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);
+ }
e = get_weaponinfo(stof(argv(i)));
string msg = e.message;
if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)