hedgewars/hwengine.pas
branchhedgeroid
changeset 5725 e27100a0e2d0
parent 5644 4ad07103cfae
parent 5686 3f2e6ec7719a
child 5824 2e5835130d9a
--- a/hedgewars/hwengine.pas	Thu Sep 01 14:55:31 2011 +0200
+++ b/hedgewars/hwengine.pas	Thu Sep 01 17:03:19 2011 +0200
@@ -101,7 +101,6 @@
         gsExit: begin
                 isTerminated:= true;
                 end;
-        gsSuspend: exit;
         end;
 
 {$IFDEF SDL13}
@@ -184,6 +183,16 @@
                         if prevFocusState xor cHasFocus then
                             onFocusStateChanged()
                         end;
+                SDL_VIDEORESIZE: begin
+                    // using lower values causes widget overlap and video issues
+                    if event.resize.w > cMinScreenWidth then cScreenWidth:= event.resize.w
+                    else cScreenWidth:= cMinScreenWidth;
+                    if event.resize.h > cMinScreenHeight then cScreenHeight:= event.resize.h
+                    else cScreenHeight:= cMinScreenHeight;
+                    ParseCommand('fullscr '+intToStr(LongInt(cFullScreen)), true);
+                    WriteLnToConsole('window resize');
+                    InitCameraBorders();
+                    end;
 {$ENDIF}
                 SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
                 SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
@@ -244,6 +253,12 @@
     recordFileName:= gameArgs[10];
     cStereoMode:= smNone;
 {$ENDIF}
+    cMinScreenWidth:= cScreenWidth;
+    cMinScreenHeight:= cScreenHeight;
+    cOrigScreenWidth:= cScreenWidth;
+    cOrigScreenHeight:= cScreenHeight;
+    if 480 < cMinScreenWidth then cMinScreenWidth:= 480;
+    if 320 < cMinScreenHeight then cMinScreenHeight:= 320;
 
     initEverything(true);
     WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');