hedgewars/uWorld.pas
changeset 5521 3be9fda5c3c2
parent 5485 e943a005d0e8
child 5522 5a4bc518c59a
--- a/hedgewars/uWorld.pas	Sun Aug 07 13:32:28 2011 -0400
+++ b/hedgewars/uWorld.pas	Sun Aug 07 22:18:51 2011 +0400
@@ -33,6 +33,7 @@
 procedure HideMission;
 procedure ShakeCamera(amount: LongWord);
 procedure MoveCamera;
+procedure onFocusStateChanged;
 
 implementation
 uses
@@ -51,7 +52,8 @@
     uTextures,
     uRender,
     uCaptions,
-    uCursor
+    uCursor,
+    uCommands
     ;
 
 var cWaveWidth, cWaveHeight: LongInt;
@@ -1312,6 +1314,14 @@
     WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
 end;
 
+
+procedure onFocusStateChanged;
+begin
+if (not cHasFocus) and (GameState <> gsConfirm) then
+    ParseCommand('quit', true)
+end;
+
+
 procedure initModule;
 begin
     fpsTexture:= nil;