-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
78 lines (65 loc) · 1.86 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
#include <QApplication>
#include <thread>
#include <iostream>
#include <memory>
#include "field/field.hpp"
#include "item/item.hpp"
#include "model/model.hpp"
#include "matrix/matrix.hpp"
#include "model_manager/modelmanager.hpp"
#include "generate_map/generatemap.hpp"
#include "do_step/dostep.hpp"
#include <SFML/Window.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include "gamewindow/gamewindow.hpp"
// for log messages
#define DEBUG
#include "debug.h"
int test_field(int argc, char** argv, char** env) {
QApplication a(argc, argv);
Field F;
try{
F.loadConfig("./config/window_config.lua");
} catch (std::exception& err){
PERROR("%s", err.what());
return EXIT_FAILURE;
}
GenerateComplexMap mapGenerator(10, 0.02, 0.23, 0.2);
//GenerateRandomMap& gen = mapGenerator;
F.setGenerateMap(mapGenerator);
F.generateTiles();
LOG("Map generated");
GenerateRandomEntity entityGenerator(10, 1, 0, 30, 40, 1, 3, 9);
F.setGenerateEntities(entityGenerator);
F.generateEntities();
//MapDump()(F.mMap, F.mEntities);
//MapDump()(F.mMap, F.mEntities);
std::shared_ptr< ModelManager > sample = std::make_shared< ModelManager >();
try{
sample->loadConfig("./config/mm_config.lua");
} catch (std::exception& err){
PERROR("%s", err.what());
return EXIT_FAILURE;
}
LOG("Model manager initialized");
RandomMoving RM(sample);
F.setDoStep(RM);
F.setModelManager(sample);
F.loadTileTextures();
F.loadEntityTextures();
LOG("Textures loaded");
F.show();
F.start();
return a.exec();
}
int test_window(int argc, char** argv, char** env){
QApplication a(argc, argv);
GameWindow w;
w.show();
return a.exec();
}
int main(int argc, char ** argv, char** env)
{
//test_field(argc, argv, env);
return test_window(argc, argv, env);
}