chalwheel: optimization: removed sub function instantiations
This commit is contained in:
parent
02578ce121
commit
67f6f70f7c
|
@ -215,12 +215,17 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
|
||||
check_or_create_cache(challenge)
|
||||
|
||||
local _draw_card_bg = function()
|
||||
----------------------------------------------------------
|
||||
-- draw card bg section
|
||||
----------------------------------------------------------
|
||||
if not selected then
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(x, y, w, h, challengeCardBGImage, 1, 0)
|
||||
end
|
||||
|
||||
local _draw_info = function()
|
||||
----------------------------------------------------------
|
||||
-- draw info section
|
||||
----------------------------------------------------------
|
||||
local stateLabel = challengeCache[challenge.id]["pass_state"]
|
||||
local stateLabelWidth, stateLabelHeight = gfx.ImageSize(stateLabel)
|
||||
local stateLabelAspect = stateLabelWidth / stateLabelHeight
|
||||
|
@ -255,9 +260,10 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
gfx.FontFace("divlit_custom.ttf")
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER | gfx.TEXT_ALIGN_BASELINE)
|
||||
gfx.DrawLabel(challengeCache[challenge.id]["title"], titleCenterX, titleBaselineY, titleMaxWidth)
|
||||
end
|
||||
|
||||
local _draw_jacket = function()
|
||||
----------------------------------------------------------
|
||||
-- draw jacket section
|
||||
----------------------------------------------------------
|
||||
local size = h * 0.68
|
||||
local offsetX = x + w / 32
|
||||
local offsetY = y + h - size - h * 0.05
|
||||
|
@ -270,9 +276,10 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(offsetX, offsetY, size, size, challengeCache[challenge.id]["jackets"][1], 1, 0)
|
||||
end
|
||||
|
||||
local _draw_stats = function()
|
||||
----------------------------------------------------------
|
||||
-- draw stats section
|
||||
----------------------------------------------------------
|
||||
local textSizeCorrection = h / gfx.ImageSize(scoreNumber[1])
|
||||
|
||||
local percentOffsetX = x + 6 / 12 * w
|
||||
|
@ -319,9 +326,10 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
|
||||
-- TODO: Missing completion badge (COMP, HARD, UC, PUC)
|
||||
-- TODO: Missing completion grade (S+, S, AAA+, etc.)
|
||||
end
|
||||
|
||||
local _draw_charts = function()
|
||||
----------------------------------------------------------
|
||||
-- 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
|
||||
|
@ -356,16 +364,6 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
|||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER | gfx.TEXT_ALIGN_MIDDLE)
|
||||
gfx.DrawLabel(chart.title, titleCenterX, ypos + diffIconHeight / 2, titleMaxWidth)
|
||||
end
|
||||
end
|
||||
|
||||
if not selected then
|
||||
_draw_card_bg()
|
||||
end
|
||||
|
||||
_draw_info()
|
||||
_draw_jacket()
|
||||
_draw_stats()
|
||||
_draw_charts()
|
||||
|
||||
gfx.ForceRender()
|
||||
|
||||
|
|
Loading…
Reference in New Issue