forked from ntxtung/SnakeVer2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
59 lines (51 loc) · 1.26 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
#include "Screens.h"
#include "Classes.h"
#include "graphicAPI.h"
//#define DEBUG
#include <iostream>
#include <time.h>
int main()
{
//ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false); // Dont open the console --> Just remove the comment when build the program
initGraphic();
while (1)
{
mainMenu();
SnakeGame *game = new SnakeGame();
int randomMap;
srand(GetTickCount());
randomMap = rand() % 7 + 1;
switch (randomMap)
{
case 1:
game->loadMap("map\\map1.txt");
break;
case 2:
game->loadMap("map\\map2.txt");
break;
case 3:
game->loadMap("map\\map3.txt");
break;
case 4:
game->loadMap("map\\map4.txt");
break;
case 5:
game->loadMap("map\\map5.txt");
break;
case 6:
game->loadMap("map\\map6.txt");
break;
case 7:
game->loadMap("map\\map7.txt");
break;
default:
game->loadMap("map\\map0.txt");
break;
}
game->beginGame();
cleardevice();
}
closegraph();
//FreeConsole(); // The same with ShowWindow
return 0;
}