diff --git a/scripts/songselect/chalwheel.lua b/scripts/songselect/chalwheel.lua index 69339c9..3144377 100644 --- a/scripts/songselect/chalwheel.lua +++ b/scripts/songselect/chalwheel.lua @@ -353,26 +353,22 @@ draw_challenge = function(challenge, x, y, w, h, selected) ---------------------------------------------------------- -- draw charts section ---------------------------------------------------------- - local diffIconHeight = 0.124 * h - local diffIconWidth = 140 / 31 * diffIconHeight -- only scaling, no stretching textures - -- diffIconWidth = 0.8 * diffIconWidth -- okay, maybe a little squishing must be done + local diffIconScale = 0.0048 * h local paddingY = 0.18 * h - local offsetX = x + 0.252 * w - local offsetY = y + 0.246 * h + local offsetX = x + 0.242 * w + local offsetY = y + 0.233 * h local titleMargin = 6 local titleMaxWidth = 6 / 9 * w local titleCenterX = x + w - titleMargin - titleMaxWidth / 2 -- align right if selected then - diffIconHeight = h / 12 - diffIconWidth = 140 / 31 * diffIconHeight -- only scaling, no stretching textures - -- diffIconWidth = 0.8 * diffIconWidth -- okay, maybe a little squishing must be done + diffIconScale = 0.0032 * h - paddingY = 0.122 * h - offsetX = x + 0.268 * w - offsetY = y + 0.256 * h + paddingY = 0.123 * h + offsetX = x + 0.259 * w + offsetY = y + 0.248 * h titleFontSize = math.floor(0.075 * h) -- must be an integer titleMaxWidth = 3 / 5 * w @@ -382,39 +378,17 @@ draw_challenge = function(challenge, x, y, w, h, selected) for i, chart in ipairs(challengeCache[challenge.id]["charts"]) do local ypos = offsetY + paddingY * (i - 1) - draw_diff_icon(chart, offsetX, ypos, diffIconWidth, diffIconHeight, selected) + DiffRectangle.render(timer, offsetX, ypos, diffIconScale, chart.difficulty, chart.level) + local _, titleHeight = gfx.LabelSize(chart.title) gfx.TextAlign(gfx.TEXT_ALIGN_CENTER | gfx.TEXT_ALIGN_MIDDLE) - gfx.DrawLabel(chart.title, titleCenterX, ypos + diffIconHeight / 2, titleMaxWidth) + gfx.DrawLabel(chart.title, titleCenterX, ypos + titleHeight / 2, titleMaxWidth) end gfx.ForceRender() end -draw_diff_icon = function(diff, x, y, w, h) - -- cut out the transparent part of the diff background image - local boxWidth = 140 / 122 * w - local boxHeight = 31 / 27 * h - local boxOffsetX = x - (boxWidth - w) / 2 - local boxOffsetY = y - (boxHeight - h) / 2 - - local labelOffsetX = w / 12 - local labelTextOffsetY = h / 12 - - gfx.BeginPath() - - gfx.ImageRect(boxOffsetX, boxOffsetY, boxWidth, boxHeight, difficultyLabelImages[diff.difficulty + 1], 1, 0) - - gfx.FontFace("dfmarugoth.ttf") - gfx.FontSize(math.floor(0.6 * h)) - gfx.TextAlign(gfx.TEXT_ALIGN_LEFT | gfx.TEXT_ALIGN_MIDDLE) - gfx.FastText(difficultyLabelText[diff.difficulty + 1], x + labelOffsetX, y + (h / 2) - labelTextOffsetY) - gfx.FontSize(math.floor(0.8 * h)) - gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT | gfx.TEXT_ALIGN_MIDDLE) - gfx.FastText(tostring(diff.level), x + w - labelOffsetX, y + (h / 2) - labelTextOffsetY) -end - draw_selected = function(challenge, x, y, w, h) if not challenge then return