GCI2012: Resolution Freedom
authorkoda
Fri, 04 Jan 2013 02:58:19 +0100
changeset 8357 d7bef04c99d4
parent 8355 df0ea4323295 (current diff)
parent 8356 b5cf1f29ab14 (diff)
child 8358 274afc318dca
GCI2012: Resolution Freedom
QTfrontend/hwform.cpp
--- a/QTfrontend/game.cpp	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/game.cpp	Fri Jan 04 02:58:19 2013 +0100
@@ -22,7 +22,10 @@
 #include <QColor>
 #include <QStringListModel>
 #include <QTextStream>
+#include <utility>
 
+#include "hwform.h"
+#include "ui/page/pageoptions.h"
 #include "game.h"
 #include "hwconsts.h"
 #include "gameuiconfig.h"
@@ -297,6 +300,16 @@
                 writeCampaignVar(msg.right(msg.size() - 3));
             break;
         }
+        case 'W':
+        {
+            // fetch new window resolution via IPC and save it in the settings
+            int size = msg.size();
+            QString newResolution = QString().append(msg.mid(2)).left(size - 4);
+            QStringList wh = newResolution.split('x');
+            config->Form->ui.pageOptions->windowWidthEdit->setText(wh[0]);
+            config->Form->ui.pageOptions->windowHeightEdit->setText(wh[1]);
+            break;
+        }
         default:
         {
             if (gameType == gtNet && !netSuspend)
@@ -336,7 +349,7 @@
 QStringList HWGame::getArguments()
 {
     QStringList arguments;
-    QRect resolution = config->vid_Resolution();
+    std::pair<QRect, QRect> resolutions = config->vid_ResolutionPair();
     QString nick = config->netNick().toUtf8().toBase64();
 
     arguments << "--internal"; //Must be passed as first argument
@@ -352,10 +365,14 @@
     arguments << QString::number(config->timerInterval());
     arguments << "--volume";
     arguments << QString::number(config->volume());
+    arguments << "--fullscreen-width";
+    arguments << QString::number(resolutions.first.width());
+    arguments << "--fullscreen-height";
+    arguments << QString::number(resolutions.first.height());
     arguments << "--width";
-    arguments << QString::number(resolution.width());
+    arguments << QString::number(resolutions.second.width());
     arguments << "--height";
-    arguments << QString::number(resolution.height());
+    arguments << QString::number(resolutions.second.height());
     arguments << "--raw-quality";
     arguments << QString::number(config->translateQuality());
     arguments << "--stereo";
--- a/QTfrontend/gameuiconfig.cpp	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Fri Jan 04 02:58:19 2013 +0100
@@ -24,6 +24,7 @@
 #include <QStandardItemModel>
 #include <QNetworkProxy>
 #include <QNetworkProxyFactory>
+#include <utility>
 
 #include "gameuiconfig.h"
 #include "hwform.h"
@@ -34,6 +35,7 @@
 #include "fpsedit.h"
 #include "HWApplication.h"
 #include "DataManager.h"
+#include "SDL.h"
 
 
 const QNetworkProxy::ProxyType proxyTypesMap[] = {
@@ -81,6 +83,20 @@
             Form->ui.pageOptions->CBResolution->setCurrentIndex(0);
     }
     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; 
+    QString widthStr; widthStr.setNum(screenWidth);
+    QString heightStr; heightStr.setNum(screenHeight);
+    QString wWidth = value("video/windowedWidth", widthStr).toString();
+    QString wHeight = value("video/windowedHeight", heightStr).toString();
+    // If left blank reset the resolution to the default
+    wWidth = (wWidth == "" ? widthStr : wWidth);
+    wHeight = (wHeight == "" ? heightStr : wHeight);
+    Form->ui.pageOptions->windowWidthEdit->setText(wWidth);
+    Form->ui.pageOptions->windowHeightEdit->setText(wHeight);
+    
     Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 1 : t);
     Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
     bool ffscr=value("frontend/fullscreen", false).toBool();
@@ -216,6 +232,8 @@
 void GameUIConfig::SaveOptions()
 {
     setValue("video/resolution", 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());
 
     setValue("video/quality", Form->ui.pageOptions->SLQuality->value());
@@ -335,16 +353,28 @@
     return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString();
 }
 
-QRect GameUIConfig::vid_Resolution()
-{
-    QRect result(0, 0, 640, 480);
+std::pair<QRect, QRect> GameUIConfig::vid_ResolutionPair() {
+    // returns a pair of both the fullscreen and the windowed resolution
+    QRect full(0, 0, 640, 480);
+    QRect windowed(0, 0, 640, 480);
     QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x');
     if (wh.size() == 2)
     {
-        result.setWidth(wh[0].toInt());
-        result.setHeight(wh[1].toInt());
+        full.setWidth(wh[0].toInt());
+        full.setHeight(wh[1].toInt());
     }
-    return result;
+    windowed.setWidth(Form->ui.pageOptions->windowWidthEdit->text().toInt());
+    windowed.setHeight(Form->ui.pageOptions->windowHeightEdit->text().toInt());
+    return std::make_pair(full, windowed);
+}
+
+QRect GameUIConfig::vid_Resolution()
+{
+    std::pair<QRect, QRect> result = vid_ResolutionPair();
+    if(Form->ui.pageOptions->CBFullscreen->isChecked())
+        return result.first;
+    else 
+        return result.second;
 }
 
 bool GameUIConfig::vid_Fullscreen()
--- a/QTfrontend/gameuiconfig.h	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/gameuiconfig.h	Fri Jan 04 02:58:19 2013 +0100
@@ -24,6 +24,7 @@
 #include <QRect>
 #include <QEvent>
 #include <QList>
+#include <utility>
 #include "binds.h"
 
 class HWForm;
@@ -38,6 +39,7 @@
         GameUIConfig(HWForm * FormWidgets, const QString & fileName);
         QStringList GetTeamsList();
         QRect vid_Resolution();
+        std::pair<QRect, QRect> vid_ResolutionPair();
         bool vid_Fullscreen();
         quint32 translateQuality();
         bool isSoundEnabled();
--- a/QTfrontend/hwform.cpp	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/hwform.cpp	Fri Jan 04 02:58:19 2013 +0100
@@ -1860,11 +1860,13 @@
     userPrefix = userPrefix.replace("/","\\");
 #endif
 
-    QRect resolution = config->vid_Resolution();
+    std::pair<QRect, QRect> resolutions = config->vid_ResolutionPair();
     return QString("--prefix " + prefix
                    + " --user-prefix " + userPrefix
-                   + " --width " + QString::number(resolution.width())
-                   + " --height " + QString::number(resolution.height())
+                   + " --fullscreen-width " + QString::number(resolutions.first.width())
+                   + " --fullscreen-height " + QString::number(resolutions.first.height())
+                   + " --width " + QString::number(resolutions.second.width())
+                   + " --height " + QString::number(resolutions.second.height())
                    + " --volume " + QString::number(config->volume())
                    + (config->isMusicEnabled() ? "" : " --nomusic")
                    + (config->isSoundEnabled() ? "" : " --nosound")
--- a/QTfrontend/ui/page/pageoptions.cpp	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/ui/page/pageoptions.cpp	Fri Jan 04 02:58:19 2013 +0100
@@ -271,7 +271,9 @@
 
             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
             QGridLayout * GBAfrontendlayout = new QGridLayout(0);
-            QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
+            QGridLayout * GBAreslayout = new QGridLayout(0);
+            QHBoxLayout * GBAfslayout = new QHBoxLayout(0);
+            QVBoxLayout * GBArescolumn = new QVBoxLayout(0);
             QHBoxLayout * GBAstereolayout = new QHBoxLayout(0);
             QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
 
@@ -304,18 +306,43 @@
             hr->setFixedHeight(10);
             GBAlayout->addWidget(hr);
 
-            QLabel * resolution = new QLabel(AGGroupBox);
-            resolution->setText(QLabel::tr("Resolution"));
-            GBAreslayout->addWidget(resolution);
-
+            CBFullscreen = new QCheckBox(AGGroupBox);
+            GBAreslayout->addWidget(CBFullscreen, 0, 0);
+            CBFullscreen->setText(QLabel::tr("Fullscreen"));
+                        
             CBResolution = new QComboBox(AGGroupBox);
-            GBAreslayout->addWidget(CBResolution);
+            GBArescolumn->addWidget(CBResolution);
+            
+            QLabel * fullscreenResolution = new QLabel(AGGroupBox);
+            fullscreenResolution->setText(QLabel::tr("Fullscreen Resolution"));
+            GBAreslayout->addWidget(fullscreenResolution,1, 0);
+            
+            QLabel * windowedResolution = new QLabel(AGGroupBox);
+            windowedResolution->setText(QLabel::tr("Windowed Resolution"));
+            GBAreslayout->addWidget(windowedResolution, 2, 0);
+            
+            // decorational X
+            QLabel *winLabelX = new QLabel(AGGroupBox);
+            winLabelX->setText("X");
+            
+            windowWidthEdit = new QLineEdit(AGGroupBox);
+            windowWidthEdit->setValidator(new QIntValidator(this));
+            windowHeightEdit = new QLineEdit(AGGroupBox);
+            windowHeightEdit->setValidator(new QIntValidator(this));
+            
+            GBAfslayout->addWidget(windowWidthEdit);
+            GBAfslayout->addWidget(winLabelX);
+            GBAfslayout->addWidget(windowHeightEdit);
+            
+            GBAfslayout->setAlignment(windowHeightEdit, Qt::AlignRight);
+            GBAfslayout->setAlignment(windowWidthEdit, Qt::AlignRight);
+            GBAfslayout->setAlignment(winLabelX, Qt::AlignRight);
+            GBArescolumn->addLayout(GBAfslayout);
+            GBAreslayout->addLayout(GBArescolumn, 1, 1, 2, 1);
+            GBAreslayout->setAlignment(GBArescolumn, Qt::AlignRight);
+            
             GBAlayout->addLayout(GBAreslayout);
-
-            CBFullscreen = new QCheckBox(AGGroupBox);
-            CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
-            GBAreslayout->addWidget(CBFullscreen);
-
+            
             QLabel * quality = new QLabel(AGGroupBox);
             quality->setText(QLabel::tr("Quality"));
             quality->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -638,7 +665,7 @@
     previousQuality = this->SLQuality->value();
     previousResolutionIndex = this->CBResolution->currentIndex();
     previousFullscreenValue = this->CBFullscreen->isChecked();
-
+    // mutually exclude window and fullscreen resolution
     return pageLayout;
 }
 
@@ -672,19 +699,17 @@
 void PageOptions::forceFullscreen(int index)
 {
     bool forced = (index == 7 || index == 8 || index == 9);
-
+    
     if (index != 0)
     {
         this->SLQuality->setValue(this->SLQuality->maximum());
         this->SLQuality->setEnabled(false);
-        this->CBFullscreen->setEnabled(!forced);
         this->CBFullscreen->setChecked(forced ? true : previousFullscreenValue);
         this->CBResolution->setCurrentIndex(forced ? 0 : previousResolutionIndex);
     }
     else
     {
         this->SLQuality->setEnabled(true);
-        this->CBFullscreen->setEnabled(true);
         this->SLQuality->setValue(previousQuality);
         this->CBFullscreen->setChecked(previousFullscreenValue);
         this->CBResolution->setCurrentIndex(previousResolutionIndex);
@@ -704,6 +729,7 @@
 {
     Q_UNUSED(state);
 
+    
     int index = this->CBStereoMode->currentIndex();
     if (index != 7 && index != 8 && index != 9)
         previousFullscreenValue = this->CBFullscreen->isChecked();
--- a/QTfrontend/ui/page/pageoptions.h	Wed Jan 02 23:13:14 2013 +0100
+++ b/QTfrontend/ui/page/pageoptions.h	Fri Jan 04 02:58:19 2013 +0100
@@ -58,6 +58,8 @@
         QComboBox *CBTeamName;
         IconedGroupBox *AGGroupBox;
         QComboBox *CBResolution;
+        QLineEdit *windowWidthEdit;
+        QLineEdit *windowHeightEdit;
         QComboBox *CBStereoMode;
         QCheckBox *CBFrontendSound;
         QCheckBox *CBFrontendMusic;
--- a/hedgewars/ArgParsers.inc	Wed Jan 02 23:13:14 2013 +0100
+++ b/hedgewars/ArgParsers.inc	Fri Jan 04 02:58:19 2013 +0100
@@ -43,8 +43,10 @@
     WriteLn(stdout, ' --user-prefix [path to folder]');
     WriteLn(stdout, ' --locale [name of language file]');
     WriteLn(stdout, ' --nick [string]');
-    WriteLn(stdout, ' --width [screen width in pixels]');
-    WriteLn(stdout, ' --height [screen height in pixels]');
+    WriteLn(stdout, ' --fullscreen-width [fullscreen width in pixels]');
+    WriteLn(stdout, ' --fullscreen-height [fullscreen height in pixels]');
+    WriteLn(stdout, ' --width [window width in pixels]');
+    WriteLn(stdout, ' --height [window height in pixels]');
     WriteLn(stdout, ' --volume [sound level]');
     WriteLn(stdout, ' --frame-interval [milliseconds]');
     Writeln(stdout, ' --stereo [value]');
@@ -159,14 +161,15 @@
 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward;
 
 function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean;
-const videoArray: Array [1..3] of String = ('--width','--height','--depth');
+const videoArray: Array [1..5] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth');
       audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound');
       otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps');
-      mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen');
-      allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality');
-      reallyAll: array[0..28] of shortstring = (
-                '--prefix', '--user-prefix', '--locale', '--width', '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
-                '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
+      mediaArray: Array [1..10] of String = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
+      allArray: Array [1..14] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality');
+      reallyAll: array[0..30] of shortstring = (
+                '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', 
+                '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
+                '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', 
   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   {internal}    '--internal', '--port', '--recorder', '--landpreview',
   {misc}        '--stats-only', '--gci', '--help');
@@ -180,38 +183,40 @@
 
     while (cmdIndex <= High(reallyAll)) and (cmd <> reallyAll[cmdIndex]) do inc(cmdIndex);
     case cmdIndex of
-        {--prefix}          0 : PathPrefix     := getStringParameter (arg, paramIndex, parseParameter);
-        {--user-prefix}     1 : UserPathPrefix := getStringParameter (arg, paramIndex, parseParameter);
-        {--locale}          2 : cLocaleFName   := getStringParameter (arg, paramIndex, parseParameter);
-        {--width}           3 : cScreenWidth   := getLongIntParameter(arg, paramIndex, parseParameter);
-        {--height}          4 : cScreenHeight  := getLongIntParameter(arg, paramIndex, parseParameter);
-        {--frame-interval}  5 : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter);
-        {--volume}          6 : SetVolume       ( getLongIntParameter(arg, paramIndex, parseParameter) );
-        {--nomusic}         7 : SetMusic        ( false );
-        {--nosound}         8 : SetSound        ( false );
-        {--fullscreen}      9 : cFullScreen    := true;
-        {--showfps}        10 : cShowFPS       := true;
-        {--altdmg}         11 : cAltDamage     := true;
-        {--low-quality}    12 : cReducedQuality:= $FFFFFFFF xor rqLowRes;
-        {--raw-quality}    13 : cReducedQuality:= getLongIntParameter(arg, paramIndex, parseParameter);
-        {--stereo}         14 : setStereoMode   ( getLongIntParameter(arg, paramIndex, parseParameter) );
-        {--nick}           15 : UserNick       := parseNick( getStringParameter(arg, paramIndex, parseParameter) );
+        {--prefix}               0 : PathPrefix        := getStringParameter (arg, paramIndex, parseParameter);
+        {--user-prefix}          1 : UserPathPrefix    := getStringParameter (arg, paramIndex, parseParameter);
+        {--locale}               2 : cLocaleFName      := getStringParameter (arg, paramIndex, parseParameter);
+        {--fullscreen-width}     3 : cFullscreenWidth  := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--fullscreen-height}    4 : cFullscreenHeight := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--width}       5 : cWindowedWidth    := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--height}      6 : cWindowedHeight   := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--frame-interval}       7 : cTimerInterval    := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--volume}               8 : SetVolume          ( getLongIntParameter(arg, paramIndex, parseParameter) );
+        {--nomusic}              9 : SetMusic           ( false );
+        {--nosound}             10 : SetSound           ( false );
+        {--fullscreen}          11 : cFullScreen       := true;
+        {--showfps}             12 : cShowFPS          := true;
+        {--altdmg}              13 : cAltDamage        := true;
+        {--low-quality}         14 : cReducedQuality   := $FFFFFFFF xor rqLowRes;
+        {--raw-quality}         15 : cReducedQuality   := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--stereo}              16 : setStereoMode      ( getLongIntParameter(arg, paramIndex, parseParameter) );
+        {--nick}                17 : UserNick          := parseNick( getStringParameter(arg, paramIndex, parseParameter) );
         {deprecated options}
