have the default window size to 5/6, save fullscreen resolution on 'fullscreenResolution' instead of 'resolution', make sure cFullscreenStuff is initialised
authorkoda
Fri, 04 Jan 2013 03:13:21 +0100
changeset 8358 274afc318dca
parent 8357 d7bef04c99d4
child 8359 9a7024b2a4d3
have the default window size to 5/6, save fullscreen resolution on 'fullscreenResolution' instead of 'resolution', make sure cFullscreenStuff is initialised
QTfrontend/gameuiconfig.cpp
hedgewars/uVariables.pas
--- a/QTfrontend/gameuiconfig.cpp	Fri Jan 04 02:58:19 2013 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Fri Jan 04 03:13:21 2013 +0100
@@ -74,7 +74,7 @@
 {
     Form->ui.pageOptions->WeaponTooltip->setChecked(value("misc/weaponTooltips", true).toBool());
 
-    int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
+    int t = Form->ui.pageOptions->CBResolution->findText(value("video/fullscreenResolution").toString());
     if (t < 0)
     {
         if (Form->ui.pageOptions->CBResolution->count() > 1)
@@ -84,9 +84,9 @@
     }
     else Form->ui.pageOptions->CBResolution->setCurrentIndex(t);
     
-    // Default the windowed resolution to 2/3 of the screen size
-    int screenWidth = SDL_GetVideoInfo()->current_w * 2 / 3; 
-    int screenHeight = SDL_GetVideoInfo()->current_h * 2 / 3; 
+    // Default the windowed resolution to 5/6 of the screen size
+    int screenWidth = SDL_GetVideoInfo()->current_w * 5 / 6;
+    int screenHeight = SDL_GetVideoInfo()->current_h * 5 / 6;
     QString widthStr; widthStr.setNum(screenWidth);
     QString heightStr; heightStr.setNum(screenHeight);
     QString wWidth = value("video/windowedWidth", widthStr).toString();
@@ -231,7 +231,7 @@
 
 void GameUIConfig::SaveOptions()
 {
-    setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
+    setValue("video/fullscreenResolution", Form->ui.pageOptions->CBResolution->currentText());
     setValue("video/windowedWidth", Form->ui.pageOptions->windowWidthEdit->text());
     setValue("video/windowedHeight", Form->ui.pageOptions->windowHeightEdit->text());
     setValue("video/fullscreen", vid_Fullscreen());
--- a/hedgewars/uVariables.pas	Fri Jan 04 02:58:19 2013 +0100
+++ b/hedgewars/uVariables.pas	Fri Jan 04 03:13:21 2013 +0100
@@ -2326,12 +2326,13 @@
 begin
     // initialisation flags - they are going to be overwritten by program args
 
-    cScreenWidth    := 1024;
-    cScreenHeight   := 768;
-    cFullscreenWidth    := 1024;
-    cFullscreenHeight   := 768;
+    cFullscreenWidth  := 0;
+    cFullscreenHeight := 0;
     cWindowedWidth    := 1024;
     cWindowedHeight   := 768;
+    cScreenWidth      := cWindowedWidth;
+    cScreenHeight     := cWindowedHeight;
+
     cShowFPS        := false;
     cAltDamage      := true;
     cTimerInterval  := 8;
@@ -2512,13 +2513,20 @@
     vobSDVelocity:= 15;
     vobSDFallSpeed:= 250;
 
-    cMinScreenWidth:= min(cScreenWidth, 640);
-    cMinScreenHeight:= min(cScreenHeight, 480);
+    cMinScreenWidth  := min(cScreenWidth, 640);
+    cMinScreenHeight := min(cScreenHeight, 480);
 
     cNewScreenWidth    := cScreenWidth;
     cNewScreenHeight   := cScreenHeight;
     cScreenResizeDelay := 0;
 
+    // make sure fullscreen resolution is always initialised somehow
+    if cFullscreenWidth = 0 then
+        cFullscreenWidth:= min(cWindowedWidth, 640);
+    if cFullscreenHeight = 0 then
+        cFullscreenHeight:= min(cWindowedHeight, 480);
+
+
     LuaGoals:= '';
     cMapName:= '';