-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.pde
51 lines (42 loc) · 941 Bytes
/
Cell.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
class Cell {
int num, index;
float x_pos, y_pos, width_len;
boolean highlight;
Cell(int index, int num, float width_len) {
this.index = index;
this.num = num;
this.width_len = width_len;
}
int getIndex() {
return this.index;
}
int getNum() {
return this.num;
}
float getWidthLen() {
return this.width_len;
}
void setNum(int num) {
this.num = num;
}
void setCoordinates(float x_pos, float y_pos) {
this.x_pos = x_pos;
this.y_pos = y_pos;
}
void setHighlight(boolean bool) {
this.highlight = true;
}
void draw(float x, float y) {
fill(255,255,255);
rect(x,y,this.width_len,this.width_len);
textSize(32);
textAlign(CENTER);
fill(0, 102, 153, 204);
if(this.num > 0) {
text((int) this.num, x+(width_len*0.55), y+(width_len*0.6));
}
else {
text("", x+(width_len*0.55), y+(width_len*0.6));
}
}
}