瀏覽代碼

Sensible default values

Thomas Buck 10 年之前
父節點
當前提交
bc04da966e
共有 4 個文件被更改,包括 21 次插入1 次删除
  1. 4
    0
      ChangeLog.md
  2. 8
    0
      src/FontManager.cpp
  3. 6
    0
      src/RunTime.cpp
  4. 3
    1
      src/main.cpp

+ 4
- 0
ChangeLog.md 查看文件

@@ -2,6 +2,10 @@
2 2
 
3 3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4 4
 
5
+    [ 20141007 ]
6
+    * Set all RunTime vars to sensible defaults, so OpenRaider can try to start
7
+      without a config file (a font is still required!)
8
+
5 9
     [ 20140930 ]
6 10
     * Updated imgui to version 1.14 wip
7 11
     * Console input keeps keyboard focus after command input

+ 8
- 0
src/FontManager.cpp 查看文件

@@ -7,6 +7,7 @@
7 7
 
8 8
 #include "global.h"
9 9
 #include "utils/strings.h"
10
+#include "RunTime.h"
10 11
 #include "FontManager.h"
11 12
 #include "Font.h"
12 13
 #include "FontTRLE.h"
@@ -24,6 +25,13 @@ FontManager::FontManager() {
24 25
 
25 26
     mFontInit = false;
26 27
     font = -1;
28
+
29
+    // Default font path
30
+#ifdef USING_SDL_FONT
31
+    setFont(getRunTime().getDataDir() + "/test.ttf");
32
+#else
33
+    setFont(getRunTime().getDataDir() + "/font.pc");
34
+#endif
27 35
 }
28 36
 
29 37
 FontManager::~FontManager() {

+ 6
- 0
src/RunTime.cpp 查看文件

@@ -6,9 +6,15 @@
6 6
  */
7 7
 
8 8
 #include "global.h"
9
+#include "utils/strings.h"
9 10
 #include "RunTime.h"
10 11
 
11 12
 RunTime::RunTime() {
13
+    baseDir = expandHomeDirectory("~/.OpenRaider");
14
+    pakDir = baseDir + "/paks";
15
+    audioDir = baseDir + "/music";
16
+    dataDir = baseDir + "/data";
17
+
12 18
     gameIsRunning = false;
13 19
 
14 20
 #ifdef DEBUG

+ 3
- 1
src/main.cpp 查看文件

@@ -109,13 +109,15 @@ int main(int argc, char* argv[]) {
109 109
     command_parse(&cmd, argc, argv);
110 110
     command_free(&cmd);
111 111
 
112
+    // RunTime is required by other constructors
113
+    gRunTime.reset(new RunTime());
114
+
112 115
     gCamera.reset(new Camera());
113 116
     gFont.reset(new FontManager());
114 117
     gGame.reset(new Game());
115 118
     gLog.reset(new Log());
116 119
     gMenu.reset(new MenuFolder());
117 120
     gRender.reset(new Render());
118
-    gRunTime.reset(new RunTime());
119 121
     gTextureManager.reset(new TextureManager());
120 122
     gWorld.reset(new World());
121 123
 

Loading…
取消
儲存