hedgewars/hwengine.pas
changeset 5975 c3a8cab64fcb
parent 5968 4e8bb227be9a
child 5995 647d52370ce9
child 6013 4c24f064851e
--- a/hedgewars/hwengine.pas	Tue Sep 20 16:00:20 2011 -0400
+++ b/hedgewars/hwengine.pas	Tue Sep 20 23:43:52 2011 +0200
@@ -154,6 +154,7 @@
 {$WARNINGS ON}
 var PrevTime, CurrTime: Longword;
     prevFocusState: boolean;
+    previousGameState: TGameState;
 begin
     PrevTime:= SDL_GetTicks;
     while isTerminated = false do
@@ -175,6 +176,15 @@
                         begin
                         cHasFocus:= true;
                         onFocusStateChanged()
+                        end
+                    else if event.window.event = SDL_WINDOWEVENT_MINIMIZED then
+                        begin
+                        previousGameState:= GameState;
+                        GameState:= gsSuspend;
+                        end
+                    else if event.window.event = SDL_WINDOWEVENT_RESTORED then
+                        begin
+                        GameState:= previousGameState;
                         end;
 {$ELSE}
                     KeyPressChat(event.key.keysym.unicode);