-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.cpp
79 lines (73 loc) · 2.05 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
77
78
79
#include "Scene.h"
#include <iostream>
#include <sstream>
int main(int argc, char ** argv)
{
std::cout<<"------------------------------------------"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| MATRIX Version 1.0 |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| type p to pause/unpause |"<<std::endl;
std::cout<<"| type q to quit |"<<std::endl;
std::cout<<"| type j to increase speed |"<<std::endl;
std::cout<<"| type k to decrease speed |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| Enter to start... |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"| |"<<std::endl;
std::cout<<"------------------------------------------"<<std::endl;
std::cin.get();
if (argc == 1)
{
SysTool::init();
Scene scene(SysTool::getCols(), SysTool::getLines());
scene.execute();
}
else if (argc == 2)
{
std::string arg(argv[1]);
bool isColor = true;
for (auto it : arg)
{
if (!std::isdigit(it))
{
isColor = false;
break;
}
}
if (isColor)
{
std::istringstream iss(argv[1]);
int color;
iss >> color;
SysTool::setColorBody(color);
SysTool::init();
Scene scene(SysTool::getCols(), SysTool::getLines());
scene.execute();
}
else
{
SysTool::init();
Scene scene(SysTool::getCols(), SysTool::getLines());
scene.execute(argv[1]);
}
}
else if (argc == 3)
{
std::istringstream iss(argv[2]);
int color;
iss >> color;
SysTool::setColorBody(color);
SysTool::init();
Scene scene(SysTool::getCols(), SysTool::getLines());
scene.execute(argv[1]);
}
else
{
std::cerr<<"Error"<<std::endl;
}
SysTool::finalize();
return EXIT_SUCCESS;
}