Remember initial resolution settings to use when switching to fullscreen mode
authorunc0rr
Sun, 27 Jul 2008 19:47:12 +0000
changeset 1121 d595dc56b4f3
parent 1120 eb5a9f86f9c6
child 1122 e46678a16961
Remember initial resolution settings to use when switching to fullscreen mode
hedgewars/CCHandlers.inc
hedgewars/hwengine.dpr
hedgewars/uMisc.pas
--- a/hedgewars/CCHandlers.inc	Sun Jul 27 19:37:24 2008 +0000
+++ b/hedgewars/CCHandlers.inc	Sun Jul 27 19:47:12 2008 +0000
@@ -456,8 +456,13 @@
 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
 
 flags:= SDL_OPENGL or SDL_RESIZABLE;
-if cFullScreen then flags:= flags or SDL_FULLSCREEN
-               else SDL_WM_SetCaption('Hedgewars', nil);
+if cFullScreen then
+	begin
+	flags:= flags or SDL_FULLSCREEN;
+	cScreenWidth:= cInitWidth;
+	cScreenHeight:= cInitHeight
+	end
+	else SDL_WM_SetCaption('Hedgewars', nil);
 {$IFDEF DEBUGFILE}
 AddFileLog('Freeing old primary surface...');
 {$ENDIF}
--- a/hedgewars/hwengine.dpr	Sun Jul 27 19:37:24 2008 +0000
+++ b/hedgewars/hwengine.dpr	Sun Jul 27 19:47:12 2008 +0000
@@ -156,7 +156,7 @@
 		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_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
 		SDL_QUITEV: isTerminated:= true
 		end;
 CurrTime:= SDL_GetTicks;
@@ -187,6 +187,8 @@
 14: begin
      val(ParamStr(2), cScreenWidth);
      val(ParamStr(3), cScreenHeight);
+     cInitWidth:= cScreenWidth;
+     cInitHeight:= cScreenHeight;
      cBitsStr:= ParamStr(4);
      val(cBitsStr, cBits);
      val(ParamStr(5), ipcPort);
--- a/hedgewars/uMisc.pas	Sun Jul 27 19:37:24 2008 +0000
+++ b/hedgewars/uMisc.pas	Sun Jul 27 19:47:12 2008 +0000
@@ -40,6 +40,8 @@
 	cCloudsNumber    : LongInt = 9;
 	cScreenWidth     : LongInt = 1024;
 	cScreenHeight    : LongInt = 768;
+	cInitWidth       : LongInt = 1024;
+	cInitHeight      : LongInt = 768;
 	cBits            : LongInt = 16;
 	cBitsStr         : string[2] = '16';
 	cTagsMask        : byte = 7;