added initial window size to default program config (using <program>.conf)
authorHolger Schemel <info@artsoft.org>
Tue, 8 Mar 2016 23:30:30 +0000 (00:30 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 8 Mar 2016 23:30:30 +0000 (00:30 +0100)
src/files.c
src/libgame/system.h
src/main.c

index f8b9e8b859c9fe94e2eb09f8a13c2f92e3ddfa31..d428ae99ef19ae1b39c96a97c0eea46a41395089 100644 (file)
@@ -8044,8 +8044,10 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_INT_FALLBACK_MUSIC_FILE    12
 #define SETUP_TOKEN_INT_DEFAULT_LEVEL_SERIES   13
 #define SETUP_TOKEN_INT_CHOOSE_FROM_TOP_LEVELDIR 14
+#define SETUP_TOKEN_INT_DEFAULT_WINDOW_WIDTH   15
+#define SETUP_TOKEN_INT_DEFAULT_WINDOW_HEIGHT  16
 
-#define NUM_INTERNAL_SETUP_TOKENS              15
+#define NUM_INTERNAL_SETUP_TOKENS              17
 
 /* options setup */
 #define SETUP_TOKEN_OPTIONS_VERBOSE            0
@@ -8217,6 +8219,8 @@ static struct TokenInfo internal_setup_tokens[] =
   { TYPE_STRING, &sxi.fallback_music_file,     "fallback_music_file"   },
   { TYPE_STRING, &sxi.default_level_series,    "default_level_series"  },
   { TYPE_BOOLEAN,&sxi.choose_from_top_leveldir,        "choose_from_top_leveldir" },
+  { TYPE_INTEGER,&sxi.default_window_width,    "default_window_width"  },
+  { TYPE_INTEGER,&sxi.default_window_height,   "default_window_height" },
 };
 
 static struct TokenInfo options_setup_tokens[] =
@@ -8379,6 +8383,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->internal.default_level_series = getStringCopy(UNDEFINED_LEVELSET);
   si->internal.choose_from_top_leveldir = FALSE;
 
+  si->internal.default_window_width  = WIN_XSIZE_DEFAULT;
+  si->internal.default_window_height = WIN_YSIZE_DEFAULT;
+
   si->options.verbose = FALSE;
 
 #if defined(PLATFORM_ANDROID)
index 1fe8d9f40ff4467aed94010d1bda5c3d390c76c4..1ad2f70956bc0fc70cb64eee63d42c04f0e9b22e 100644 (file)
@@ -968,6 +968,9 @@ struct SetupInternalInfo
 
   char *default_level_series;
 
+  int default_window_width;
+  int default_window_height;
+
   boolean choose_from_top_leveldir;
 };
 
index aaf7998abd5277c7dd6a11a43be76541b9ee00ef..213ba4a0122978a96599f44b5c075151e758b7c9 100644 (file)
@@ -5718,6 +5718,14 @@ static void InitProgramConfig(char *command_filename)
   userdata_subdir = USERDATA_DIRECTORY_OTHER;
 #endif
 
+  // set default window size (only relevant on program startup)
+  if (setup.internal.default_window_width  != 0 &&
+      setup.internal.default_window_height != 0)
+  {
+    WIN_XSIZE = setup.internal.default_window_width;
+    WIN_YSIZE = setup.internal.default_window_height;
+  }
+
   InitProgramInfo(command_filename,
                  config_filename,
                  userdata_subdir,