hedgewars/hwengine.dpr
changeset 1120 eb5a9f86f9c6
parent 1097 06b15817b8a0
child 1121 d595dc56b4f3
--- a/hedgewars/hwengine.dpr	Sun Jul 27 19:21:30 2008 +0000
+++ b/hedgewars/hwengine.dpr	Sun Jul 27 19:37:24 2008 +0000
@@ -132,6 +132,17 @@
 halt
 end;
 
+////////////////////////////////
+procedure Resize(w, h: LongInt);
+begin
+cScreenWidth:= w;
+cScreenHeight:= h;
+if cFullScreen then
+	ParseCommand('/fullscr 1', true)
+else
+	ParseCommand('/fullscr 0', true);
+end;
+
 ///////////////////
 procedure MainLoop;
 var PrevTime,
@@ -141,12 +152,13 @@
 PrevTime:= SDL_GetTicks;
 repeat
 while SDL_PollEvent(@event) <> 0 do
-      case event.type_ of
-           SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
-           SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
-                               cHasFocus:= event.active.gain = 1;
-           SDL_QUITEV: isTerminated:= true
-           end;
+	case event.type_ of
+		SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
+		SDL_ACTIVEEVENT: if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
+				cHasFocus:= event.active.gain = 1;
+		SDL_VIDEORESIZE: Resize(max(event.resize.w, 320), max(event.resize.h, 240));
+		SDL_QUITEV: isTerminated:= true
+		end;
 CurrTime:= SDL_GetTicks;
 if PrevTime + cTimerInterval <= CurrTime then
    begin