> cleaner positioning code for badges in result

This commit is contained in:
FajsiEx 2021-10-22 19:46:20 +02:00
parent ee62651917
commit 65455099d9
1 changed files with 35 additions and 51 deletions

View File

@ -72,13 +72,34 @@ local difficultyLabelImages = {
} }
local clearBadgeImages = { local clearBadgeImages = {
gfx.CreateSkinImage("result/clears/CRASH.png", 0), {
gfx.CreateSkinImage("result/clears/CRASH.png", 0), image = gfx.CreateSkinImage("result/clears/CRASH.png", 0),
gfx.CreateSkinImage("result/clears/COMPLETE.png", 0), xPos = 970
gfx.CreateSkinImage("result/clears/COMPLETE.png", 0), },
gfx.CreateSkinImage("result/clears/UC.png", 0), {
gfx.CreateSkinImage("result/clears/PUC.png", 0), image = gfx.CreateSkinImage("result/clears/CRASH.png", 0),
gfx.CreateSkinImage("result/clears/AUTOPLAY.png", 0) xPos = 970
},
{
image = gfx.CreateSkinImage("result/clears/COMPLETE.png", 0),
xPos = 1090
},
{
image = gfx.CreateSkinImage("result/clears/COMPLETE.png", 0),
xPos = 1090
},
{
image = gfx.CreateSkinImage("result/clears/UC.png", 0),
xPos = 1150
},
{
image = gfx.CreateSkinImage("result/clears/PUC.png", 0),
xPos = 1080
},
{
image = gfx.CreateSkinImage("result/clears/AUTOPLAY.png", 0),
xPos = 1080
},
} }
-- ANIMS -- ANIMS
@ -244,52 +265,15 @@ local drawRightPanelContent = function()
local highScoreDelta = result.score - highScoreScore local highScoreDelta = result.score - highScoreScore
-- Draw clear badge -- Draw clear badge
local badgeImage = clearBadgeImages[result.badge + 1] or clearBadgeImages[1] local badgeData = clearBadgeImages[result.badge + 1] or clearBadgeImages[1]
if (result.autoplay) then if (result.autoplay) then
badgeImage = clearBadgeImages[7]; -- Display AUTOPLAY badge badgeData = clearBadgeImages[7]; -- Display AUTOPLAY badge
end end
if badgeImage == clearBadgeImages[1] then -- Adjustments CRASH
local tw, th = gfx.ImageSize(badgeImage); local tw, th = gfx.ImageSize(badgeData.image);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(rightPanelX + 970 - tw, rightPanelY - 10, tw * 0.85, gfx.ImageRect(rightPanelX + badgeData.xPos - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0); th * 0.85, badgeData.image, 1, 0);
end
if badgeImage == clearBadgeImages[2] then -- Adjustments CRASH
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 970 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
if badgeImage == clearBadgeImages[3] then -- Adjustments COMP
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 1090 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
if badgeImage == clearBadgeImages[4] then -- Adjustments COMP
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 1090 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
if badgeImage == clearBadgeImages[5] then -- Adjustments UC
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 1150 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
if badgeImage == clearBadgeImages[6] then -- Adjustments PUC
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 1080 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
if badgeImage == clearBadgeImages[7] then -- Adjustments AUTOPLAY
local tw, th = gfx.ImageSize(badgeImage);
gfx.BeginPath();
gfx.ImageRect(rightPanelX + 1080 - tw, rightPanelY - 10, tw * 0.85,
th * 0.85, badgeImage, 1, 0);
end
-- Draw song name and artist -- Draw song name and artist
gfx.FontSize(28) gfx.FontSize(28)