scale sliders properly

This commit is contained in:
jill 2021-09-18 13:46:36 +03:00
parent db0ba90c41
commit 24647a50a6
1 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ function self.render()
local mx, my = love.mouse.getPosition()
for i, v in ipairs(sliders) do
local x, y, w, h = v.x, v.y, v.width, 32
local x, y, w, h = v.x, v.y, v.width, fontHeight * 1.25
love.graphics.setColor(0.7, 0.7, 0.7, 0.4)
love.graphics.line(x, y + h/2, x + w, y + h/2)
@ -121,7 +121,7 @@ function self.render()
love.graphics.line(x + normaldefault * w, y, x + normaldefault * w, y + h)
local sx, sy = x + w * normaloldvalue, y + h/2
local ssize = h * 0.5
local ssize = h * 0.75
love.graphics.push()
@ -146,7 +146,7 @@ function self.render()
love.graphics.pop()
love.graphics.printf(v.displayname, v.x + margin * 2 - ssize * 6, v.y - 8, ssize * 12, 'center')
love.graphics.printf(v.displayname, v.x + margin * 2 - ssize * 6, v.y - ssize, ssize * 12, 'center')
if dragging then
v.value = ((mx - (x + 1)) / (w - 2)) * (v.max - v.min) + v.min