-
Notifications
You must be signed in to change notification settings - Fork 0
/
Button.pde
65 lines (52 loc) · 1.12 KB
/
Button.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
public class Button {
private float x;
private float y;
private float w;
private PImage icon;
private int indiceBottone;
Button(int indicebottone, float x, float y, PImage icon, float w) {
this.x=x;
this.y=y;
this.icon=icon;
this.w=w;
this.indiceBottone=indiceBottone;
}
boolean mousePressed() {
if (mousePressed== true)
if (mouseX<(x+(w/2)+int(w*.10))&&mouseX>(x-(w/2)-int(w*.10))&&(mouseY<(y+(w/2)+int(w*.10))&&mouseY>(y-(w/2)-int(w*.10))))
return true;
return false;
}
void display() {
image(icon, x, y, w, w);
}
void addX(int x) {
this.x+=x;
}
void addY(int y) {
this.y+=y;
}
float getX() {
return x;
}
float getY() {
return y;
}
public int getIndiceBottone()
{
return this.indiceBottone;
}
public boolean mouseOverIt()
{
return mouseX<(x+(w/2)+int(w*.10))&&mouseX>(x-(w/2)-int(w*.10))&&(mouseY<(y+(w/2)+int(w*.10))&&mouseY>(y-(w/2)-int(w*.10)));
}
public void effettoBottoni(int indexButton)
{
if (indexButton<2)
{
index=indexButton;
return;
}
//apriWebPage();
}
}