-
Notifications
You must be signed in to change notification settings - Fork 0
/
Container.pde
36 lines (29 loc) · 979 Bytes
/
Container.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
class Container {
private int widthC, heightC;
public Container(int w, int h) {
heightC = h;
widthC = w;
}
public void setWidth(int newW) { widthC = newW; }
public void setHeight(int newH) { heightC = newH; }
public int getWidth() { return widthC; }
public int getHeight() { return heightC; }
public float leftMost() { return width / 2 - widthC / 2; }
public float rightMost() { return width / 2 + widthC / 2; }
public float upperMost() { return height / 2 - heightC / 2; }
public float lowerMost() { return height / 2 + heightC / 2; }
public void draw() {
float centerX = width / 2;
float centerY = height / 2;
float x1 = centerX - widthC / 2;
float x2 = centerX + widthC / 2;
float y1 = centerY - heightC / 2;
float y2 = centerY + heightC / 2;
strokeWeight(1);
stroke(0);
line(x1, y1, x1, y2);
line(x2, y1, x2, y2);
line(x1, y1, x2, y1);
line(x1, y2, x2, y2);
}
}