bitcraftlab / p5.gui

p5.gui magically generates a graphical user interface for your p5.js sketches
https://bitcraftlab.github.io/p5.gui
MIT License
357 stars 91 forks source link

Add button element to the GUI interface #5

Open jshaw opened 7 years ago

jshaw commented 7 years ago

It would be quite useful to have a button element that can be included in the GUI panel interface. There's a couple use cases where a button in the GUI would make more sense than a checkbox. The dat.gui basic example has a good example of the feature labeled "explode".

bifocalpirate commented 7 years ago

It may be faster if you just use QuickSettings directly. I was debugging my app then realised p5.gui is a wrapper trying to expose the functionality of QuickSettings and DAT.GUI. If you just need a gui that will work with p5, then QuickSettings will do the job. Also, QuickSettings is on a CDN already.

craftoid commented 7 years ago

@jshaw totally agree. That would be a nice feature. I will look in to this!

The type of the variable passed to p5.gui determines the type of the GUI element to be displayed. It would make perfect sense to turn a function name / a variable name referencing a function into a button, that triggers the respective function when pressed.

@skrillex581 Correct. p5.gui, does not aim to become yet another GUI interface, it's a thin layer on top of existing GUIs (currently only QuickSettings) to magically create a GUI for your variables.

BTW: If you need CDN links you can use the ones provided by github: https://cdn.rawgit.com/bit101/quicksettings/master/quicksettings.js https://cdn.rawgit.com/bitcraftlab/p5.gui/master/libraries/p5.gui.js

kabrio commented 7 years ago

If you want buttons without having to deal with quicksettings, I just added (wrapped) the addButton function from quicksettings to p5.gui: https://github.com/kabrio/p5.gui