unbork portrait

This commit is contained in:
Hersi 2021-12-02 21:53:30 +01:00
parent 571631a433
commit ee3d8ce3f0
4 changed files with 24 additions and 19 deletions

View File

@ -1,6 +1,9 @@
local bannerBaseImage = gfx.CreateSkinImage("gameplay/banner/base.png", 0) local bannerBaseImage = gfx.CreateSkinImage("gameplay/banner/base.png", 0)
local desw = 1080
local desh = 1920
local BANNER_W = 1080; local BANNER_W = 1080;
local BANNER_H = 368; local BANNER_H = 368;
@ -43,6 +46,9 @@ end
local render = function (deltaTime, users, currentUserId) local render = function (deltaTime, users, currentUserId)
local resx, resy = game.GetResolution(); local resx, resy = game.GetResolution();
local scale = resx / desw
gfx.Scale(scale, scale)
drawScoreboard(users, currentUserId); -- TODO: for now drawScoreboard(users, currentUserId); -- TODO: for now
-- hide if landscape -- hide if landscape
@ -65,6 +71,8 @@ local render = function (deltaTime, users, currentUserId)
0 0
); );
gfx.ResetTransform()
end end
return { return {

View File

@ -170,36 +170,35 @@ local tickTransitions = function (deltaTime)
end end
local render = function (deltaTime) local render = function (deltaTime)
gfx.Save(); gfx.ResetTransform()
local resx, resy = game.GetResolution(); local resx, resy = game.GetResolution();
isLandscape = resx > resy; isLandscape = resx > resy;
local scale = resy / desh
if (isLandscape) then if (isLandscape) then
desw = 1920;
desh = 1080;
ALERT_Y_POS = desh*0.6 ALERT_Y_POS = desh*0.6
else else
desw = 1080;
desh = 1920;
ALERT_Y_POS = desh*0.58 ALERT_Y_POS = desh*0.58
end end
local scale = resy / desh RIGHT_ALERT_X_POS = -450*0.5
RIGHT_ALERT_X_POS = (resx - 450*0.5) / scale
tickTransitions(deltaTime); tickTransitions(deltaTime);
gfx.Save();
gfx.Scale(scale, scale) gfx.Scale(scale, scale)
renderLeftAlert(); renderLeftAlert();
gfx.ResetTransform()
gfx.Translate(resx, 0)
gfx.Scale(scale, scale)
renderRightAlert(); renderRightAlert();
test = test + deltaTime; test = test + deltaTime;
gfx.ResetTransform() gfx.ResetTransform()
gfx.Restore();
-- gfx.BeginPath(); -- gfx.BeginPath();
-- gfx.FontSize(18) -- gfx.FontSize(18)
-- gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) -- gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)

View File

@ -29,15 +29,13 @@ local render = function (deltaTime, score, maxChain)
tickTransitions(deltaTime) tickTransitions(deltaTime)
local scale = resy / desh
local x = resx; local x = resx;
local y = isLandscape and 5 or 330; local y = isLandscape and 5 or 330;
if (isLandscape) then gfx.Translate(x, 0);
gfx.Translate(x, 0); x = 0
x=0
end
local scale = resy / desh
gfx.Scale(scale, scale) gfx.Scale(scale, scale)
gfx.BeginPath(); gfx.BeginPath();

View File

@ -54,7 +54,7 @@ local tickTransitions = function (deltaTime)
end end
local render = function (deltaTime, score, bestReplay) local render = function (deltaTime, score, bestReplay)
gfx.Save(); gfx.ResetTransform()
local resx, resy = game.GetResolution(); local resx, resy = game.GetResolution();
isLandscape = resx > resy; isLandscape = resx > resy;