From c35e9b157a52becf615ed2aec30e3f04c69f3e3c Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Thu, 25 Nov 2021 19:48:02 +0100 Subject: [PATCH] + landscape support to laser alerts --- scripts/gameplay/chain.lua | 2 ++ scripts/gameplay/laser_alert.lua | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/scripts/gameplay/chain.lua b/scripts/gameplay/chain.lua index a7492b4..36f0405 100644 --- a/scripts/gameplay/chain.lua +++ b/scripts/gameplay/chain.lua @@ -118,6 +118,8 @@ local render = function (deltaTime, comboState, combo, critLineCenterX, critLine local comboScale = 0.45; draw_number(posx - (tw*4*comboScale)/2+(tw*comboScale*1.5)+10, posy - th / 2, 1.0, combo, 4, chainNumbers, true, comboScale, 1.12) + + gfx.Restore(); end return { diff --git a/scripts/gameplay/laser_alert.lua b/scripts/gameplay/laser_alert.lua index 951682e..32e08f2 100644 --- a/scripts/gameplay/laser_alert.lua +++ b/scripts/gameplay/laser_alert.lua @@ -25,6 +25,11 @@ local transitionRightScale = 1; local transitionRightOffsetX = 0; local transitionRightOpacity = 0; +local desw = 1080; +local desh = 1920; + +local isLandscape = false; + local renderLeftAlert = function () -- gfx.Translate(LEFT_ALERT_X_POS, ALERT_Y_POS); -- -- gfx.SkewX(-1*3.14) @@ -165,6 +170,23 @@ local tickTransitions = function (deltaTime) end local render = function (deltaTime) + gfx.Save(); + + local resx, resy = game.GetResolution(); + isLandscape = resx > resy; + + 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 + + RIGHT_ALERT_X_POS = desw - 450*0.5 + tickTransitions(deltaTime); gfx.Save();