mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-12 16:31:05 +02:00
fe7dcf33ec
Edge docking and zoom-linked UI scaling shipped as unconditional behaviour. Both are departures from how the port composed the screen, so they become a setting instead: UI LAYOUT = CENTERED (the default) or DYNAMIC. CENTERED is a fixed letterbox. Elements stay where they were drawn in the 160x144 canvas, and the UI does not follow the survey zoom, so screen furniture neither moves nor resizes under the player. That is what the pre-anchoring builds did. DYNAMIC is the current behaviour, unchanged. Both halves matter together: gating only the anchoring would stop the dialogue box moving but leave it resizing with the zoom, which is the same complaint in a different form. Gated at Renderer:setUIAnchor and Renderer:uiScale rather than at each caller, so one switch covers the dialogue box, its YES/NO, the START menu and anything anchored later, and no caller knows the option exists. Game.dynamicUI answers true only for an explicit "dynamic", so a save written before this keeps the layout it already had. Independent of it, deliberately: BATTLE SIZE still works under either mode (uiFill overrides the scale later, in endFrame), and a battle still holds its own prompts inside its screen under DYNAMIC. Also includes the Oak intro fix (previously #674): the speech fills white over the UI canvas while its dialogue box docks to the window edge, so under DYNAMIC black showed between the two. letterboxWhite closes it, and the shrink beat's replica box rides the same anchor as the real box it stands in for.
54 lines
1.6 KiB
Lua
54 lines
1.6 KiB
Lua
-- Driver: UI LAYOUT centered vs dynamic, same moment shot twice.
|
|
--
|
|
-- Only visible when the window letterboxes, so it resizes first: at an exact
|
|
-- multiple of 160x144 there is nowhere for a docked element to dock TO.
|
|
-- Shoots the overworld dialogue box and the START menu, the two pieces the
|
|
-- option moves.
|
|
-- POKEPORT_DRIVER=tests/drivers/ui_layout_option_test.lua lovec .
|
|
return function(game)
|
|
local U = dofile("tests/drivers/util.lua")
|
|
local DIR = os.getenv("SHOT_DIR") or "/tmp/shots"
|
|
|
|
love.window.setMode(1000, 700)
|
|
U.wait(30)
|
|
|
|
-- straight into the overworld, no intro
|
|
U.teleport(game, "PALLET_TOWN", 5, 6, "down")
|
|
U.wait(40)
|
|
|
|
local function shootBoth(tag)
|
|
-- START menu (Menu anchors "topright")
|
|
U.tap(game, "start")
|
|
U.wait(45)
|
|
U.shot(game, DIR .. ("/uilayout_%s_startmenu.png"):format(tag))
|
|
U.tap(game, "b")
|
|
U.wait(30)
|
|
|
|
-- a dialogue box (TextBox anchors "bottom"): read the sign by the door
|
|
local TextBox = require("src.render.TextBox")
|
|
game.stack:push(TextBox.new(game, "UI LAYOUT check:\nthis box.", function() end))
|
|
for _ = 1, 400 do
|
|
local top = game.stack:top()
|
|
if top and top.done then break end
|
|
U.wait(2)
|
|
end
|
|
U.wait(30)
|
|
U.shot(game, DIR .. ("/uilayout_%s_textbox.png"):format(tag))
|
|
game.stack:pop()
|
|
U.wait(20)
|
|
end
|
|
|
|
game.save.options.uiLayout = "centered"
|
|
U.log("UI LAYOUT = centered (the default)")
|
|
U.wait(20)
|
|
shootBoth("centered")
|
|
|
|
game.save.options.uiLayout = "dynamic"
|
|
U.log("UI LAYOUT = dynamic")
|
|
U.wait(20)
|
|
shootBoth("dynamic")
|
|
|
|
U.log("done")
|
|
U.wait(20)
|
|
end
|