Page 2 of 3

Re: simple-slider

Posted: Thu Aug 13, 2015 10:54 pm
by Positive07
Question! Could I make a material theme for this and make it part of my [shameless plug]Material-Love[/shameless plug] set of libraries? Of course with propper credits!

Re: simple-slider

Posted: Thu Aug 13, 2015 11:03 pm
by Kasperelo
Positive07 wrote:Question! Could I make a material theme for this and make it part of my [shameless plug]Material-Love[/shameless plug] set of libraries? Of course with propper credits!
Wow that is really pretty :awesome:

Re: simple-slider

Posted: Thu Aug 13, 2015 11:37 pm
by Positive07
Kasperelo wrote: Wow that is really pretty :awesome:
Ohh! Thanks :neko: the best part is that is really slow on my PC hahaha those freaking shadows!!

Re: simple-slider

Posted: Fri Aug 14, 2015 6:34 am
by georgeprosser
Positive07 wrote:Could I make a material theme for this and make it part of my [shameless plug]Material-Love[/shameless plug] set of libraries? Of course with propper credits!
Yeah sure, though you might find it easier to start from scratch and use this as a guide.

Re: simple-slider

Posted: Fri Aug 14, 2015 7:05 am
by SiENcE
@georgeprosser : Very nice and smart. It's indeed very usefull for some small applications.

Some suggestions.

* keep a list of all sliders and make one silderinstance:update() and silderinstance:draw() function, so you don't need to specify this for every slider
* push it to github :)
* don't make it global, return slider so people can do:

Code: Select all

local silderinstance = require 'simple-slider'

Re: simple-slider

Posted: Fri Aug 14, 2015 12:03 pm
by georgeprosser
SiENcE wrote: Some suggestions.

* keep a list of all sliders and make one silderinstance:update() and silderinstance:draw() function, so you don't need to specify this for every slider
* push it to github :)
* don't make it global
* I'll leave this for people to handle themselves. For all my projects I have a 'container' class. The container is just a wrapper for a table, and when you call container:update(dt) or container:draw() it just calls that method on all objects on the table.

* I'm a github noob :-/

* I have never really worked out how to handle scope with Lua & LÖVE. I feel like stuff needs to be created in love.load(), but then it has to be global. These days I have a few global objects, like a 'game' object or a controller, and then things like players or bullets can be members eg. game.player. I copied the way AnAL deals with this.

Re: simple-slider

Posted: Fri Aug 21, 2015 2:21 am
by Positive07
SiENcE wrote: * keep a list of all sliders and make one silderinstance:update() and silderinstance:draw() function, so you don't need to specify this for every slider
Please dont! What happens if for some reason I dont wanna update A SINGLE the slider?, for example I wont be showing it this frame so I dont want it to catch mouse events. Other case I simply dont wanna call draw for an specific slider but I have a single draw function! also how do you specify drawing order? for example I have a slider and then I want to draw a semitransparent overlay on top of it and after that another slider, but I have a single draw function!

I dont think this method is nice, it should be left to the user!

I'm at favor of the NOT global idea, you should always return a local table, but I understand if it is not your top priority

Re: simple-slider

Posted: Fri Aug 21, 2015 2:29 pm
by SiENcE
Positive07 wrote:
SiENcE wrote: * keep a list of all sliders and make one silderinstance:update() and silderinstance:draw() function, so you don't need to specify this for every slider
Please dont! What happens if for some reason I dont wanna update A SINGLE the slider?, for example I wont be showing it this frame so I dont want it to catch mouse events. Other case I simply dont wanna call draw for an specific slider but I have a single draw function! also how do you specify drawing order? for example I have a slider and then I want to draw a semitransparent overlay on top of it and after that another slider, but I have a single draw function!
It's an simple slider implementation, not a complex gui system ;).

Re: simple-slider

Posted: Fri Aug 21, 2015 6:49 pm
by pel
This library is great. You need to make it live on github.

Re: simple-slider

Posted: Sat Aug 27, 2016 1:51 pm
by georgeprosser
I've just updated this library to work with LÖVE 0.10.1

I've also added 2 features:
  • 'roundrect' by Robin Wellner for track style
  • optionally supply your own parameters with slider:update(mouseX, mouseY, mouseDown) - allows you to handle your own canvas offsets etc. and to use a different key's state for input, eg. with a controller