+ 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() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
desw = 1080 if (resx > resy) then
desh = 1920 desw = 1920
scale = resx / desw desh = 1080
scale = resx / desw
else
desw = 1080
desh = 1920
scale = resx / desw
end
end end
function render(deltaTime) function render(deltaTime)

View File

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

View File

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

View File

@ -40,14 +40,10 @@ end
local render = function (deltaTime, bpm, laneSpeed, jacketPath, diff, level, progress, songTitle, songArtist) local render = function (deltaTime, bpm, laneSpeed, jacketPath, diff, level, progress, songTitle, songArtist)
gfx.Save(); gfx.Save();
local resx, resy = game.GetResolution(); local resx, resy = game.GetResolution();
isLandscape = resx > resy; isLandscape = resx > resy;
if (isLandscape) then
gfx.Scale(0.7, 0.7);
end
if (not loadedJacketImage and jacketPath) then if (not loadedJacketImage and jacketPath) then
loadJacketImage(jacketPath) loadJacketImage(jacketPath)
end end

View File

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