feat(ui): the HUD laid out for every screen shape at its 16:9 size, anchored to the screen's edges #95
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!95
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:feat/hud-layout"
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?
Why
On a screen that isn't 16:9, the HUD looks wrong today. Narrower shapes (5:4, 4:3, 3:2, 16:10) stretch the HUD and menus taller, and wider ones (21:9, 32:9, 48:9) leave the HUD in the middle 16:9, far from the corners. With this change the HUD keeps its 16:9 size on every shape the Aspect ratio row offers, and its parts sit at the screen's edges and corners, as if the game had been made for that shape. 16:9 doesn't change.
What changed
host/hos_wide_ui.c): built on ozwaldorf's pane planner from Hookshot #2843 ("Extended" ultrawide menus, still open there; credited in the commit). The planner sees each 2D pane as the game places it (f_8154cab0) and moves the ones at a side of the 16:9 canvas out to the screen's side. This PR changes three things about it:HUD_LAYOUTS:PlayerStatus_00,Location_00,MapMenu_00for the minimap,Talk_00, and the world-placed ones, which stay unmoved).ui_ex< 0). Up and down (visit_y,PANE_Y) is new: when the HUD has to be drawn smaller, the top and bottom panes move out to the screen's top and bottom.hos_wide_ui_tick):HUD_MAX; covers every 21:9 screen up to 3840x1600). On a 32:9 screen that keeps the hearts and the minimap near the middle. At 48:9 (three screens) the HUD stays on the middle screen, as before.HUD_FULL). Below that it shrinks by the ratio over 3:2 (4:3: 89%, 5:4: 83%) so it doesn't take too much of the width, and its top and bottom move out.nx2/oot_wide.py,HUD): one across and up scale (hos_ui_qx,hos_ui_qy) for every 2D screen not kept whole. The old site only scaled across, and only on wider screens. The pane sites are #2843's.host/rx_backend.c): on a narrower screen the menus' screen is never kept whole (stretched), whatever the Ultrawide menus row says; that row is about wider screens.tests/test_hud_layout.pyis new. It checks the plan at each shape (16:9, 21:9, 3440x1440, 32:9, 48:9, 16:10, 3:2, 4:3, back to 16:9), the menus' fit, and the projection site.tests/test_wide_ui.pyis #2843's, run with the menus' moves on.docs/development.md, and there's a row indocs/tested-configurations.md.Flags and settings
HOS_WIDE_UI0: the HUD as before (wider: middle 16:9; narrower: fitted to the width, no longer stretched).1: also moves the menus' side panes out to a wider screen's edges (#2843's Extended)HOS_WIDE_UI_LOG=<n>HOS_HUD_MAX_RATIO=<ratio>0: the screen's edges at any widthHOS_HUD_FULL_RATIO=<ratio>Measurements
main:
82de567a(2026-11-12): the Longshot-Main game folder. The commits since then up tof41db065touch no HUD, menu or render code: forge tooling, the release scripts, the DLSS preset row (#39), and the game's own update check taken out.this PR: feat/hud-layout @ 9c5a39c1 (the same change before its rebase onto
f41db065, plus the tested-configurations row)Hardware: RTX 5080 16 GB, NVIDIA 621.24, Ryzen 9 9900X3D, 64 GB DDR5, Windows 11 Pro (26300)
Scene: Kokiri Forest at the debug teleport's arrival, standing; output 3440x1440 (21:9) and 1440x1080 (4:3) through
HOS_OUTPUT_RES; the options' DLSS row; headless, no sound,HOS_NO_PACING=1 HOS_REALTIME_STEP=0Method: 1,800 presents standing after the teleport, frame intervals from
RX_VK_FRAME_LOG, median per run. 4 runs per shape, interleaved main, PR, main, PR. The table gives the median of the two runs (each run's own in brackets). The plan's own time comes fromHOS_WIDE_UI_LOG's line, the last 3 of each run.How to reproduce:
longshot_ctl.py launch <folder> --headless --env HOS_OUTPUT_RES=3440x1440 --env HOS_NO_PACING=1 --env HOS_WIDE_UI_LOG=1 --env RX_VK_FRAME_LOG=frames.csv, then Continue,teleport KokiriForest_Child,wait present --frames 300, then 1,800 presents.82de567ahos_wide_squeeze0)Before the plan walked only the used slots, it took 0.68 to 0.78 ms a present, and the PR's frame medians were about 0.5 ms above main's at both shapes. That is why the bitmap is in this PR.
Testing
Tested: In the game on an RTX 5080, Windows 11, headless, through the control bridge, from a Longshot-Main save: Continue, the debug teleport to Kokiri Forest, play, the pause menu's Items page, and its System page (the controls sheet). I ran that at 5:4 1280x1024, 4:3 1440x1080, 3:2 1920x1280, 16:10 1920x1200, 16:9 1920x1080 and 2560x1440, 21:9 2560x1080 and 3440x1440, 12:5 3840x1600, 32:9 5120x1440 and 48:9 5760x1080, with main @
82de567aat every shape and the PR at every shape, plus 32:9 and 48:9 withHOS_HUD_MAX_RATIO=0. The title screen and the file select ran at every shape too, on the way in, but I didn't look at them separately.python -I -B tests/run_all.pyon the PR's commit: 484 passed, 6 failed, 40 skipped. All 6 also fail on mainf41db065on this PC: test_bake_portability, test_finish_output, test_lift_cache, test_setup_runtime, test_check_third_party, test_release.tests/test_hud_layout.pyfails on main (there is nohost/hos_wide_ui.c) and passes here. There is no CI on Forgejo, so these checks were run locally.Not tested:
HUD_LAYOUTSare treated as menus: centred and fitted, never stretched, but not anchored.Needs other testers:
HOS_OUTPUT_RES, expecting the same pictures (T-QSAV)Screenshots
Each picture shows main @
82de567aon top and this PR @ 9c5a39c1 below it: play in Kokiri Forest, then the pause menu's Items page. They are the game's own screenshots, taken headless.82de567a(top) and this PR @ 9c5a39c1 (bottom)For maintainers to decide, 32:9 and 48:9: the HUD stopping at 12:5's sides (this PR) or reaching the screen edges (
HOS_HUD_MAX_RATIO=0):Risk and rollback
A HUD layout this PR doesn't name, or a menu that is really a HUD element, would sit centred instead of at the edges. That is the old place, but on a narrower screen it is now drawn smaller to fit. A pane the planner misjudges could land at the wrong edge;
HOS_WIDE_UI_LOGshows each move.HOS_WIDE_UI=0puts the HUD back in the middle (narrower: fitted), and reverting the commit restores today's behaviour. At 16:9 nothing runs.Reviewer notes
hos_wide_ui_tick(the rules per shape) andvisit_y; the rest ofhos_wide_ui.cis #2843's planner with the per-class extras.HOS_HUD_MAX_RATIO=0).KEEP_VTABLESand the menus' keep bits. Whichever lands second has a small text conflict there; they are compatible.Issues
See #64
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested-configurations.mdfor each measured run.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged). n/amainand passing here.tests/that reads changed source updated in this PR, not weakened.__builtin_ctzll, ashost/hos_thread.calready uses.🤖 Generated with Claude Code
WIP: feat(ui): the HUD laid out for every screen shape at its 16:9 size, anchored to the screen's edgesto feat(ui): the HUD laid out for every screen shape at its 16:9 size, anchored to the screen's edgesCan we simplify code?
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.