forked from joegle/Light-Game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboxes.cpp
60 lines (51 loc) · 843 Bytes
/
boxes.cpp
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
class box
{
public:
box(double,double);
box();
void draw();
void drawHeld();
bool dude; //does the dude have it
bool placed;
double x;
double y;
double z;
double angle;
color c;
};
box::box(){}
box::box(double xx,double yy)
{
placed=false;
dude=false;
x=xx;
y=yy;
z=0;
angle=0;
c=randomColor();
}
void box::drawHeld()
{
glPushMatrix();
glTranslated(x*20,z,y*20);
glRotated(angle, 0, 1, 0);
glScaled(0.25,0.25,0.25);
glTranslated(0,1,0);
glColor3f(c.r,c.g,c.b);
glutSolidTeapot(1);
glPopMatrix();
}
void box::draw()
{
if(!dude && !placed)
{
glPushMatrix();
glTranslated(x*20,0,y*20);
glRotated(angle, 0, 1, 0);
glScaled(0.25,0.25,0.25);
glTranslated(0,1,0);
glColor3f(c.r,c.g,c.b);
glutSolidTeapot(1);
glPopMatrix();
}
}