+ continue landscape gameplay support

This commit is contained in:
FajsiEx 2021-11-25 19:38:59 +01:00
parent 01ea812b7f
commit 8283ccfb1f
5 changed files with 73 additions and 24 deletions

View File

@ -23,9 +23,15 @@ local score = 0;
function resetLayoutInformation()
resx, resy = game.GetResolution()
desw = 1080
desh = 1920
scale = resx / desw
if (resx > resy) then
desw = 1920
desh = 1080
scale = resx / desw
else
desw = 1080
desh = 1920
scale = resx / desw
end
end
function render(deltaTime)

View File

@ -2,6 +2,12 @@ local gaugeMarkerBgImage = gfx.CreateSkinImage("gameplay/gauges/marker_bg.png",
local gaugeWarnTransitionScale = 0;
local desw = 1080;
local desh = 1920;
local isLandscape = false;
local gauges = {
{ -- Effective
bg = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_back.png", 0),
@ -30,6 +36,21 @@ local gauges = {
}
local render = function (deltaTime, gaugeType, gaugeValue, isArsEnabled)
gfx.Save();
local resx, resy = game.GetResolution();
isLandscape = resx > resy;
if (isLandscape) then
desw = 1920;
desh = 1080;
else
desw = 1080;
desh = 1920;
end
gfx.Translate(desw,0);
local gaugeIndex = math.min(gaugeType+1, 4) -- Any gauge type above blastive will be blastive as a fallback
local currentGauge = gauges[gaugeIndex]
@ -64,8 +85,8 @@ local render = function (deltaTime, gaugeType, gaugeValue, isArsEnabled)
local BgW, BgH = gfx.ImageSize(gaugeBgImage);
local FillW, FillH = gfx.ImageSize(gaugeFillImage);
local gaugePosX = 1080 - BgW - 110;
local gaugePosY = 1920/2 - BgH/2 - 95;
local gaugePosX = - BgW - (isLandscape and 400 or 110);
local gaugePosY = desh/2 - BgH/2 - (isLandscape and 0 or 95);
gfx.BeginPath()
gfx.ImageRect(gaugePosX, gaugePosY, BgW, BgH, gaugeBgImage, 1, 0)
@ -152,6 +173,8 @@ local render = function (deltaTime, gaugeType, gaugeValue, isArsEnabled)
-- %
gfx.FontSize(16)
gfx.Text('%', gaugePosX-15, gaugeMarkerY+16.5)
gfx.Restore();
end
return {

View File

@ -47,16 +47,22 @@ local render = function (deltaTime, score, maxChain)
local resx, resy = game.GetResolution();
isLandscape = resx > resy;
if (isLandscape) then
desw = 1920;
desh = 1080;
else
desw = 1080;
desh = 1920;
end
tickTransitions(deltaTime)
local x = desw;
local y = isLandscape and 0 or 330;
local y = isLandscape and 5 or 330;
if (isLandscape) then
gfx.Translate(x, 0);
x=0
gfx.Scale(0.7, 0.7);
end
gfx.BeginPath();

View File

@ -44,10 +44,6 @@ local render = function (deltaTime, bpm, laneSpeed, jacketPath, diff, level, pro
local resx, resy = game.GetResolution();
isLandscape = resx > resy;
if (isLandscape) then
gfx.Scale(0.7, 0.7);
end
if (not loadedJacketImage and jacketPath) then
loadJacketImage(jacketPath)
end

View File

@ -4,6 +4,8 @@ local VolforceWindow = require('components.volforceWindow');
local desw = 1080;
local desh = 1920;
local isLandscape = false;
local bgImage = gfx.CreateSkinImage("gameplay/user_panel/bg.png", 0);
local appealCardImage = gfx.CreateSkinImage("crew/appeal_card.png", 0);
@ -13,7 +15,7 @@ local idolFrameImage = gfx.CreateSkinImage("crew/frame.png", 0);
local username = game.GetSkinSetting('username') or '';
local drawBestDiff = function (deltaTime, score, bestReplay)
local drawBestDiff = function (deltaTime, score, bestReplay, y)
if not bestReplay then return end
-- Calculate the difference between current and best play
@ -39,12 +41,12 @@ local drawBestDiff = function (deltaTime, score, bestReplay)
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
gfx.FontSize(26)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(prefix, 130, 827)
gfx.Text(string.format("%04d", math.floor(difference/10000)), 150, 827)
gfx.Text(prefix, 130, y+177)
gfx.Text(string.format("%04d", math.floor(difference/10000)), 150, y+177)
local lastFourDigits = ((difference / 10000) - math.floor(difference / 10000))*10000
gfx.FontSize(22)
gfx.Text(string.format("%04d", math.floor(lastFourDigits)), 209, 829)
gfx.Text(string.format("%04d", math.floor(lastFourDigits)), 208, y+178)
end
local tickTransitions = function (deltaTime)
@ -52,12 +54,28 @@ local tickTransitions = function (deltaTime)
end
local render = function (deltaTime, score, bestReplay)
gfx.Save();
local resx, resy = game.GetResolution();
isLandscape = resx > resy;
if (isLandscape) then
desw = 1920;
desh = 1080;
else
desw = 1080;
desh = 1920;
end
local x = 0;
local y = desh*0.35; -- Approx. pos of the user panel against the height of the screen is 0.35
tickTransitions(deltaTime)
gfx.BeginPath();
gfx.ImageRect(
0,
650,
y,
449*0.85,
336*0.85,
idolFrameImage,
@ -68,7 +86,7 @@ local render = function (deltaTime, score, bestReplay)
gfx.BeginPath();
gfx.ImageRect(
0,
650,
y,
449*0.85,
336*0.85,
bgImage,
@ -80,7 +98,7 @@ local render = function (deltaTime, score, bestReplay)
gfx.BeginPath();
gfx.ImageRect(
10,
767,
y+117,
150*0.62,
192*0.62,
appealCardImage,
@ -92,16 +110,16 @@ local render = function (deltaTime, score, bestReplay)
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
gfx.FontSize(26)
gfx.Text(username, 150, 802);
gfx.Text(username, 150, y+152);
-- Draw best score diff
drawBestDiff(deltaTime, score, bestReplay);
drawBestDiff(deltaTime, score, bestReplay, y);
-- Draw dan badge & volforce
gfx.BeginPath();
gfx.ImageRect(
117,
856,
y+206,
294*0.32, -- what are these whacky measurements
84*0.32,
danBadgeImage,
@ -109,7 +127,7 @@ local render = function (deltaTime, score, bestReplay)
0
);
VolforceWindow.render(deltaTime, 220, 847)
VolforceWindow.render(deltaTime, 220, y+197)
end