Просмотр исходного кода

added SCREEN_WIDTH/HEIGHT in addition to DEFAULT

quantumde1 2 месяцев назад
Родитель
Сommit
d7d25e04d0
5 измененных файлов с 20 добавлено и 8 удалено
  1. 4 2
      conf/settings.conf
  2. 2 2
      source/dialogs/dialogbox.d
  3. 4 4
      source/graphics/engine.d
  4. 4 0
      source/system/config.d
  5. 6 0
      source/variables.d

+ 4 - 2
conf/settings.conf

@@ -4,6 +4,8 @@ DIALOG_END_INDICATOR:res/misc/circle.png
 DIALOG_BOX:res/misc/TEX#win_01b.PNG
 FALLBACK_FONT:res/font_en.png
 ICON:res/icon.png
-DEFAULT_SCREEN_WIDTH:1024
-DEFAULT_SCREEN_HEIGHT:768
+DEFAULT_SCREEN_WIDTH:1344
+DEFAULT_SCREEN_HEIGHT:1008
+SCREEN_WIDTH:1344
+SCREEN_HEIGHT:1008
 DEFAULT_FULLSCREEN:false

+ 2 - 2
source/dialogs/dialogbox.d

@@ -70,8 +70,8 @@ void displayDialog(string[] pages, string[] choices, ref int selectedChoice,
                    ref float textSpeed, Texture2D circle, 
                    Texture2D dialogBackgroundTex, float scale) {
     
-    immutable int screenWidth = systemSettings.defaultScreenWidth;
-    immutable int screenHeight = systemSettings.defaultScreenHeight;
+    immutable int screenWidth = systemSettings.screenWidth;
+    immutable int screenHeight = systemSettings.screenHeight;
     immutable int screenPadding = 10;
     
     // Dialog background rectangle with padding

+ 4 - 4
source/graphics/engine.d

@@ -28,10 +28,10 @@ import std.algorithm;
 void engineLoader()
 {
     systemSettings = loadSettingsFromConfigFile("conf/settings.conf");
-    float baseWidth = 1344.0f;
-    float baseHeight = 1008.0f;
-    int screenWidth = systemSettings.defaultScreenWidth;
-    int screenHeight = systemSettings.defaultScreenHeight;
+    baseWidth = systemSettings.defaultScreenWidth;
+    baseHeight = systemSettings.defaultScreenHeight;
+    int screenWidth = systemSettings.screenWidth;
+    int screenHeight = systemSettings.screenHeight;
     scale = min(cast(float)(screenWidth/baseWidth), cast(float)(screenHeight/baseHeight));
     debugWriteln("scale: ", scale);
     // Initialization

+ 4 - 0
source/system/config.d

@@ -23,6 +23,8 @@ nothrow string parseConf(string type, string filename) {
             "fallback_font": "FALLBACK_FONT:",
             "default_screen_width": "DEFAULT_SCREEN_WIDTH:",
             "default_screen_height": "DEFAULT_SCREEN_HEIGHT:",
+            "screen_width": "SCREEN_WIDTH:",
+            "screen_height": "SCREEN_HEIGHT:",
             "default_fullscreen": "DEFAULT_FULLSCREEN:"
         ];
 
@@ -58,6 +60,8 @@ SystemSettings loadSettingsFromConfigFile(string confName) {
         parseConf("fallback_font", confName),
         parseConf("default_screen_width", confName).to!int,
         parseConf("default_screen_height", confName).to!int,
+        parseConf("screen_width", confName).to!int,
+        parseConf("screen_height", confName).to!int,
         parseConf("default_fullscreen", confName).to!bool
     );
 }

+ 6 - 0
source/variables.d

@@ -34,6 +34,8 @@ struct SystemSettings {
     string fallbackFont;
     int defaultScreenWidth;
     int defaultScreenHeight;
+    int screenWidth;
+    int screenHeight;
     bool defaultFullscreen;
 }
 
@@ -107,6 +109,10 @@ string luaExec;
 
 /* floats */
 
+float baseWidth;
+
+float baseHeight;
+
 float cameraTargetX = 0;
 
 float cameraTargetY = 0;