got rid of the reference shenanigans from dimensions

This commit is contained in:
Hersi 2022-03-26 00:38:30 +01:00
parent edcb7b8407
commit 408feed832
1 changed files with 3 additions and 8 deletions

View File

@ -5,13 +5,13 @@ local dimtable = {
ratio = {landscapeUW = 21 / 9, landscapeWide = 16 / 9, landscapeStd = 4 / 3, portrait = 9 / 16}, ratio = {landscapeUW = 21 / 9, landscapeWide = 16 / 9, landscapeStd = 4 / 3, portrait = 9 / 16},
} }
local function transformToScreenSpace() dimtable.transformToScreenSpace = function()
gfx.Translate((dimtable.screen.width - dimtable.view.width) / 2, 0); gfx.Translate((dimtable.screen.width - dimtable.view.width) / 2, 0);
gfx.Scale(dimtable.view.width / dimtable.design.width, dimtable.view.height / dimtable.design.height); gfx.Scale(dimtable.view.width / dimtable.design.width, dimtable.view.height / dimtable.design.height);
gfx.Scissor(0, 0, dimtable.design.width, dimtable.design.height); gfx.Scissor(0, 0, dimtable.design.width, dimtable.design.height);
end end
local function updateResolution(ratio) dimtable.updateResolution = function(ratio)
if not ratio then ratio = dimtable.ratio.portrait end if not ratio then ratio = dimtable.ratio.portrait end
local screenWidth, screenHeight = game.GetResolution() local screenWidth, screenHeight = game.GetResolution()
@ -21,9 +21,4 @@ local function updateResolution(ratio)
end end
end end
-- return by reference trickery: return dimtable
local t = dimtable
t.transformToScreenSpace = transformToScreenSpace
t.updateResolution = updateResolution
return t