-        {--depth}          16 : setDepth(paramIndex);
-        {--set-video}      17 : parseClassicParameter(videoArray,3,paramIndex);
-        {--set-audio}      18 : parseClassicParameter(audioArray,3,paramIndex);
-        {--set-other}      19 : parseClassicParameter(otherArray,3,paramIndex);
-        {--set-multimedia} 20 : parseClassicParameter(mediaArray,8,paramIndex);
-        {--set-everything} 21 : parseClassicParameter(allArray,12,paramIndex);
+        {--depth}               18 : setDepth(paramIndex);
+        {--set-video}           19 : parseClassicParameter(videoArray,5,paramIndex);
+        {--set-audio}           20 : parseClassicParameter(audioArray,3,paramIndex);
+        {--set-other}           21 : parseClassicParameter(otherArray,3,paramIndex);
+        {--set-multimedia}      22 : parseClassicParameter(mediaArray,10,paramIndex);
+        {--set-everything}      23 : parseClassicParameter(allArray,14,paramIndex);
         {"internal" options}
-        {--internal}       22 : {note it, but do nothing};
-        {--port}            23 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter );
-        {--recorder}       24 : startVideoRecording(paramIndex);
-        {--landpreview}    25 : GameType := gmtLandPreview;
+        {--internal}            24 : {note it, but do nothing};
+        {--port}                25 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter );
+        {--recorder}            26 : startVideoRecording(paramIndex);
+        {--landpreview}         27 : GameType := gmtLandPreview;
         {anything else}
