8 lines
435 B
Plaintext
8 lines
435 B
Plaintext
|
-- draw a slider widget starting at x,y, extending right w pixels
|
||
|
-- position 'value' on the slider
|
||
|
-- the leftmost point on the slider will have value 'lo', and the rightmost will have 'hi'. In between the value will be linearly interpolated.
|
||
|
draw_slider = function(s)
|
||
|
love.graphics.line(s.x0, s.y0, s.x1, s.y0)
|
||
|
s.x = s.x0 + (s.x1-s.x0)*(s.value-s.lo)/(s.hi-s.lo)
|
||
|
love.graphics.rectangle('fill', s.x-s.h/2, s.y0-s.h/2, s.w,s.h)
|
||
|
end
|