void setup() {
size(200, 200);
background(255);
}
void draw() {
A.clicked();
A.display();
}
class Button {
String name;
int x;
int y;
int r;
Button(String n) {
this.name = n;
x = 100;
y = 100;
r = 50;
}
void clicked() {
if (mousePressed==true) {
println(this.name);
mousePressed = false;
}
}
void display() {
fill(200);
rectMode(CENTER);
rect(x, y, r, r);
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น