13bool CenterHtmlMenu::ReadKeys(
int slot)
15 if (!_stack.Current(slot))
20 Cursor& cursor = _cursors[slot];
22 const uint64_t pressed = buttons & ~cursor.PrevButtons;
23 cursor.PrevButtons = buttons;
31 if (now - cursor.LastInputTime < PressGapMs)
36 if (_services.ChatInput.IsCapturing(slot))
38 if ((pressed & IN_RELOAD) == 0)
43 _services.ChatInput.CancelCapture(slot);
44 cursor.LastInputTime = now;
48 if (!RunKey(slot, pressed))
53 cursor.LastInputTime = now;
57bool CenterHtmlMenu::RunKey(
int slot, uint64_t pressed)
59 if (pressed & IN_RELOAD)
65 Menu* menu = _stack.Current(slot);
66 const int itemCount = menu ?
static_cast<int>(menu->Items.size()) : 0;
72 if (pressed & IN_FORWARD)
77 if (pressed & IN_BACK)
82 if (pressed & (IN_MOVELEFT | IN_MOVERIGHT))
84 const int direction = (pressed & IN_MOVELEFT) ? -1 : +1;
85 if (_stack.Step(slot, _cursors[slot].Selected, direction))
93 JumpPage(slot, direction);
98 _stack.Activate(slot, _cursors[slot].Selected);
104void CenterHtmlMenu::MoveCursor(
int slot,
int step)
109void CenterHtmlMenu::JumpPage(
int slot,
int delta)
115void CenterHtmlMenu::Select(
int slot,
int index)
118 Menu* menu = _stack.Current(slot);
119 if (index < 0 || !menu || index >=
static_cast<int>(menu->Items.size()))
125 if (!_stack.IsPending(slot, index))
127 _stack.ApplyPending(slot);
130 _cursors[slot].Selected = index;
A player's identity behind a slot: name, money, team, scoreboard row. It survives death and respawn; ...
static int64_t MonotonicMs()
constexpr int CenterHtmlRowsPerPage