-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameLib.pde
executable file
·61 lines (44 loc) · 1.45 KB
/
GameLib.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
//---------- Start of General Classes ----------\\
abstract class Item{ //This is meant to be a superclass to all loopable items, for use in the Loop class (itself loopable)
void tick(){};
}
//---------- Start of Drawing Classes ----------\\
abstract class Shape extends Item{ //If it can be drawn, it should extend Shape
float x, y; //Just as position. I'd add a colour, but that will get weird once the complex shapes get implemented.
boolean visible = true;
void draw(){}
}
interface PrimitiveDrawable{
void setColor(Color c);
}
class Color{
float r, g, b;
public Color(int red, int green, int blue){
r = red; g = green; b = blue;
}
public Color(float grey){
r = grey; g = grey; b = grey;
}
}
class Rectangle extends Shape implements PrimitiveDrawable{
float h, w;
Color c;
public Rectangle(float xpos, float ypos, float height, float width, Color c){
x = xpos; y = ypos; h = height; w = width;
this.c = c;
}
void setColor(Color c){
this.c = c;
}
void draw(){
fill(c.r, c.b, c.g);
rect(x, y, h, w);
}
}
//---------- Start of Processing Classes ----------\\
interface Loop{
void tick();
}
//---------- Start of Physics Classes ----------\\
//---------- Start of Control Classes ----------\\
//---------- Start of Special Classes ----------\\