-        {--stats-only}     26 : statsOnlyGame();
-        {--gci}            27 : GciEasterEgg();
-        {--help}           28 : DisplayUsage();
+        {--stats-only}          28 : statsOnlyGame();
+        {--gci}                 29 : GciEasterEgg();
+        {--help}                30 : DisplayUsage();
     else
         begin
         //Asusme the first "non parameter" is the replay file, anything else is invalid
--- a/hedgewars/hwengine.pas	Wed Jan 02 23:13:14 2013 +0100
+++ b/hedgewars/hwengine.pas	Fri Jan 04 02:58:19 2013 +0100
@@ -271,14 +271,17 @@
            ((cNewScreenWidth <> cScreenWidth) or (cNewScreenHeight <> cScreenHeight)) then
         begin
             cScreenResizeDelay:= 0;
-            cScreenWidth:= cNewScreenWidth;
-            cScreenHeight:= cNewScreenHeight;
+            cWindowedWidth:= cNewScreenWidth;
+            cWindowedHeight:= cNewScreenHeight;
+            cScreenWidth:= cWindowedWidth;
+            cScreenHeight:= cWindowedHeight;
 
             ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
             WriteLnToConsole('window resize: ' + IntToStr(cScreenWidth) + ' x ' + IntToStr(cScreenHeight));
             ScriptOnScreenResize();
             InitCameraBorders();
             InitTouchInterface();
