mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 12:40:21 +02:00
skin studio updates, save sync CLOSES #1533
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
-- covered by tests; the state at the bottom is the only part that draws.
|
||||
|
||||
local GbcPalette = require("src.render.GbcPalette")
|
||||
local GameViewport = require("src.render.GameViewport")
|
||||
local Playfield = require("src.render.Playfield")
|
||||
local Palettes = require("src.world.gen2.Palettes")
|
||||
local Runtime = require("src.mods.Runtime")
|
||||
local SpriteAnims = require("src.ui.gen2.SpriteAnims")
|
||||
@@ -510,7 +510,7 @@ function BattleTransition:blackAt(col, row)
|
||||
end
|
||||
|
||||
function BattleTransition:draw()
|
||||
local w, h = GameViewport.dimensions()
|
||||
local w, h = Playfield.dimensions()
|
||||
self:drawWidescreen(w, h)
|
||||
end
|
||||
|
||||
|
||||
+17
-4
@@ -43,16 +43,29 @@ end
|
||||
-- pixel rows out of glyphs. This is the same rule src/render/Renderer.lua
|
||||
-- fitScale applies to the Gen 1 UI canvas; the surround a widescreen screen
|
||||
-- paints still fills the window, the PANEL is what stays on the grid.
|
||||
local function playfieldRect(winW, winH)
|
||||
local ok, Playfield = pcall(require, "src.render.Playfield")
|
||||
if ok and Playfield.rect then
|
||||
local okv, x, y, w, h = pcall(Playfield.rect, winW, winH)
|
||||
if okv and w and w >= 1 and h and h >= 1 then
|
||||
return x, y, w, h
|
||||
end
|
||||
end
|
||||
return 0, 0, winW or 0, winH or 0
|
||||
end
|
||||
|
||||
function Chrome.fitScale(winW, winH)
|
||||
return math.max(1, math.floor(math.min((winW or 0) / (Chrome.SCREEN_W * 8),
|
||||
(winH or 0) / (Chrome.SCREEN_H * 8))))
|
||||
local _, _, w, h = playfieldRect(winW, winH)
|
||||
return math.max(1, math.floor(math.min(w / (Chrome.SCREEN_W * 8),
|
||||
h / (Chrome.SCREEN_H * 8))))
|
||||
end
|
||||
|
||||
-- The centred origin that goes with it, so a caller does not re-derive it.
|
||||
function Chrome.fitOrigin(winW, winH, scale)
|
||||
scale = scale or Chrome.fitScale(winW, winH)
|
||||
return math.floor((winW - Chrome.SCREEN_W * 8 * scale) / 2),
|
||||
math.floor((winH - Chrome.SCREEN_H * 8 * scale) / 2)
|
||||
local x, y, w, h = playfieldRect(winW, winH)
|
||||
return x + math.floor((w - Chrome.SCREEN_W * 8 * scale) / 2),
|
||||
y + math.floor((h - Chrome.SCREEN_H * 8 * scale) / 2)
|
||||
end
|
||||
|
||||
-- A bordered box, tile coords. Leaves the draw color black for text.
|
||||
|
||||
Reference in New Issue
Block a user