xxxxxxxxxx
21
var count = 0;
var myButton;
function setup() {
createCanvas(windowWidth, windowHeight);
myButton = new Button({
x: width / 2, y: height / 2,
width: 100, height: 50,
align_x: 0, align_y: 0,
content: 'Clicks: 0',
on_press() {
count++;
myButton.text('Clicks: ' + count);
}
});
}
function draw() {
background(30);
myButton.draw();
}