diff options
author | hryx <codroid@gmail.com> | 2013-03-25 23:37:09 -0700 |
---|---|---|
committer | hryx <codroid@gmail.com> | 2013-03-25 23:37:09 -0700 |
commit | c911165c4111536d4c0c42724b07572a7adfa097 (patch) | |
tree | f1200cb438591baf7b21c19c60ab57f88ccc82d1 | |
parent | ddd4791e8c39e2343c672e555f4564b875d00e7a (diff) | |
download | Quickie-c911165c4111536d4c0c42724b07572a7adfa097.tar.gz Quickie-c911165c4111536d4c0c42724b07572a7adfa097.tar.bz2 Quickie-c911165c4111536d4c0c42724b07572a7adfa097.tar.xz Quickie-c911165c4111536d4c0c42724b07572a7adfa097.zip |
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.
-rw-r--r-- | style-default.lua | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/style-default.lua b/style-default.lua index 95aecef..91cbd84 100644 --- a/style-default.lua +++ b/style-default.lua @@ -82,24 +82,21 @@ end local function Slider(state, fraction, vertical, x,y,w,h) local c = color[state] - love.graphics.setLine(2, 'rough') - love.graphics.setColor(c.border) + love.graphics.setLine(1, 'rough') + love.graphics.setColor(c.bg) if vertical then - love.graphics.line(x+w/2-1,y,x+w/2-1,y+h) - love.graphics.line(x+w/2+1,y,x+w/2+1,y+h) - love.graphics.setColor(c.bg) - love.graphics.line(x+w/2,y,x+w/2,y+h) + love.graphics.rectangle('fill', x+w/2-2,y,4,h) + love.graphics.setColor(c.border) + love.graphics.rectangle('line', x+w/2-2,y,4,h) y = math.floor(y + h - h * fraction - 5) h = 10 else - love.graphics.line(x,y+h/2-1,x+w,y+h/2-1) - love.graphics.line(x,y+h/2+1,x+w,y+h/2+1) - love.graphics.setColor(c.bg) - love.graphics.line(x,y+h/2,x+w,y+h/2) + love.graphics.rectangle('fill', x,y+h/2-2,w,4) + love.graphics.setColor(c.border) + love.graphics.rectangle('line', x,y+h/2-2,w,4) x = math.floor(x + w * fraction - 5) w = 10 end - box(x,y,w,h, c.bg,c.border) end |