Need help with p5GUI in instance mode

I dug into the code and found there is a bug. The original library QuickSettings has a function to add a button:

http://bit101.github.io/quicksettings/demos/demo.html

however, p5.gui did something wrong with inheritance and addButton function is in a bit weird place. They simply assigned qs to prototype

but I think this is wrong and you need to copy every member variables and functions to prototype… if I’m correct. Nevertheless you can access like this

    gui.prototype.addButton("say hi", function() {
      console.log("hi!!")
    })

https://editor.p5js.org/micuat/sketches/Y11IACWvQ

1 Like