diff --git a/scripts/gameplay/gauge.lua b/scripts/gameplay/gauge.lua index 6782ed7..3fd5ebd 100644 --- a/scripts/gameplay/gauge.lua +++ b/scripts/gameplay/gauge.lua @@ -105,12 +105,53 @@ local render = function (deltaTime, gaugeType, gaugeValue, isArsEnabled) 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) + -- The big number + local gaugePercent = gaugeValue * 100; + local bigNumber = 0; + local smallNumber = 0; + local smallNumberX = gaugePosX-38; + if (gaugePercent < 10) then + bigNumber = math.floor(gaugePercent) .. '.'; + + local decimalPortion = math.floor( + ( + gaugePercent - + math.floor(gaugePercent) + ) * 100 + ); + smallNumber = string.format('%02d', decimalPortion); + smallNumberX = gaugePosX-38; + elseif (gaugePercent < 100) then + bigNumber = math.floor(gaugePercent) .. '.'; + + local decimalPortion = math.floor( + ( + gaugePercent - + math.floor(gaugePercent) + ) * 10 + ); + smallNumber = decimalPortion; + smallNumberX = gaugePosX-26; + else + bigNumber = '100'; + smallNumber = 0; + smallNumberX = -100; -- yeet it out of existance + end + + gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) + + -- big text + gfx.FontSize(22) + gfx.Text(bigNumber, gaugePosX-56, gaugeMarkerY+16.5) + + -- small text + gfx.FontSize(18) + gfx.Text(smallNumber, smallNumberX, gaugeMarkerY+17.5) + + -- % gfx.FontSize(16) - gfx.Text('%', gaugePosX-4, gaugeMarkerY+17) + gfx.Text('%', gaugePosX-15, gaugeMarkerY+16.5) end return {