-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.pde
More file actions
executable file
·92 lines (77 loc) · 2.19 KB
/
Button.pde
File metadata and controls
executable file
·92 lines (77 loc) · 2.19 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class Button {
int buttonWidth = width/5, buttonHeight = height/17;
final int text = color(236, 236, 236);
final int button = color(30, 139, 195);
int posX, posY;
final int origX, origY;
String val = "";
boolean isSmart = false;
public TextBox tb;
ArrayList<Button> nestedButtons;
String outputString;
Button(){
//just for ref
this(0,0,"", null);
}
Button(int posX, int posY, String val, String outputString) {
this.posX = posX;
this.posY = posY;
this.origX = posX;
this.origY = posY;
this.val = val;
tb = new TextBox(this.posX, this.posY, this);
this.outputString = outputString;
}
Button (int posX, int posY, String val, int a, String outputString) {
this.posX = posX;
this.posY = posY;
this.origX = posX;
this.origY = posY;
this.val = val;
this.isSmart = true;
tb = new TextBox(this.posX, this.posY, this);
this.outputString = outputString;
nestedButtons = new ArrayList<Button>();
}
String getOutputString()
{
if(outputString.indexOf("~")!=-1){
incrementer++;
previousI = incrementer;
}
if (isSmart){
return outputString.replace("~",""+incrementer).replace("@",tb.condStm.replace("=","==")).replace("!", tb.displayInput.replace("|", ""));
}else{
if (tb.relativeValue.size()!=0){
return outputString.replace("i",previousI+"").replace("~",""+incrementer).replace("@",tb.condStm.replace("=","==")).replace("!", tb.relativeInput.replace("|", "").replace("i",previousI+""));
}else{
return outputString.replace("~",""+incrementer).replace("@",tb.condStm.replace("=","==")).replace("!", tb.displayInput.replace("|", ""));
}
}
}
boolean overBlock() {
if (mouseX >= posX && mouseX <= posX+this.buttonWidth && mouseY >= posY && mouseY <= posY+this.buttonHeight)
{
return true;
} else
{
return false;
}
}
void addNested(Button button)
{
nestedButtons.add(button);
}
void removeNested(Button button)
{
nestedButtons.remove(button);
}
void resetNested()
{
nestedButtons.clear();
}
ArrayList<Button> getNested()
{
return nestedButtons;
}
}