local gaugeMarkerBgImage = gfx.CreateSkinImage("gameplay/gauges/marker_bg.png", 0) local gaugeWarnTransitionScale = 0; local gauges = { { -- Effective bg = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_back.png", 0), fill = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_fail.png", 0), fillPass = gfx.CreateSkinImage("gameplay/gauges/effective/gauge_fill_pass.png", 0), gaugeBreakpoint = 0.7, gaugePass = 0.7 }, { -- Excessive bg = gfx.CreateSkinImage("gameplay/gauges/excessive/gauge_back.png", 0), bgArs = gfx.CreateSkinImage("gameplay/gauges/excessive/gauge_back_ars.png", 0), fill = gfx.CreateSkinImage("gameplay/gauges/excessive/gauge_fill.png", 0), gaugeBreakpoint = 0.3, gaugeWarn = 0.3 }, { -- Permissive bg = gfx.CreateSkinImage("gameplay/gauges/permissive/gauge_back.png", 0), fill = gfx.CreateSkinImage("gameplay/gauges/permissive/gauge_fill.png", 0), gaugeWarn = 0.3 }, { -- Blastive bg = gfx.CreateSkinImage("gameplay/gauges/blastive/gauge_back.png", 0), fill = gfx.CreateSkinImage("gameplay/gauges/blastive/gauge_fill.png", 0), gaugeWarn = 0.3 } } local render = function (deltaTime, gaugeType, gaugeValue, isArsEnabled) local gaugeIndex = math.min(gaugeType+1, 4) -- Any gauge type above blastive will be blastive as a fallback local currentGauge = gauges[gaugeIndex] local gaugeFillAlpha = 1; local gaugeBgImage = currentGauge.bg; local gaugeFillImage = currentGauge.fill; -- If the gauge has a specia bg for ARS, show it is ARS is enabled if (currentGauge.bgArs and isArsEnabled) then gaugeBgImage = currentGauge.bgArs end -- If the pass threshold is defined if (currentGauge.gaugePass) then if (gaugeValue >= currentGauge.gaugePass) then gaugeFillImage = currentGauge.fillPass end end -- If the warning threshold is defined if (currentGauge.gaugeWarn) then if gaugeValue < 0.3 then gaugeFillAlpha = 1 - math.abs(gaugeWarnTransitionScale - 0.25); -- 100 -> 20 -> 100 gaugeWarnTransitionScale = gaugeWarnTransitionScale + deltaTime*10; if gaugeWarnTransitionScale > 1 then gaugeWarnTransitionScale = 0; end end end local BgW, BgH = gfx.ImageSize(gaugeBgImage); local FillW, FillH = gfx.ImageSize(gaugeFillImage); local gaugePosX = 1080 - BgW - 110; local gaugePosY = 1920/2 - BgH/2 - 95; gfx.BeginPath() gfx.ImageRect(gaugePosX, gaugePosY, BgW, BgH, gaugeBgImage, 1, 0) gfx.GlobalAlpha(gaugeFillAlpha); gfx.BeginPath() gfx.Scissor(gaugePosX+18, gaugePosY+9+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value)) gfx.ImageRect(gaugePosX+18, gaugePosY+9, FillW, FillH, gaugeFillImage, 1, 0) gfx.ResetScissor(); gfx.GlobalAlpha(1); -- Draw the breakpoint line if needed if (currentGauge.gaugeBreakpoint) then gfx.Save() gfx.BeginPath() gfx.GlobalAlpha(0.75); local lineY = gaugePosY+6+(FillH-(FillH*(currentGauge.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*(gaugeValue))) 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(gaugeValue * 100), gaugePosX-16, gaugeMarkerY+17) gfx.FontSize(16) gfx.Text('%', gaugePosX-4, gaugeMarkerY+17) end return { render=render }