|
@@ -34,67 +34,64 @@
|
34
|
34
|
#error No Windowing Library selected!
|
35
|
35
|
#endif
|
36
|
36
|
|
37
|
|
-Camera gCamera;
|
38
|
|
-Console gConsole;
|
39
|
|
-FontManager gFont;
|
40
|
|
-Game gGame;
|
41
|
|
-Menu gMenu;
|
42
|
|
-OpenRaider gOpenRaider;
|
43
|
|
-Render gRender;
|
44
|
|
-TextureManager gTextureManager;
|
45
|
|
-World gWorld;
|
46
|
|
-
|
47
|
|
-#ifdef USING_AL
|
48
|
|
-SoundAL gSound;
|
49
|
|
-#else
|
50
|
|
-SoundNull gSound;
|
51
|
|
-#endif
|
52
|
|
-
|
53
|
|
-#ifdef USING_SDL
|
54
|
|
-WindowSDL gWindow;
|
55
|
|
-#endif
|
56
|
|
-
|
57
|
37
|
Camera &getCamera() {
|
|
38
|
+ static Camera gCamera;
|
58
|
39
|
return gCamera;
|
59
|
40
|
}
|
60
|
41
|
|
61
|
42
|
Console &getConsole() {
|
|
43
|
+ static Console gConsole;
|
62
|
44
|
return gConsole;
|
63
|
45
|
}
|
64
|
46
|
|
65
|
47
|
Font &getFont() {
|
|
48
|
+ static FontManager gFont;
|
66
|
49
|
return gFont;
|
67
|
50
|
}
|
68
|
51
|
|
69
|
52
|
Game &getGame() {
|
|
53
|
+ static Game gGame;
|
70
|
54
|
return gGame;
|
71
|
55
|
}
|
72
|
56
|
|
73
|
57
|
Menu &getMenu() {
|
|
58
|
+ static Menu gMenu;
|
74
|
59
|
return gMenu;
|
75
|
60
|
}
|
76
|
61
|
|
77
|
62
|
OpenRaider &getOpenRaider() {
|
|
63
|
+ static OpenRaider gOpenRaider;
|
78
|
64
|
return gOpenRaider;
|
79
|
65
|
}
|
80
|
66
|
|
81
|
67
|
Render &getRender() {
|
|
68
|
+ static Render gRender;
|
82
|
69
|
return gRender;
|
83
|
70
|
}
|
84
|
71
|
|
85
|
72
|
Sound &getSound() {
|
|
73
|
+#ifdef USING_AL
|
|
74
|
+ static SoundAL gSound;
|
|
75
|
+#else
|
|
76
|
+ static SoundNull gSound;
|
|
77
|
+#endif
|
86
|
78
|
return gSound;
|
87
|
79
|
}
|
88
|
80
|
|
89
|
81
|
TextureManager &getTextureManager() {
|
|
82
|
+ static TextureManager gTextureManager;
|
90
|
83
|
return gTextureManager;
|
91
|
84
|
}
|
92
|
85
|
|
93
|
86
|
Window &getWindow() {
|
|
87
|
+#ifdef USING_SDL
|
|
88
|
+ static WindowSDL gWindow;
|
|
89
|
+#endif
|
94
|
90
|
return gWindow;
|
95
|
91
|
}
|
96
|
92
|
|
97
|
93
|
World &getWorld() {
|
|
94
|
+ static World gWorld;
|
98
|
95
|
return gWorld;
|
99
|
96
|
}
|
100
|
97
|
|
|
@@ -151,13 +148,13 @@ int main(int argc, char *argv[]) {
|
151
|
148
|
|
152
|
149
|
// Try to load a configuration
|
153
|
150
|
if (configArg) {
|
154
|
|
- if (gOpenRaider.loadConfig(argv[1]) != 0) {
|
|
151
|
+ if (getOpenRaider().loadConfig(argv[1]) != 0) {
|
155
|
152
|
std::cout << "Could not find the specified config file. Aborting..." << std::endl;
|
156
|
153
|
return 2;
|
157
|
154
|
}
|
158
|
155
|
} else {
|
159
|
|
- if (gOpenRaider.loadConfig(DEFAULT_CONFIG_FILE) != 0) {
|
160
|
|
- if (gOpenRaider.loadConfig(DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE) != 0) {
|
|
156
|
+ if (getOpenRaider().loadConfig(DEFAULT_CONFIG_FILE) != 0) {
|
|
157
|
+ if (getOpenRaider().loadConfig(DEFAULT_CONFIG_PATH "/" DEFAULT_CONFIG_FILE) != 0) {
|
161
|
158
|
std::cout << "Could not find a config file. Aborting..." << std::endl;
|
162
|
159
|
return 3;
|
163
|
160
|
}
|
|
@@ -165,15 +162,15 @@ int main(int argc, char *argv[]) {
|
165
|
162
|
}
|
166
|
163
|
|
167
|
164
|
// Initialize everything
|
168
|
|
- int error = gOpenRaider.initialize();
|
|
165
|
+ int error = getOpenRaider().initialize();
|
169
|
166
|
if (error != 0) {
|
170
|
167
|
std::cout << "Could not initialize OpenRaider (" << error << ")!" << std::endl;
|
171
|
168
|
return 4;
|
172
|
169
|
}
|
173
|
170
|
|
174
|
171
|
// Enter Main loop
|
175
|
|
- gConsole.print("Starting %s", VERSION);
|
176
|
|
- gOpenRaider.run();
|
|
172
|
+ getConsole().print("Starting %s", VERSION);
|
|
173
|
+ getOpenRaider().run();
|
177
|
174
|
|
178
|
175
|
return 0;
|
179
|
176
|
}
|