-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drag Race 2.h
152 lines (143 loc) · 3.18 KB
/
Drag Race 2.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
double mycarx2=425,mycary2=20,refx1=240,refy1=0;
double a1=0,vdg1=0,td1=0;
int start=0,cnt1=0;
int r1=255,g1=255,b1=0;
void movement()
{
if(start)
td1+=1;
if(td1>=100 && td1<200 && cnt1<5)
{
r1=0;
g1=0;
b1=255;
}
else if(td1>=200 && td1<250 && cnt1<5)
{
r1=0;
g1=255;
b1=0;
}
else if(td1>=250 && cnt1<5)
{
r1=255;
g1=0;
b1=0;
vdg1=0;
cnt1=6;
}
else if(cnt1<5)
{
r1=255;
g1=255;
b1=0;
}
if(cnt1==5)
{
r1=0;
g1=0;
b1=0;
}
// if(!a1)
// {
//// v+=a1*t;
// if(refy1>-64000)
// refy1=-v*t;
// }
// else
// {
// refy1=-(v*t+.5*a1*t*t);
// }
// if(v<50 && start){
// v=;
// }
if(refy1>=-63700)
refy1=refy1-vdg1;
}
void iDrawDragRoad()
{
iClear();
iSetColor(51,102,0);
iFilledRectangle(0,0,1920,1080);
iSetColor(128,128,128);//left track color
iFilledRectangle(refx1,refy1,480,64000);//first track
iFilledRectangle(refx1+960,0,480,64000);//second track
iSetColor(255,255,0); //lane color
iFilledRectangle(refx1,refy1,10,64000);//lanes start
iFilledRectangle(refx1+960,refy1,10,64000);
iFilledRectangle(refx1+480-10,refy1,10,64000);
iFilledRectangle(refx1+960+480-10,refy1,10,64000);//lanes end
iSetColor(r,g,b);
iFilledCircle(475+355,540,25,1000);
iSetColor(255,255,255);
iFilledRectangle(930,380,60,320);
iSetColor(253,0,0);
iFilledRectangle(930,380,30,-refy1/200);
// sprintf()
iSetColor(255,255,255);
iLine(960,0,960,1080);
iSetColor(255,255,255);//divider color
for(int i=0;i<=63950;i+=200)//dividers
{
iFilledRectangle(refx1+235,refy1+i,10,100);
iFilledRectangle(refx1+960+235,0+i,10,100);
}
if(start==0)
{
iSetColor(255,255,255);
iText(340,540,"PRESS SPACE TO START",GLUT_BITMAP_HELVETICA_18);
}
if(yellow)iDrawBMPCar("BMP//car//yellow.bmp");
else if(red)iDrawBMPCar("BMP//car//red.bmp");
else if(black)iDrawBMPCar("BMP//car//black.bmp");
for(int i=0;i<width;i++){
for(int j=0;j<height;j++){
if(mycarimg[j][i][0]!=0){
iSetColor(mycarimg[j][i][0],mycarimg[j][i][1],mycarimg[j][i][2]);
iPoint(i+mycarx2,j+mycary2,1);
}
}
}
}
//void iKeyboard(unsigned char key)
//{
// if(key==' ')
// {
// start=1;
// v=15;
// }
//}
//void iSpecialKeyboard(unsigned char key)
//{
// if(key==GLUT_KEY_UP)
// {
//
//
// }
// if(key==GLUT_KEY_RIGHT)
// {
//// if(mycarx2<1080){
////
mycarx2+=10;
//// }
// }
// if(key==GLUT_KEY_LEFT)
// {
//// if(mycarx2>400){
//// mycarx2-=10;
//// }
// }
// if(key==GLUT_KEY_DOWN)
// {
//// if(a1)
//// a1-=.1;
//// if(refy1)
//// {
//// //mycary2-=5;
//// //refy1+=10;
//// }
//
// }
//
//}
//