simple-slider

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: simple-slider

Post 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!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: simple-slider

Post 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:
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: simple-slider

Post 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!!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
georgeprosser
Citizen
Posts: 68
Joined: Fri Mar 28, 2014 5:55 pm

Re: simple-slider

Post 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.
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: simple-slider

Post 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'
User avatar
georgeprosser
Citizen
Posts: 68
Joined: Fri Mar 28, 2014 5:55 pm

Re: simple-slider

Post 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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: simple-slider

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: simple-slider

Post 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 ;).
pel
Prole
Posts: 28
Joined: Mon Aug 17, 2015 6:48 am

Re: simple-slider

Post by pel »

This library is great. You need to make it live on github.
User avatar
georgeprosser
Citizen
Posts: 68
Joined: Fri Mar 28, 2014 5:55 pm

Re: simple-slider

Post 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
Last edited by georgeprosser on Sun Aug 28, 2016 7:41 am, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest