This repository was archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
135 lines (108 loc) · 4.24 KB
/
main.cpp
File metadata and controls
135 lines (108 loc) · 4.24 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include <iostream>
#include "common.h"
#include "lib/gui/gui.h"
#include "lib/optionsmanager/optionsman.h"
#include "lib/timemanager/timeManager.h"
#include "lib/resourcemanager/resourceman.h"
#include "lib/renderer/renderer.h"
#include "lib/games/games.h"
#include "lib/resourcemanager/textureloader.h"
#ifdef STATIC_BUILD
Q_IMPORT_PLUGIN(Plants);
#endif
using namespace visualizer;
namespace visualizer
{
Log* errorLog = new Log( "visualizer.log" );
}
int main(int argc, char *argv[])
{
///////////////////////////////////////////////////////////////////
// Must initialize things based on their dependency graphs
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Options Manager Depends On Mutex
///////////////////////////////////////////////////////////////////
OptionsMan->setup();
OptionsMan->loadOptionFile( "./options.xml", "core" );
// NO MEMORY LEAKS AT THIS POINT
///////////////////////////////////////////////////////////////////
// Time Manager Depends On Options Manager
///////////////////////////////////////////////////////////////////
TimeManager->setup();
///////////////////////////////////////////////////////////////////
// ObjectManager depends on OptionsManager
///////////////////////////////////////////////////////////////////
//ObjectManager->setup();
///////////////////////////////////////////////////////////////////
// GUI Depends On This Runing, but it doens't depend on anything.
///////////////////////////////////////////////////////////////////
QApplication app( argc, argv );
///////////////////////////////////////////////////////////////////
// SelectionRender depends on OptionsManager
///////////////////////////////////////////////////////////////////
SelectionRender->setup();
///////////////////////////////////////////////////////////////////
// Resource Manager depends on _______________________
///////////////////////////////////////////////////////////////////
MESSAGE( "============Initializing Resource Manager=======" );
ResourceMan->setup();
///////////////////////////////////////////////////////////////////
// Initialize Texture Loader
///////////////////////////////////////////////////////////////////
MESSAGE( "============Initializing Texture Loader=======" );
TextureLoader->setup();
///////////////////////////////////////////////////////////////////
// Initialize Animation Engine
///////////////////////////////////////////////////////////////////
MESSAGE( "============Initializing Animation Engine=======" );
AnimationEngine->setup();
///////////////////////////////////////////////////////////////////
// GUI Depends On Options Manager, Time Manager, Objectmanager,
// SelectionRender, and QApplication running already.
// GUI also depends on the renderer, but starts it automagically.
///////////////////////////////////////////////////////////////////
GUI->setup();
///////////////////////////////////////////////////////////////////
// Initalize the Games
// This MUST be initialized last, but before loading a gamelog
// This assigns all the pointers to the interfaces and so all
// the the interfaces must be set up already.
///////////////////////////////////////////////////////////////////
Games->setup();
if( argc > 1 )
{
for( size_t i = 1; i < argc; i++ )
{
GUI->addToPlaylist( argv[i] );
}
} else if(!OptionsMan->getString( "Game Mode" ).compare( "Arena" ) )
{
}
else
{
GUI->splashScreen();
}
MESSAGE( "Starting The Time Manager" );
TimeManager->timerStart();
MESSAGE( "Executing the App" );
int retval = app.exec();
MESSAGE( "Destroying Games..." );
Games->destroy();
MESSAGE( "Destroying Animation Engine..." );
AnimationEngine->destroy();
MESSAGE( "Destroying Texture Loader..." );
TextureLoader->destroy();
MESSAGE( "Destroying Resource Manager..." );
ResourceMan->destroy();
MESSAGE( "Destroying GUI..." );
GUI->destroy();
MESSAGE( "Destroying Renderer..." );
Renderer->destroy();
MESSAGE( "Destroying Time..." );
TimeManager->destroy();
MESSAGE( "Destroying Options Manager..." );
OptionsMan->destroy();
MESSAGE( "Exit Successful!" );
return retval;
}