22 return {.
Count =
static_cast<int>(
menu->Items.size()), .Selectable = [
menu,
slot](
int index) {
64void CenterHtmlMenu::Push(
int slot, std::shared_ptr<Menu>
menu)
75void CenterHtmlMenu::ResetCursor(
int slot)
83void CenterHtmlMenu::Select(
int slot,
int index)
98 _cursors[
slot].Selected = index;
162 _cursors[
slot].LastSent = {};
183 Page&
page = _cursors[
slot].LastSent;
197 if (
now -
page.SentAt >= ResendIntervalMs)
204std::string CenterHtmlMenu::Render(
int slot, Menu&
menu)
212 const CenterHtmlView
view{
213 .Describe = [
this,
slot](
int index) {
return _stack.
Describe(
slot, index); },
216 .SelectedIndex = _cursors[
slot].Selected,
222void CenterHtmlMenu::OnGameFrame()
247bool CenterHtmlMenu::ReadKeys(
int slot)
265 if (
now -
cursor.LastInputTime < PressGapMs)
308 MoveCursor(
slot, -1);
313 MoveCursor(
slot, +1);
338void CenterHtmlMenu::MoveCursor(
int slot,
int step)
343void CenterHtmlMenu::JumpPage(
int slot,
int delta)
VoltMod::Controller Controller(int slot)
void ClearCenterHtml(int slot)
void SendCenterHtml(int slot, const std::string &html)
std::function< void(int slot, std::string_view message)> Reply
One-shot delays and repeating timers, run on the game thread.
Subscription EveryFrame(std::function< void()> callback)
static int64_t MonotonicMs()
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
std::string Get(std::string_view key) const
std::string GetOr(std::string_view key, int slot, std::string_view fallback) const
std::string RenderMenuHtml(const Menu *menu, const CenterHtmlView &view, Translations &translations)
static std::string ReadFile(const std::filesystem::path &path)
std::string RenderCaptureOverlay(const std::string &menuTitle, std::string_view prompt)
constexpr bool IsValidSlot(int slot)
bool IsRowActionable(const MenuItem &item, int slot)
constexpr int CenterHtmlRowsPerPage
static CursorRows CursorRowsFor(Menu *menu, int slot)