-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
76 lines (57 loc) · 1.24 KB
/
main.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include "tank.h"
#include <stdio.h>
#include "win_console.h"
using namespace std;
//global size of gaming world
//int gX = 9;
//int gY = 9;
int main()
{
console_init();
eCKeyKode keyInput;
tank pTank;
pTank.init();
pTank.t_draw();
bool movFlag;
while(1)
{
keyInput = wait_console_key_press();
switch(keyInput)
{
case KEY_UP:
{
movFlag=pTank.change_dir(tank::UP);
break;
}
case KEY_LEFT:
{
movFlag=pTank.change_dir(tank::LEFT);
break;
}
case KEY_RIGHT:
{
movFlag=pTank.change_dir(tank::RIGHT);
break;
}
case KEY_DOWN:
{
movFlag=pTank.change_dir(tank::DOWN);
break;
}
case KEY_ESCAPE:
{
break;
}
case KEY_ENTER:
case UNKNOWN:
break;
}
system("cls");
if (movFlag) pTank.move();
pTank.t_draw();
Sleep(33);
if (keyInput==KEY_ESCAPE) break;
};
return 0;
}