ATTRIB(XonoticCharmap, rows, float, 10)
ATTRIB(XonoticCharmap, columns, float, 14)
- METHOD(XonoticCharmap, cellSelect, void(entity))
+ METHOD(XonoticCharmap, cellSelect, void(entity, vector))
METHOD(XonoticCharmap, cellIsValid, bool(entity, vector))
METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector, float))
METHOD(XonoticCharmap, charOffset, vector)
return me.inputBox.keyDown(me.inputBox, key, ascii, shift);
}
-void XonoticCharmap_cellSelect(entity me)
+void XonoticCharmap_cellSelect(entity me, vector cell)
{
- string character = charmap_cellToChar(me, me.focusedCell);
+ string character = charmap_cellToChar(me, cell);
if(character != "")
me.inputBox.enterText(me.inputBox, character);
}
ATTRIB(XonoticCrosshairPicker, rows, float, 3)
ATTRIB(XonoticCrosshairPicker, columns, float, 12)
- METHOD(XonoticCrosshairPicker, cellSelect, void(entity))
+ METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector))
METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector))
METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector, float))
ENDCLASS(XonoticCrosshairPicker)
return ftos(crosshair);
else
return "";
+
+vector crosshairpicker_crosshairToCell(entity me, string crosshair_str)
+{
+ float crosshair = stof(crosshair_str) - 31;
+ if(crosshair - floor(crosshair) > 0)
+ return '-1 -1 0';
+ return mod(crosshair, me.columns) * eX + floor(crosshair / me.columns) * eY;
}
entity makeXonoticCrosshairPicker()
void XonoticCrosshairPicker_configureXonoticCrosshairPicker(entity me)
{
me.configureXonoticPicker(me);
+ SUPER(XonoticCrosshairPicker).cellSelect(me, crosshairpicker_crosshairToCell(me, cvar_string("crosshair")));
}
-void XonoticCrosshairPicker_cellSelect(entity me)
+void XonoticCrosshairPicker_cellSelect(entity me, vector cell)
{
cvar_set("crosshair", crosshairpicker_cellToCrosshair(me, me.focusedCell));
+ SUPER(XonoticCrosshairPicker).cellSelect(me, me.focusedCell);
}
bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
ATTRIB(XonoticPicker, columns, float, 2)
METHOD(XonoticPicker, moveFocus, void(entity, vector, vector))
- METHOD(XonoticPicker, cellSelect, void(entity))
+ METHOD(XonoticPicker, cellSelect, void(entity, vector))
METHOD(XonoticPicker, cellDraw, void(entity, vector, vector, float))
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, focusedCellTime, float, 0)
ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
me.mouseMove(me, coords);
if(me.focusedCell == me.pressedCell)
- me.cellSelect(me);
+ me.cellSelect(me, me.focusedCell);
me.pressed = 0;
return 1;
case K_KP_ENTER:
case K_INS:
case K_KP_INS:
- me.cellSelect(me);
+ me.cellSelect(me, me.focusedCell);
return 1;
}
return 0;
me.moveFocus(me, initialCell, step);
}
-void XonoticPicker_cellSelect(entity me)
+void XonoticPicker_cellSelect(entity me, vector cell)
{
+ me.selectedCell = cell;
}
bool XonoticPicker_cellIsValid(entity me, vector cell)
cellPos_x = mod(cell.x, me.columns) / me.columns;
- if(cell == me.focusedCell && me.focused)
+ if(cell == me.selectedCell)
+ draw_Fill(cellPos, me.realCellSize, SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ 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));