-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp5UItools.pde
56 lines (44 loc) · 985 Bytes
/
p5UItools.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
Box[] boxes = new Box[0];
boolean boxMode;
void setup() {
size(1280, 800);
// Initialize all Stripe objects
for (int i = 0; i < boxes.length; i++) {
boxes[i] = new Box(boxes.length);
}
}
void draw() {
background(100);
if (boxMode) {
noFill();
strokeWeight(10);
stroke(255, 0, 0);
rect(5, 5, width-10, height-10);
cursor(CROSS);
// display all boxes
for (int i = 0; i < boxes.length; i++) {
// Check if mouse is over the Stripe
boxes[i].rollCenter(mouseX, mouseY);
boxes[i].rollCorner(mouseX, mouseY);
boxes[i].display();
}
} else {
cursor(ARROW);
}
}
void keyPressed() {
if (key == 'b') {
if (boxMode == true) {
boxMode = false;
} else {
boxMode = true;
}
}
if (key == 'n') {
Box b = new Box(boxes.length);
boxes = (Box[]) append(boxes, b);
}
}
//keypress to create a new box (class)
//drag corners of box to coordinates
//record coordinates in a csv