+            SendIPC('W' + IntToStr(cScreenWidth) + 'x' + IntToStr(cScreenHeight));
         end;
 
         CurrTime:= SDL_GetTicks();
--- a/hedgewars/uStore.pas	Wed Jan 02 23:13:14 2013 +0100
+++ b/hedgewars/uStore.pas	Fri Jan 04 02:58:19 2013 +0100
@@ -1142,6 +1142,17 @@
     if Length(s) = 0 then
          cFullScreen:= (not cFullScreen)
     else cFullScreen:= s = '1';
+    
+    if cFullScreen then
+        begin
+        cScreenWidth:= cFullscreenWidth;
+        cScreenHeight:= cFullscreenHeight;
+        end
+    else
+        begin
+        cScreenWidth:= cWindowedWidth;
+        cScreenHeight:= cWindowedHeight;
+        end;
 
     AddFileLog('Preparing to change video parameters...');
 {$IFDEF SDL13}
@@ -1219,15 +1230,18 @@
 
     if SDLwindow = nil then
         if cFullScreen then
-            SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cOrigScreenWidth, cOrigScreenHeight, flags or SDL_WINDOW_FULLSCREEN)
+            SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags or SDL_WINDOW_FULLSCREEN)
         else
+            begin
             SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags);
+            end;
     SDLTry(SDLwindow <> nil, true);
 {$ELSE}
     flags:= SDL_OPENGL or SDL_RESIZABLE;
     if cFullScreen then
