From d9050c9661c89229dd24376ef8f8194a54a9da82 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sun, 5 Oct 2025 13:20:44 -0400 Subject: [PATCH] Add support for pinning glyphs to a consistent spot in the HUD --- config.cpp | 8 ++++++++ hud.cpp | 38 ++++++++++++++++++++++++++++++++------ menus.cpp | 5 +++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/config.cpp b/config.cpp index 5776cb42..936b3047 100644 --- a/config.cpp +++ b/config.cpp @@ -1207,6 +1207,14 @@ EX void initConfig() { param_b(keybd_subdir_enabled, "keybd_subdir_enabled", 0)->editable("control the pushing direction with TAB", 'P')->help("If set, you control the off-heptagon pushing direction with TAB. Otherwise, you control it by rotating the screen."); + param_str(pinnedglyphs, "pinned_glyphs", "") + ->set_standard_editor(true) + ->editable("pinned glyphs", + "A list of glyphs to always sort at the front, " + "and reserve space for even when they're not being displayed.", + 'p') + ->set_reaction(updateglyphpinned); + param_enum(glyphsortorder, parameter_names("glyph_sort", "glyph sort order"), glyphsortorder) ->editable({ {"first on top", ""}, diff --git a/hud.cpp b/hud.cpp index 1c037035..9b74ef26 100644 --- a/hud.cpp +++ b/hud.cpp @@ -58,6 +58,8 @@ enum eGlyphsortorder { #endif EX eGlyphsortorder glyphsortorder; +EX string pinnedglyphs; +EX bool glyphpinned[int(ittypes) + int(motypes)]; int zero = 0; @@ -80,6 +82,27 @@ int glyphorder[glyphs]; int glyphphase[glyphs]; int glyph_lastticks; +EX void updateglyphpinned() { + for(int i=0; i= 0 && i < glyphs) glyphpinned[i] = true; + } while(ep.eat(",")); + } + } + +EX void updatepinnedglyphs() { + std::stringstream ss; + for(int i=0; i glyphpinned[j]; if(subclass(i) != subclass(j)) return subclass(i) < subclass(j); if(glyphsortorder == gsoFirstTop) @@ -560,7 +585,7 @@ EX void drawStats() { else if(cornermode) { int bycorner[4]; for(int u=0; u<4; u++) bycorner[u] = 0; - for(int i=0; i glyphstoshow; for(int i=0; i= rows) rowid[z] = 0, colid[z]++; - displayglyph2(cx, cy, buttonsize, i); + if(ikappear(i)) displayglyph2(cx, cy, buttonsize, i); } } } diff --git a/menus.cpp b/menus.cpp index c99bc70f..0f93d480 100644 --- a/menus.cpp +++ b/menus.cpp @@ -181,6 +181,11 @@ EX void showOverview() { } else if(udiv == 2 && umod < ittypes) { gotoHelp(generateHelpForItem(eItem(umod))); + help_extensions.push_back(help_extension{'p', glyphpinned[umod] ? XLAT("unpin from HUD") : XLAT("pin to HUD"), [umod] () { + glyphpinned[umod] ^= true; + updatepinnedglyphs(); + popScreen(); + }}); if(cheater) { dialog::helpToEdit(items[umod], 0, 200, 10, 10); dialog::get_ne().reaction = [] () {