-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
69 lines (51 loc) · 1.68 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
#include <iostream>
#include "GlutInputSignaler.h"
#include "GlutScreenCanvas.h"
#include "StaticLayout.h"
#include "ScreenHandler.h"
#include "Maze/Mazes/Advanced/advancedmover.h"
#include "Maze/Mazes/Advanced/advancedgenerator.h"
#include "Maze/mazerunner.h"
#include "Maze/Mazes/Advanced/advancedpartitioner.h"
#include "Maze/Mazes/Advanced/advancedrules.h"
#include "mazevisualizer.h"
#include "animatedmaze.h"
#include "./Maze/playerloader.h"
using namespace std;
int main(int argc, char** argv)
{
int width = 100, height = 100, seed = 0;
int cycles = 10;
if(argc > 2)
{
width = stoi(argv[1]);
height = stoi(argv[2]);
}
if(argc > 3)
cycles = stoi(argv[3]);
if(argc > 4)
seed = stoi(argv[4]);
GlutInputSignaler input;
GlutScreenCanvas canvas;
canvas.init(argc, argv, "Maze", 520, 520);
input.setAsActiveHandler();
AdvancedGenerator mazeGen(width, height, cycles);
AdvancedMover playerMove;
AdvancedPartitioner part;
AdvancedRules rules;
MazeRunner<AttributePlayer, AdvancedPlayerData, AdvancedPlayerMove, AdvancedMapTile>
m(&mazeGen, &part, &playerMove, &rules, width*height*20, seed);
PlayerLoader<AttributePlayer> g(&m);
g.loadPlayers("./Players");
MazeVisualizer<AttributePlayer, AdvancedPlayerData, AdvancedMapTile> visual(&m);
AnimatedMaze animator(&m);
animator.start();
ScreenHandler screen(&canvas, &input, &visual);
input.addIdleReceiver(&animator, &AnimateableAlgo::step);
input.addIdleReceiver(&glutPostRedisplay);
//input.addIdleReceiver([](){cin.get();});
glutMainLoop();
input.removeActiveHandler();
animator.stop();
return 0;
}