+        begin
         flags:= flags or SDL_FULLSCREEN;
-
+        end;
     if not cOnlyStats then
         begin
     {$IFDEF WIN32}
--- a/hedgewars/uVariables.pas	Wed Jan 02 23:13:14 2013 +0100
+++ b/hedgewars/uVariables.pas	Fri Jan 04 02:58:19 2013 +0100
@@ -27,10 +27,12 @@
 /////// init flags ///////
     cMinScreenWidth    : LongInt;
     cMinScreenHeight   : LongInt;
+    cFullscreenWidth   : LongInt;
+    cFullscreenHeight  : LongInt;
+    cWindowedWidth     : LongInt;
+    cWindowedHeight    : LongInt;
     cScreenWidth       : LongInt;
     cScreenHeight      : LongInt;
-    cOrigScreenWidth   : LongInt;
-    cOrigScreenHeight  : LongInt;
     cNewScreenWidth    : LongInt;
     cNewScreenHeight   : LongInt;
     cScreenResizeDelay : LongWord;
@@ -2326,6 +2328,10 @@
 
     cScreenWidth    := 1024;
     cScreenHeight   := 768;
+    cFullscreenWidth    := 1024;
+    cFullscreenHeight   := 768;
+    cWindowedWidth    := 1024;
+    cWindowedHeight   := 768;
     cShowFPS        := false;
     cAltDamage      := true;
     cTimerInterval  := 8;
@@ -2508,8 +2514,6 @@
 
     cMinScreenWidth:= min(cScreenWidth, 640);
     cMinScreenHeight:= min(cScreenHeight, 480);
-    cOrigScreenWidth:= cScreenWidth;
-    cOrigScreenHeight:= cScreenHeight;
 
     cNewScreenWidth    := cScreenWidth;
     cNewScreenHeight   := cScreenHeight;