+ gauge fill to results

This commit is contained in:
FajsiEx 2021-08-16 18:41:44 +02:00
parent de3d9584ed
commit 65e3e5d0a5
1 changed files with 58 additions and 0 deletions

View File

@ -46,6 +46,13 @@ local gaugeTypeBadgeImages = {
gfx.CreateSkinImage("result/gauge_type_badges/effective.png", 0),
}
local gaugeEffFailFillImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_fail.png", 0)
local gaugeEffPassFillImage = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_pass.png", 0)
local gaugeExcFillImage = gfx.CreateSkinImage("gameplay/gauges/excessive/gauge_fill.png", 0)
local gaugePermFillImage = gfx.CreateSkinImage("gameplay/gauges/permissive/gauge_fill.png", 0)
local gaugeBlastiveFillImage = gfx.CreateSkinImage("gameplay/gauges/blastive/gauge_fill.png", 0)
local difficultyLabelImages = {
gfx.CreateSkinImage("diff/1 novice.png", 0),
gfx.CreateSkinImage("diff/2 advanced.png", 0),
@ -263,6 +270,57 @@ local drawRightPanelContent = function()
-- Draw gauge %
gfx.FontSize(24)
gfx.Text(math.floor(result.gauge * 100) .. '%', rightPanelX + 984, rightPanelY + 295);
-- Draw gauge fill
local gaugeFillImage = gaugeEffPassFillImage;
local gaugeBreakpoint = 0;
if result.gauge_type == 0 then
gaugeBreakpoint = 0.7;
if result.gauge <= 0.7 then
gaugeFillImage = gaugeEffFailFillImage;
else
gaugeFillImage = gaugeEffPassFillImage;
end
elseif result.gauge_type == 1 then
gaugeFillImage = gaugeExcFillImage;
gaugeBreakpoint = 0.3;
elseif result.gauge_type == 2 then
gaugeFillImage = gaugePermFillImage;
elseif result.gauge_type == 3 then -- BLASTIVE RATE
gaugeFillImage = gaugeBlastiveFillImage;
end
local gaugePosX = rightPanelX+1027;
local gaugePosY = rightPanelY+309;
local FillW, FillH = 9, 236;
gfx.BeginPath();
gfx.Scissor(gaugePosX, gaugePosY+(FillH-(FillH*(result.gauge))), FillW, FillH*(result.gauge))
gfx.ImageRect(gaugePosX, gaugePosY, FillW, FillH, gaugeFillImage, 1, 0);
gfx.ResetScissor();
-- Draw the breakpoint line if needed
if (gaugeBreakpoint > 0) then
gfx.Save()
gfx.BeginPath()
gfx.GlobalAlpha(0.75);
local lineY = gaugePosY+(FillH-(FillH*(gaugeBreakpoint)))
gfx.MoveTo(gaugePosX, lineY)
gfx.LineTo(gaugePosX+10, lineY)
gfx.StrokeWidth(2)
gfx.StrokeColor(255,255,255)
gfx.Stroke()
gfx.ClosePath()
gfx.Restore()
end
-- Draw err/early/critical/late/err texts