+ gauge breakpoint line & + gauge marker

This commit is contained in:
FajsiEx 2021-08-11 19:28:06 +02:00
parent c0261844ea
commit 64d205f0fb
1 changed files with 35 additions and 1 deletions

View File

@ -717,9 +717,11 @@ function draw_gauge(deltaTime)
local gaugeFillAlpha = 1; local gaugeFillAlpha = 1;
local gaugeBgImage = gaugeEffBgImage; local gaugeBgImage = gaugeEffBgImage;
local gaugeFillImage = gaugeEffPassFillImage; local gaugeFillImage = gaugeEffPassFillImage;
local gaugeBreakpoint = 0;
if gameplay.gauge.type == 0 then if gameplay.gauge.type == 0 then
gaugeBgImage = gaugeEffBgImage; gaugeBgImage = gaugeEffBgImage;
gaugeBreakpoint = 0.7;
if gameplay.gauge.value <= 0.7 then if gameplay.gauge.value <= 0.7 then
gaugeFillImage = gaugeEffFailFillImage; gaugeFillImage = gaugeEffFailFillImage;
@ -730,6 +732,7 @@ function draw_gauge(deltaTime)
elseif gameplay.gauge.type == 1 then elseif gameplay.gauge.type == 1 then
gaugeBgImage = gaugeExcBgImage; gaugeBgImage = gaugeExcBgImage;
gaugeFillImage = gaugeExcFillImage; gaugeFillImage = gaugeExcFillImage;
gaugeBreakpoint = 0.3;
if gameplay.gauge.value < 0.3 then if gameplay.gauge.value < 0.3 then
gaugeFillAlpha = 1 - math.abs(gaugeWarnTransitionScale - 0.5); -- 100 -> 50 -> 100 gaugeFillAlpha = 1 - math.abs(gaugeWarnTransitionScale - 0.5); -- 100 -> 50 -> 100
@ -769,8 +772,39 @@ function draw_gauge(deltaTime)
gfx.ImageRect(gaugePosX+18, gaugePosY+9+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value), gaugeFillImage, 1, 0) gfx.ImageRect(gaugePosX+18, gaugePosY+9+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value), gaugeFillImage, 1, 0)
gfx.GlobalAlpha(1); gfx.GlobalAlpha(1);
-- Draw the breakpoint line if needed
if (gaugeBreakpoint > 0) then
gfx.Save()
gfx.BeginPath()
-- TODO: Draw gauge % label local lineY = gaugePosY+6+(FillH-(FillH*(gaugeBreakpoint)))
gfx.MoveTo(gaugePosX+18, lineY)
gfx.LineTo(gaugePosX+36, lineY)
gfx.StrokeWidth(2)
gfx.StrokeColor(255,255,255)
gfx.Stroke()
gfx.ClosePath()
gfx.Restore()
end
-- Draw gauge % label
local gaugeMarkerY = gaugePosY-6+(FillH-(FillH*(gameplay.gauge.value)))
gfx.BeginPath()
gfx.ImageRect(gaugePosX-64, gaugeMarkerY, 83*0.85, 37*0.85, gaugeMarkerBgImage, 1, 0)
gfx.BeginPath()
gfx.FillColor(255, 255, 255)
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
gfx.FontSize(22)
gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(math.floor(gameplay.gauge.value * 100), gaugePosX-16, gaugeMarkerY+17)
gfx.FontSize(16)
gfx.Text('%', gaugePosX-4, gaugeMarkerY+17)
end end
-- -------------------------------------------------------------------------- -- -- -------------------------------------------------------------------------- --
-- draw_combo: -- -- draw_combo: --