Tweak Slider style
Made a marginally simpler & more readable Slider draw routine using rectangles instead of lines. Also the ends of the slider "track" are capped now. I split this commit in case a rollback is desired.
This commit is contained in:
parent
ddd4791e8c
commit
c911165c41
1 changed files with 8 additions and 11 deletions
|
@ -82,24 +82,21 @@ end
|
||||||
local function Slider(state, fraction, vertical, x,y,w,h)
|
local function Slider(state, fraction, vertical, x,y,w,h)
|
||||||
local c = color[state]
|
local c = color[state]
|
||||||
|
|
||||||
love.graphics.setLine(2, 'rough')
|
love.graphics.setLine(1, 'rough')
|
||||||
love.graphics.setColor(c.border)
|
love.graphics.setColor(c.bg)
|
||||||
if vertical then
|
if vertical then
|
||||||
love.graphics.line(x+w/2-1,y,x+w/2-1,y+h)
|
love.graphics.rectangle('fill', x+w/2-2,y,4,h)
|
||||||
love.graphics.line(x+w/2+1,y,x+w/2+1,y+h)
|
love.graphics.setColor(c.border)
|
||||||
love.graphics.setColor(c.bg)
|
love.graphics.rectangle('line', x+w/2-2,y,4,h)
|
||||||
love.graphics.line(x+w/2,y,x+w/2,y+h)
|
|
||||||
y = math.floor(y + h - h * fraction - 5)
|
y = math.floor(y + h - h * fraction - 5)
|
||||||
h = 10
|
h = 10
|
||||||
else
|
else
|
||||||
love.graphics.line(x,y+h/2-1,x+w,y+h/2-1)
|
love.graphics.rectangle('fill', x,y+h/2-2,w,4)
|
||||||
love.graphics.line(x,y+h/2+1,x+w,y+h/2+1)
|
love.graphics.setColor(c.border)
|
||||||
love.graphics.setColor(c.bg)
|
love.graphics.rectangle('line', x,y+h/2-2,w,4)
|
||||||
love.graphics.line(x,y+h/2,x+w,y+h/2)
|
|
||||||
x = math.floor(x + w * fraction - 5)
|
x = math.floor(x + w * fraction - 5)
|
||||||
w = 10
|
w = 10
|
||||||
end
|
end
|
||||||
|
|
||||||
box(x,y,w,h, c.bg,c.border)
|
box(x,y,w,h, c.bg,c.border)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue