scale sliders properly
This commit is contained in:
parent
db0ba90c41
commit
24647a50a6
1 changed files with 3 additions and 3 deletions
|
@ -108,7 +108,7 @@ function self.render()
|
||||||
local mx, my = love.mouse.getPosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
for i, v in ipairs(sliders) do
|
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.setColor(0.7, 0.7, 0.7, 0.4)
|
||||||
love.graphics.line(x, y + h/2, x + w, y + h/2)
|
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)
|
love.graphics.line(x + normaldefault * w, y, x + normaldefault * w, y + h)
|
||||||
|
|
||||||
local sx, sy = x + w * normaloldvalue, y + h/2
|
local sx, sy = x + w * normaloldvalue, y + h/2
|
||||||
local ssize = h * 0.5
|
local ssize = h * 0.75
|
||||||
|
|
||||||
love.graphics.push()
|
love.graphics.push()
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ function self.render()
|
||||||
|
|
||||||
love.graphics.pop()
|
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
|
if dragging then
|
||||||
v.value = ((mx - (x + 1)) / (w - 2)) * (v.max - v.min) + v.min
|
v.value = ((mx - (x + 1)) / (w - 2)) * (v.max - v.min) + v.min
|
||||||
|
|
Loading…
Reference in a new issue