Merge pull request #1405 from AverageConsumer/codex/mod-render-viewport

This commit is contained in:
bryanthaboi
2026-08-16 12:08:03 -04:00
committed by GitHub
14 changed files with 379 additions and 46 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ local Collision = require("src.world.Collision")
local Encounter = require("src.world.Encounter")
local FieldDefaults = require("src.world.FieldDefaults")
local GameVersion = require("src.core.GameVersion")
local GameViewport = require("src.render.GameViewport")
local Logger = require("src.core.Logger")
local Map = require("src.world.Map")
local MapLoader = require("src.world.MapLoader")
@@ -5131,7 +5132,7 @@ function OverworldState:drawWorld()
-- point projects under the pipeline's own camera. That is the direct
-- analogue of what :billboard does for tilt, and it keeps exactly one
-- copy of every effect: the closures above are the ones that run.
local pw, ph = love.graphics.getDimensions()
local pw, ph = GameViewport.dimensions()
local pscale = Zoom.scale(Game.renderer:fitScale())
local ctx = {
state = self, cam = cam, vw = vw, vh = vh, bgY = bgY,
+5 -4
View File
@@ -34,6 +34,7 @@ local Font = require("src.render.Font")
-- a mod has taken a facade (src/mods/Gen2Compat.lua).
local Gen1Facade = require("src.mods.Gen2Compat")
local GbcPalette = require("src.render.GbcPalette")
local GameViewport = require("src.render.GameViewport")
local Gen2Save = require("src.core.gen2.Save")
local HallOfFame = require("src.core.gen2.HallOfFame")
local HiddenItems = require("src.world.gen2.HiddenItems")
@@ -7548,7 +7549,7 @@ function World:interactBody()
end
function World:fitScale()
local w, h = love.graphics.getDimensions()
local w, h = GameViewport.dimensions()
return math.max(1, math.floor(math.min(w / 160, h / 144)))
end
@@ -8375,7 +8376,7 @@ function World:rebuildNeighbors()
self.neighbors = {}
if not self.map then return end
local s = self:zoomScale()
local ww, wh = love.graphics.getDimensions()
local ww, wh = GameViewport.dimensions()
local vw = math.ceil(ww / s)
local vh = math.ceil(wh / s)
if vw % 2 ~= 0 then vw = vw + 1 end
@@ -9742,7 +9743,7 @@ function World:drawGround(s)
if canvas then
bw, bh = canvas:getDimensions()
else
bw, bh = G.getDimensions()
bw, bh = GameViewport.dimensions()
end
BorderFill.draw(self, self:borderImageFor(self.map.id),
cam.x, cam.y, bw, bh, s, self.map.id)
@@ -10002,7 +10003,7 @@ end
function World:draw()
local G = love.graphics
local w, h = G.getDimensions()
local w, h = GameViewport.dimensions()
self:refreshColorMode()
G.clear(0.07, 0.05, 0.02, 1)