implemented chalwheel stats
This commit is contained in:
parent
d13fa08842
commit
c224aa928b
|
@ -0,0 +1,36 @@
|
||||||
|
function load_number_image(path)
|
||||||
|
local images = {}
|
||||||
|
for i = 0, 9 do
|
||||||
|
images[i + 1] = gfx.CreateSkinImage(string.format("%s/%d.png", path, i), 0)
|
||||||
|
end
|
||||||
|
return images
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_number(x, y, alpha, num, digits, images, is_dim, scale, kern, dim_zeros)
|
||||||
|
scale = scale or 1
|
||||||
|
kern = kern or 1
|
||||||
|
|
||||||
|
local tw, th = gfx.ImageSize(images[1])
|
||||||
|
tw = tw * scale
|
||||||
|
th = th * scale
|
||||||
|
x = x + (tw * (digits - 1)) / 2
|
||||||
|
y = y - th / 2
|
||||||
|
|
||||||
|
for i = 1, digits do
|
||||||
|
local mul = 10 ^ (i - 1)
|
||||||
|
local digit = math.floor(num / mul) % 10
|
||||||
|
local a = alpha
|
||||||
|
|
||||||
|
if is_dim and num < mul then a = 0.4 end
|
||||||
|
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.ImageRect(x, y, tw, th, images[digit + 1], a, 0)
|
||||||
|
|
||||||
|
x = x - (tw * kern)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
load_number_image = load_number_image,
|
||||||
|
draw_number = draw_number
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
local Numbers = require('common.numbers')
|
||||||
local Easing = require('common.easings');
|
local Easing = require('common.easings');
|
||||||
local Background = require('components.background');
|
local Background = require('components.background');
|
||||||
local Footer = require('components.footer');
|
local Footer = require('components.footer');
|
||||||
|
@ -189,34 +190,6 @@ function drawTimingBar(y, value, max, type)
|
||||||
gfx.ClosePath();
|
gfx.ClosePath();
|
||||||
end
|
end
|
||||||
|
|
||||||
function load_number_image(path)
|
|
||||||
local images = {}
|
|
||||||
for i = 0, 9 do
|
|
||||||
images[i + 1] = gfx.CreateSkinImage(string.format("%s/%d.png", path, i),
|
|
||||||
0)
|
|
||||||
end
|
|
||||||
return images
|
|
||||||
end
|
|
||||||
|
|
||||||
function draw_number(x, y, alpha, num, digits, images, is_dim, scale, kern)
|
|
||||||
scale = scale or 1;
|
|
||||||
kern = kern or 1;
|
|
||||||
local tw, th = gfx.ImageSize(images[1])
|
|
||||||
tw = tw * scale;
|
|
||||||
th = th * scale;
|
|
||||||
x = x + (tw * (digits - 1)) / 2
|
|
||||||
y = y - th / 2
|
|
||||||
for i = 1, digits do
|
|
||||||
local mul = 10 ^ (i - 1)
|
|
||||||
local digit = math.floor(num / mul) % 10
|
|
||||||
local a = alpha
|
|
||||||
if is_dim and num < mul then a = 0.4 end
|
|
||||||
gfx.BeginPath()
|
|
||||||
gfx.ImageRect(x, y, tw, th, images[digit + 1], a, 0)
|
|
||||||
x = x - (tw * kern)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local drawIdol = function(deltaTime)
|
local drawIdol = function(deltaTime)
|
||||||
local idolAnimTickRes = gfx.TickAnimation(idolAnimation, deltaTime);
|
local idolAnimTickRes = gfx.TickAnimation(idolAnimation, deltaTime);
|
||||||
if idolAnimTickRes == 1 then
|
if idolAnimTickRes == 1 then
|
||||||
|
@ -279,7 +252,7 @@ local drawRightPanel = function()
|
||||||
gfx.ImageRect(rightPanelX, rightPanelY, tw, th, rightPanelImage, 1, 0);
|
gfx.ImageRect(rightPanelX, rightPanelY, tw, th, rightPanelImage, 1, 0);
|
||||||
end
|
end
|
||||||
|
|
||||||
local scoreNumber = load_number_image("score_num");
|
local scoreNumber = Numbers.load_number_image("score_num");
|
||||||
|
|
||||||
local drawRightPanelContent = function()
|
local drawRightPanelContent = function()
|
||||||
local highScoreScore = 0;
|
local highScoreScore = 0;
|
||||||
|
@ -305,10 +278,10 @@ local drawRightPanelContent = function()
|
||||||
gfx.Text(result.artist, rightPanelX + 435, rightPanelY + 143);
|
gfx.Text(result.artist, rightPanelX + 435, rightPanelY + 143);
|
||||||
|
|
||||||
-- Draw score
|
-- Draw score
|
||||||
draw_number(rightPanelX + 580, rightPanelY + 192, 1.0,
|
Numbers.draw_number(rightPanelX + 580, rightPanelY + 192, 1.0,
|
||||||
math.floor(result.score / 10000), 4, scoreNumber, true, 0.40,
|
math.floor(result.score / 10000), 4, scoreNumber, true, 0.40,
|
||||||
1.12)
|
1.12)
|
||||||
draw_number(rightPanelX + 775, rightPanelY + 200, 1.0, result.score, 4,
|
Numbers.draw_number(rightPanelX + 775, rightPanelY + 200, 1.0, result.score, 4,
|
||||||
scoreNumber, true, 0.25, 1.12)
|
scoreNumber, true, 0.25, 1.12)
|
||||||
|
|
||||||
-- If this is the highscore, draw over the glowing best badge
|
-- If this is the highscore, draw over the glowing best badge
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
local Numbers = require('common.numbers')
|
||||||
local DiffRectangle = require("components.diff_rectangle")
|
local DiffRectangle = require("components.diff_rectangle")
|
||||||
|
|
||||||
-- Horizontal alignment
|
-- Horizontal alignment
|
||||||
|
@ -88,6 +89,8 @@ local passStates = {
|
||||||
gfx.CreateSkinImage("challenge_select/pass_states/cleared.png", 0),
|
gfx.CreateSkinImage("challenge_select/pass_states/cleared.png", 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local scoreNumber = Numbers.load_number_image("score_num")
|
||||||
|
|
||||||
gfx.LoadSkinFont("divlit_custom.ttf")
|
gfx.LoadSkinFont("divlit_custom.ttf")
|
||||||
gfx.LoadSkinFont("dfmarugoth.ttf");
|
gfx.LoadSkinFont("dfmarugoth.ttf");
|
||||||
|
|
||||||
|
@ -344,18 +347,32 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
||||||
end
|
end
|
||||||
|
|
||||||
local _draw_stats = function ()
|
local _draw_stats = function ()
|
||||||
local percentOffsetX = x + 5/9 * w
|
local percentOffsetX = x + 6/12 * w
|
||||||
local percentOffsetY = y + 5/6 * h
|
local percentOffsetY = y + 14/16 * h
|
||||||
local scoreOffsetX = x
|
|
||||||
local scoreOffsetY = y
|
|
||||||
|
|
||||||
gfx.BeginPath()
|
local scoreUpperOffsetX = 0
|
||||||
gfx.FontFace("divlit_custom.ttf")
|
local scoreUpperOffsetY = 0
|
||||||
gfx.FontSize(56)
|
local scoreOffsetX = x + w * 0.74
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT)
|
local scoreOffsetY = y + h * 0.9
|
||||||
gfx.Text(challengeCache[challenge.id]["percent"], percentOffsetX - 24, percentOffsetY)
|
|
||||||
gfx.FontSize(32)
|
if selected then
|
||||||
gfx.Text("%", percentOffsetX, percentOffsetY)
|
percentOffsetX = x + 11/24 * w
|
||||||
|
percentOffsetY = y + 49/64 * h
|
||||||
|
|
||||||
|
scoreUpperOffsetX = x + w * 0.63
|
||||||
|
scoreUpperOffsetY = y + h * 0.82
|
||||||
|
scoreOffsetX = x + w * 0.755
|
||||||
|
scoreOffsetY = y + h * 0.835
|
||||||
|
end
|
||||||
|
|
||||||
|
Numbers.draw_number(percentOffsetX, percentOffsetY, 1, challengeCache[challenge.id]["percent"], 3, scoreNumber, true, 0.2, 1)
|
||||||
|
|
||||||
|
if selected then
|
||||||
|
Numbers.draw_number(scoreUpperOffsetX, scoreUpperOffsetY, 1, math.floor(challengeCache[challenge.id]["total_score"] / 10000), 4, scoreNumber, true, 0.2, 1)
|
||||||
|
Numbers.draw_number(scoreOffsetX, scoreOffsetY, 1, challengeCache[challenge.id]["total_score"], 4, scoreNumber, true, 0.14, 1)
|
||||||
|
else
|
||||||
|
Numbers.draw_number(scoreOffsetX, scoreOffsetY, 1, challengeCache[challenge.id]["total_score"], 8, scoreNumber, true, 0.14, 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _draw_chart = function ()
|
local _draw_chart = function ()
|
||||||
|
@ -368,7 +385,6 @@ draw_challenge = function(challenge, x, y, w, h, selected)
|
||||||
|
|
||||||
_draw_info()
|
_draw_info()
|
||||||
_draw_jacket()
|
_draw_jacket()
|
||||||
|
|
||||||
_draw_stats()
|
_draw_stats()
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
Loading…
Reference in New Issue