mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 07:41:21 +02:00
feat: UI LAYOUT option, centered by default
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.
This commit is contained in:
@@ -142,6 +142,13 @@ end
|
||||
function Renderer:uiScale()
|
||||
local S = self:fitScale()
|
||||
local off = Zoom.offset or 0
|
||||
-- UI LAYOUT = CENTERED (uiCentered, set per frame by Game:draw): the UI is
|
||||
-- a fixed letterbox at the fit scale and does not follow the survey zoom at
|
||||
-- all, which is the whole point of the setting -- the screen furniture
|
||||
-- stays put instead of resizing under the player. DYNAMIC keeps the
|
||||
-- step-down below. BATTLE SIZE is unaffected either way: uiFill overrides
|
||||
-- the scale in endFrame, after this.
|
||||
if self.uiCentered then return S end
|
||||
-- Only follow the zoom when a world is actually behind the UI. Survey zoom
|
||||
-- is an OVERWORLD control; the title screen, the intro and the credits show
|
||||
-- no world at all, and shrinking them to match a zoom level the player set
|
||||
@@ -630,6 +637,14 @@ end
|
||||
-- pixels, and consumed by endFrame this frame only.
|
||||
-- anchor: "bottom" | "topright" | "topleft" | "bottomright"
|
||||
function Renderer:setUIAnchor(x, y, w, h, anchor)
|
||||
-- UI LAYOUT = CENTERED (uiCentered, set per frame by Game:draw from
|
||||
-- save.options.uiLayout): every element stays where it was drawn in the
|
||||
-- 160x144 canvas and the letterbox centres the lot, which is how the port
|
||||
-- behaved before edge docking existed. This is the DEFAULT; DYNAMIC opts
|
||||
-- back into docking. Gating here rather than at each caller means one
|
||||
-- switch covers the dialogue box, its YES/NO, the START menu and anything
|
||||
-- added later, and none of them has to know the option exists.
|
||||
if self.uiCentered then return end
|
||||
-- uiAnchorHold (Game:draw): a state that composes its own screen -- a
|
||||
-- battle -- keeps every element inside it, so the box blits where it was
|
||||
-- drawn in the canvas instead of being pulled to the window edge.
|
||||
|
||||
Reference in New Issue
Block a user