-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdrawing.cpp
More file actions
61 lines (55 loc) · 1.44 KB
/
drawing.cpp
File metadata and controls
61 lines (55 loc) · 1.44 KB
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
#include "declaration.cpp"
// drawing player
void drawman()
{
glColor3f(1,0,0); //set the color of Head
float xc=player.head.Xc; //set the center of head
float yc=player.head.Yc;
float r=player.head.radius; // set the radius of head
filledcircle(xc,yc,r); //drawing head
//set coordinate of player body
player.body.left=xc-r;
player.body.right=xc+r;
player.body.top=yc-r;
player.body.bottom=yc-3*r;
glColor3f(0,0.3,0.1); // set color of player body part
rectang(player.body.left,player.body.right,player.body.top,player.body.bottom);
// set leg part of body
player.leg.left=xc-r/2;
player.leg.right=xc+r/2;
player.leg.top=yc-3*r;
player.leg.bottom=yc-4*r;
glColor3f(0,1,1); // set leg color
rectang(player.leg.left,player.leg.right,player.leg.top,player.leg.bottom);
}
// drawing different coins
void drawcoin1()
{
glColor3f(1,0,0);
filledcircle(c1.Xc,c1.Yc,c1.radius);
glEnd();
}
void drawcoin2()
{
glColor3f(0,1,0);
filledcircle(c2.Xc,c2.Yc,c2.radius);
glEnd();
}
void drawcoin3()
{
glColor3f(0,0,1);
filledcircle(c3.Xc,c3.Yc,c3.radius);
glEnd();
}
void drawcoin4()
{
glColor3f(1,1,0);
filledcircle(c4.Xc,c4.Yc,c4.radius);
glEnd();
}
void drawcoin5()
{
glColor3f(0,1,1);
filledcircle(c5.Xc,c5.Yc,c5.radius);
glEnd();
}