menu = new button({
x:menuxy[0]+xx,
y:menuxy[1]+yy-10,
width:190+12,
height:30*10,
id:"menu",
col:color(255,255,255,20),
label:"",
onClick: function(){
setups();
}
});
This is what I am converting from p5.js. Its a call to create a new button with the name “menu”. Now this works fine in p5.js however this does not seem possible in processing. The only functionality which I do not know how to replicate is the
onClick: function(){setups();}
Of course, I know how to create a onClick function, but the beauty of this bit of code, is that it enables you to assign different functions to different buttons created using the same “class” ( I know some might argue, this is not really a class in p5). Anyway is there some sort of processing alternative, I cannot seem to find any documentation which would suggest this, and if not, what would you suggest as an alternative?