2021-10-12 19:56:18 +02:00
|
|
|
|
2021-10-28 11:02:11 +02:00
|
|
|
local DiffRectangle = require('components.diff_rectangle');
|
|
|
|
|
2021-10-12 19:56:18 +02:00
|
|
|
local desw = 1080;
|
|
|
|
local desh = 1920;
|
|
|
|
|
2021-11-25 18:49:50 +01:00
|
|
|
local isLandscape = false;
|
|
|
|
|
2021-10-12 19:56:18 +02:00
|
|
|
local bgLeftImage = gfx.CreateSkinImage("gameplay/song_panel/bg_left.png", 0);
|
|
|
|
local bgRightImage = gfx.CreateSkinImage("gameplay/song_panel/bg_right.png", 0);
|
|
|
|
|
2021-10-28 17:36:06 +02:00
|
|
|
local progressDotImage = gfx.CreateSkinImage("gameplay/song_panel/dot.png", 0);
|
|
|
|
|
2021-10-28 10:27:06 +02:00
|
|
|
local jacketFallbackImage = gfx.CreateSkinImage("song_select/loading.png", 0);
|
|
|
|
|
|
|
|
local jacketImage;
|
|
|
|
local loadedJacketImage = false;
|
|
|
|
|
|
|
|
local loadJacketImage = function (jacketPath)
|
|
|
|
if jacketImage == nil or jacketImage == jacketFallbackImage then
|
|
|
|
jacketImage = gfx.LoadImageJob(jacketPath, jacketFallbackImage)
|
|
|
|
end
|
|
|
|
end
|
2021-10-12 19:56:18 +02:00
|
|
|
|
|
|
|
local renderOutlinedText = function (x,y, text, outlineWidth)
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.FillColor(0,0,0,255);
|
|
|
|
gfx.Text(text, x-outlineWidth, y+outlineWidth);
|
|
|
|
gfx.Text(text, x-outlineWidth, y-outlineWidth);
|
|
|
|
gfx.Text(text, x+outlineWidth, y+outlineWidth);
|
|
|
|
gfx.Text(text, x+outlineWidth, y-outlineWidth);
|
|
|
|
|
|
|
|
gfx.FillColor(255,255,255,255);
|
|
|
|
gfx.Text(text, x, y);
|
|
|
|
end
|
|
|
|
|
|
|
|
local tickTransitions = function (deltaTime)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-10-28 17:40:15 +02:00
|
|
|
local render = function (deltaTime, bpm, laneSpeed, jacketPath, diff, level, progress, songTitle, songArtist)
|
2021-11-25 18:49:50 +01:00
|
|
|
gfx.Save();
|
|
|
|
|
|
|
|
local resx, resy = game.GetResolution();
|
|
|
|
isLandscape = resx > resy;
|
|
|
|
|
|
|
|
if (isLandscape) then
|
|
|
|
gfx.Scale(0.7, 0.7);
|
|
|
|
end
|
|
|
|
|
2021-10-28 10:27:06 +02:00
|
|
|
if (not loadedJacketImage and jacketPath) then
|
|
|
|
loadJacketImage(jacketPath)
|
|
|
|
end
|
|
|
|
|
2021-10-12 19:56:18 +02:00
|
|
|
tickTransitions(deltaTime)
|
|
|
|
|
2021-10-28 10:27:06 +02:00
|
|
|
|
2021-11-25 18:49:50 +01:00
|
|
|
local y = isLandscape and 0 or 210;
|
2021-10-12 19:56:18 +02:00
|
|
|
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
|
|
|
y,
|
2021-10-28 10:27:06 +02:00
|
|
|
844*0.85,
|
2021-10-12 19:56:18 +02:00
|
|
|
374*0.85,
|
|
|
|
bgLeftImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
200,
|
|
|
|
y,
|
|
|
|
1016*0.85,
|
|
|
|
122*0.85,
|
|
|
|
bgRightImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 10:27:06 +02:00
|
|
|
|
|
|
|
-- Draw jacket
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
32,
|
2021-11-25 18:49:50 +01:00
|
|
|
y+31.25, -- why does this need to be here?
|
2021-10-28 10:27:06 +02:00
|
|
|
105,
|
|
|
|
105,
|
|
|
|
jacketImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 11:02:11 +02:00
|
|
|
|
|
|
|
-- Draw diff rectangle
|
2021-11-25 18:49:50 +01:00
|
|
|
DiffRectangle.render(deltaTime, 31, y+140, 0.84, diff, level);
|
2021-10-12 19:56:18 +02:00
|
|
|
|
|
|
|
gfx.FontSize(30);
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
|
|
|
renderOutlinedText(25,y+247, "BPM", 2);
|
|
|
|
renderOutlinedText(25,y+281, "LANE-SPEED", 2);
|
|
|
|
|
2021-10-12 20:09:42 +02:00
|
|
|
local actualLaneSpeed = (bpm*laneSpeed)/100
|
|
|
|
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE);
|
2021-10-12 19:56:18 +02:00
|
|
|
renderOutlinedText(260,y+247, string.format("%.0f", bpm), 2);
|
2021-10-12 20:09:42 +02:00
|
|
|
renderOutlinedText(260,y+281, string.format("%.2f", actualLaneSpeed), 2);
|
2021-10-28 17:21:25 +02:00
|
|
|
|
|
|
|
-- Draw progress
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.FillColor(244, 204, 101)
|
2021-11-25 18:49:50 +01:00
|
|
|
gfx.Rect(222, y+81, 622 * progress, 3)
|
2021-10-28 17:21:25 +02:00
|
|
|
gfx.Fill()
|
2021-10-28 17:36:06 +02:00
|
|
|
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
208 + 622 * progress + ((1-progress) * 8),
|
2021-11-25 18:49:50 +01:00
|
|
|
y+78.5,
|
2021-10-28 17:36:06 +02:00
|
|
|
24*0.85,
|
|
|
|
10*0.85,
|
|
|
|
progressDotImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 17:40:15 +02:00
|
|
|
|
|
|
|
-- Draw song title
|
|
|
|
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
|
|
|
gfx.FontSize(22)
|
2021-11-25 18:49:50 +01:00
|
|
|
gfx.Text(songTitle .. ' / ' .. songArtist, 385, y+60);
|
|
|
|
|
|
|
|
gfx.Restore();
|
2021-10-12 19:56:18 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
render=render
|
|
|
|
}
|