-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
51 lines (43 loc) · 882 Bytes
/
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
#define OLC_PGE_APPLICATION
#include "application.h"
void usage()
{
std::cout << "quadTree filename.png threshold" << std::endl;
}
bool checkParameters(int argc, char **argv, int &threshold)
{
if (argc != 3)
{
usage();
return false;
}
std::ifstream ifile;
ifile.open(argv[1]);
if (!ifile)
{
usage();
return false;
}
try
{
threshold = stoi(argv[2]);
if (threshold < 1) threshold = 15;
}
catch (...)
{
usage();
return false;
}
return true;
}
int main(int argc, char *argv[])
{
int threshold;
if (!checkParameters(argc, argv, threshold))
return -1;
Application demo(argv[1], threshold);
cout << "Width: " << demo.Width() << " Height: " << demo.Height() << endl;
if (demo.Construct(demo.Width() * 2, demo.Height(), 1, 1))
demo.Start();
return 0;
}