* properly scale gauges

This commit is contained in:
FajsiEx 2021-07-26 17:10:50 +02:00
parent 5305fb3fc3
commit fbe94a1414
1 changed files with 23 additions and 27 deletions

View File

@ -709,16 +709,6 @@ local gaugeExcArsFillImage = gfx.CreateSkinImage("gameplay/gauges/excessive_ars/
function draw_gauge(deltaTime) function draw_gauge(deltaTime)
local width = 82 * scale / 1
local height = 702 * scale / 1
local posx = resx - width
local posy = resy / 2 - height / 2 + 60
if portrait then
posx = resx - width
posy = posy - 90
end
-- fallbacks in case of unsupported type -- fallbacks in case of unsupported type
local gaugeBgImage = gaugeEffBgImage; local gaugeBgImage = gaugeEffBgImage;
local gaugeFillImage = gaugeEffPassFillImage; local gaugeFillImage = gaugeEffPassFillImage;
@ -738,30 +728,36 @@ function draw_gauge(deltaTime)
end end
local tw, th = gfx.ImageSize(gaugeBgImage) local BgW, BgH = gfx.ImageSize(gaugeBgImage);
gfx.ImageRect(posx, posy, tw, th, gaugeBgImage, 1, 0) local FillW, FillH = gfx.ImageSize(gaugeFillImage);
gfx.ImageRect(posx+22, posy+11+(629-(629*(gameplay.gauge.value))), 23, 629*(gameplay.gauge.value), gaugeFillImage, 1, 0) local gaugePosX = 1080 - BgW - 48;
local gaugePosY = 1920/2 - BgH/2 - 32;
-- gfx.Text('RESX: ' .. resx .. ' // RESY: ' .. resy .. ' // GPX: ' .. gaugePosX, 255,1200);
gfx.ImageRect(gaugePosX, gaugePosY, BgW, BgH, gaugeBgImage, 1, 0)
gfx.ImageRect(gaugePosX+22, gaugePosY+11+(FillH-(FillH*(gameplay.gauge.value))), FillW, FillH*(gameplay.gauge.value), gaugeFillImage, 1, 0)
--draw gauge % label -- --draw gauge % label
posx = posx / scale -- posx = posx / scale
posx = posx + (-20 * 0.5) -- posx = posx + (-20 * 0.5)
-- 630 = 0% position -- -- 630 = 0% position
height = 960 * 0.5 -- height = 960 * 0.5
posy = posy / scale -- posy = posy / scale
tw, th = gfx.ImageSize(gaugeNumBack) -- tw, th = gfx.ImageSize(gaugeNumBack)
-- 80 = 100% position -- 80 = 100% position
posy = posy + (95 * 0.5) + height - height * gameplay.gauge.value -- posy = posy + (95 * 0.5) + height - height * gameplay.gauge.value
-- Draw the background -- -- Draw the background
gfx.BeginPath() -- gfx.BeginPath()
gfx.FillColor(255, 255, 255) -- gfx.FillColor(255, 255, 255)
gfx.ImageRect(posx - 44, posy - 10, tw, th, gaugeNumBack, 1, 0) -- gfx.ImageRect(posx - 44, posy - 10, tw, th, gaugeNumBack, 1, 0)
gfx.BeginPath() -- gfx.BeginPath()
-- gfx.FillColor(250, 228, 112) -- gfx.FillColor(250, 228, 112)
draw_number(posx - 24, posy + 4, 1.0, math.floor(gameplay.gauge.value * 100), 3, numberImages, true) -- draw_number(posx - 24, posy + 4, 1.0, math.floor(gameplay.gauge.value * 100), 3, numberImages, true)
-- gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE) -- gfx.TextAlign(gfx.TEXT_ALIGN_RIGHT + gfx.TEXT_ALIGN_MIDDLE)
-- gfx.FontSize(18) -- gfx.FontSize(18)
-- gfx.Text(string.format("%d", math.floor(gameplay.gauge.value * 100)), posx, posy + 4) -- gfx.Text(string.format("%d", math.floor(gameplay.gauge.value * 100)), posx, posy + 4)