From ee3d8ce3f0fac1c625e8b73abf4f1d133553b7cc Mon Sep 17 00:00:00 2001 From: Hersi Date: Thu, 2 Dec 2021 21:53:30 +0100 Subject: [PATCH] unbork portrait --- scripts/gameplay/banner.lua | 8 ++++++++ scripts/gameplay/laser_alert.lua | 25 ++++++++++++------------- scripts/gameplay/score_panel.lua | 8 +++----- scripts/gameplay/user_panel.lua | 2 +- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/scripts/gameplay/banner.lua b/scripts/gameplay/banner.lua index 275d66a..400f8f3 100644 --- a/scripts/gameplay/banner.lua +++ b/scripts/gameplay/banner.lua @@ -1,6 +1,9 @@ local bannerBaseImage = gfx.CreateSkinImage("gameplay/banner/base.png", 0) +local desw = 1080 +local desh = 1920 + local BANNER_W = 1080; local BANNER_H = 368; @@ -43,6 +46,9 @@ end local render = function (deltaTime, users, currentUserId) local resx, resy = game.GetResolution(); + local scale = resx / desw + gfx.Scale(scale, scale) + drawScoreboard(users, currentUserId); -- TODO: for now -- hide if landscape @@ -65,6 +71,8 @@ local render = function (deltaTime, users, currentUserId) 0 ); + gfx.ResetTransform() + end return { diff --git a/scripts/gameplay/laser_alert.lua b/scripts/gameplay/laser_alert.lua index 7985918..ff06d1d 100644 --- a/scripts/gameplay/laser_alert.lua +++ b/scripts/gameplay/laser_alert.lua @@ -169,37 +169,36 @@ local tickTransitions = function (deltaTime) transitionRightOpacity = math.max(0, showScale-0.5)/0.5; end -local render = function (deltaTime) - gfx.Save(); - +local render = function (deltaTime) + gfx.ResetTransform() + local resx, resy = game.GetResolution(); isLandscape = resx > resy; + local scale = resy / desh + if (isLandscape) then - desw = 1920; - desh = 1080; ALERT_Y_POS = desh*0.6 else - desw = 1080; - desh = 1920; ALERT_Y_POS = desh*0.58 end - local scale = resy / desh - RIGHT_ALERT_X_POS = (resx - 450*0.5) / scale + RIGHT_ALERT_X_POS = -450*0.5 tickTransitions(deltaTime); - gfx.Save(); - + gfx.Scale(scale, scale) - renderLeftAlert(); + gfx.ResetTransform() + + gfx.Translate(resx, 0) + gfx.Scale(scale, scale) renderRightAlert(); + test = test + deltaTime; gfx.ResetTransform() - gfx.Restore(); -- gfx.BeginPath(); -- gfx.FontSize(18) -- gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) diff --git a/scripts/gameplay/score_panel.lua b/scripts/gameplay/score_panel.lua index ba69c23..155cd05 100644 --- a/scripts/gameplay/score_panel.lua +++ b/scripts/gameplay/score_panel.lua @@ -29,15 +29,13 @@ local render = function (deltaTime, score, maxChain) tickTransitions(deltaTime) + local scale = resy / desh local x = resx; local y = isLandscape and 5 or 330; - if (isLandscape) then - gfx.Translate(x, 0); - x=0 - end + gfx.Translate(x, 0); + x = 0 - local scale = resy / desh gfx.Scale(scale, scale) gfx.BeginPath(); diff --git a/scripts/gameplay/user_panel.lua b/scripts/gameplay/user_panel.lua index 32243dc..1b8b997 100644 --- a/scripts/gameplay/user_panel.lua +++ b/scripts/gameplay/user_panel.lua @@ -54,7 +54,7 @@ local tickTransitions = function (deltaTime) end local render = function (deltaTime, score, bestReplay) - gfx.Save(); + gfx.ResetTransform() local resx, resy = game.GetResolution(); isLandscape = resx > resy;