Expose window margins to tool HUDs

This commit is contained in:
Kevin Jacobson
2026-07-28 14:09:46 -07:00
parent d09cf80da5
commit fb58fa788b
4 changed files with 37 additions and 21 deletions
+7 -9
View File
@@ -255,14 +255,6 @@ function Game:draw()
end
Renderer:beginFrame(worldBelow)
self.stack:draw()
-- Persistent tool status belongs above every game state but inside the
-- active UI canvas, so it composes with palette/render mods and survives
-- menus, battles, and transitions without becoming an updating state.
if ModRuntime.wantsHook("render.hud") then
local width, height = Renderer:uiSize()
ModRuntime.call("render.hud", function() end, self,
{ width = width, height = height })
end
-- SGB colorization: the topmost state that knows its palette owns the
-- screen (overlays like text boxes inherit from what's beneath them);
-- the overworld's world pass colors each visible map area separately
@@ -282,7 +274,13 @@ function Game:draw()
if worldBelow and self.overworld.sgbWorldZones then
worldZones = self.overworld:sgbWorldZones()
end
Renderer:endFrame(zones, worldZones)
local viewport = Renderer:endFrame(zones, worldZones)
-- Persistent tool status is screen-space UI: draw it over the completed
-- render pipeline with exact playfield/margin geometry, but below mobile
-- controls. It never becomes an updating game state.
if ModRuntime.wantsHook("render.hud") then
ModRuntime.call("render.hud", function() end, self, viewport)
end
-- on-screen mobile controls: pure screen-space, over the finished frame
TouchControls:draw()
end
+7
View File
@@ -706,6 +706,13 @@ function Renderer:endFrame(zones, worldZones)
self.uprightActive = false
self.worldOverride = nil
PaletteFX.setPass(nil)
return {
width = ww, height = wh,
gameX = ox, gameY = oy,
gameWidth = vpw, gameHeight = vph,
scale = Sp,
dpiX = dpiX, dpiY = dpiY,
}
end
return Renderer