Keep the menu Medium on every input, and shrink a long version to fit #1968
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1968
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/menu-size-medium-version-fit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Insert menu got bigger whenever a controller opened it, and the build version at the top left disappeared after the Audio tab was added. This keeps the menu one size, Medium by default, and makes a long version shrink to fit instead of vanishing.
What changed
Menu size: no more Auto.
menu_size=0(the old Auto) loads as Medium. Without that step, the row's clamp would turn it into Small.auto_pad,auto_largeand the second prebake pass for "the other size Auto might pick" are removed.ui::unitno longer takes the fullscreen and controller arguments.The banner's version shrinks to fit.
Hookshot v2.0.11-821-g7b81752) no longer fit, so the code dropped it completely.(source …), as before.ui::fit_pxinvk_ui.h. It takes the text's own width at a given size, so it works for any version string and any text.Measured with the game's own menu font at 1920×1080. The widths scale with the window height, so 1440p and 4K give the same sizes:
Hookshot v2.0.11-821-g7b81752-dirtyHookshot v2.0.12(release)readme.md: the options table and the Menu size note.Tested
menu_size=0. Both are covered by the test below.tests/test_menu_size.py(new, game-free) covers:fit_pxon a stand-in font: text that fits as is, the largest step that fits, nothing below the floor, Large never shrinking, and rounding on either side of the first guesspython -I -B tests/run_all.py: 296 passed, 1 failed, 49 skipped. The failure istest_precompile_compute_guard, which needs the MSVC target's libraries on this PC and doesn't touch these files.tests/test_stick_dead_zone.py, which compilesmenu_init's options loop, passes. That's why the old-Auto check sits outside that loop.Screenshots
Small, Medium and Large at 1920×1080 are in this comment.
🤖 Generated with Claude Code
Screenshots of the Gameplay tab at 1920×1080. They were taken from this branch's build in a headless run (
HOS_HEADLESS=1 RX_VK_SHOT_MENU=1, keys fromRX_VK_MENU_SCRIPT), on an RTX 5080. The version is a source build's,Hookshot v2.0.11-821-g7b81752-dirty.Small: the version fits at its normal 15 pt.
Medium (the default now): the same text, shrunk to fit beside the tabs. Before this PR it wasn't drawn at all at this size.
Large: unchanged. The version isn't drawn, because it doesn't fit at full size.
Nice cleanup: one size on every input is easier to reason about than Auto, and the version no longer vanishes. I read it through and checked the things below; no blockers.
vk_menu.cpp: I searched everytests/*.pyon main for what this removes or reshapes (auto_pad,auto_large,tx_menu_size,prebaked,prebake,ui::unit, themenu_sizerow). Nothing cuts those out.test_fps_overlay_order.pystubsprebakeandprebake_neededitself, andtest_menu_keys.pyonly declares its ownpad_last. The tests that cut outmenu_init(test_stick_dead_zone.py,test_menu_restart.py) cut the options loop or just look forrestart_init();, andmenu_autosits outside that loop, so they are fine. The Windows llvm-mingw build is green. The "Python source checks" jobs were still pending when I looked, so I can't confirm the Linux/Windows run of the test suite.Optionslives invk_menu.h, notvk_api.h, andui::unithas no caller outsidevk_menu.cpp.fit_pxdivision and sign:room <= 0,w <= 0andstep <= 0return 0 before the divide.min_pxis10 * s(orpxat Large), always positive, and the result is either>= min_pxor 0, so the scale can't go negative. Both loops end: the first is bounded bypx, the second drops bystepuntilf < min_px. At Large the first guess is belowpx, so it ends up 0 as intended (not drawn).menu_size=0migration: the row's clamp to 1 runs first andmenu_autothen sets 2 after the loop, so an old Auto file loads as Medium.unit()also treats anything outside 1..3 as Medium.Things to decide or look at:
tests/test_menu_size.pytakesCXXfrom the environment and falls back tog++, with noRUN_ALL_ARGS. The neighbouring tests declareRUN_ALL_ARGS = ["--cxx", "{cxx}"]and take--cxx, sorun_all.pyfinds the compiler and skips cleanly if there is none. On a machine withoutg++(llvm-mingw, for one) this one fails instead of skipping.pointslist, so the first open at a given width may bake a few glyph sizes. The prebake dry run draws the banner once, so it probably covers them; I haven't measured it.The PR body says
test_precompile_compute_guardfails on the author's PC (needs MSVC libraries); I did not check that against main's CI.@ -0,0 +1,103 @@"""Menu size is Small, Medium or Large, Medium by default, whatever the input:Nit: other compile-based tests declare
RUN_ALL_ARGS = ["--cxx", "{cxx}"]near the top and take--cxx(seetest_menu_keys.py), sorun_all.pyfinds a compiler or skips. Here a missingg++is a failure.@ -0,0 +1,103 @@"""Menu size is Small, Medium or Large, Medium by default, whatever the input:Fixed in
9192909:RUN_ALL_ARGS = ["--cxx", "{cxx}"]and--cxx, as intest_menu_keys.py. With no C++ compiler on PATH,run_all.pynow skips it ("not found here: cxx"). With llvm-mingw'sclang++it passes.Thanks for the review, hckrman101.
9192909(see the reply on the test). The full suite on Windows with llvm-mingw gives 295 passed, 2 failed. The failures aretest_precompile_compute_guard, which needs the MSVC target's libraries on this PC, andtest_fpx_sticky. That one passed on the run before and passes alone (run_all.py test_fpx_sticky), so it looks flaky when 24 run at once here. Neither touches these files.fit_pxonly depends on the window's width and height, the Menu size and the version string. So the shrunk size is baked before the first open, at the same unit and width thatprebake_neededtracks. I haven't timed the first open separately.