mirror of
https://github.com/processing/processing4.git
synced 2026-01-27 10:21:26 +01:00
35 lines
560 B
Plaintext
35 lines
560 B
Plaintext
class Button {
|
|
|
|
int x, y, radius;
|
|
|
|
public Button (int x, int y, int radius) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.radius = radius;
|
|
}
|
|
|
|
boolean over() {
|
|
return dist(mouseX, mouseY, this.x, this.y) < this.radius;
|
|
}
|
|
|
|
void draw() {
|
|
ellipse(this.x, this.y, this.radius * 2, this.radius * 2);
|
|
}
|
|
|
|
@Deprecated
|
|
void old() {
|
|
ellipse(this.x, this.y, this.radius, this.radius);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
class ButtonOther extends Button {
|
|
|
|
@Override
|
|
boolean over() {
|
|
return dist(mouseX, mouseY, this.x, this.y) < this.radius / 2;
|
|
}
|
|
|
|
}
|