# HG changeset patch
# User smxx
# Date 1269869715 0
# Node ID adfe8a91658fcb1e7092eb6b2e9a061e4339966a
# Parent  4d6bf54a29731c2aca58e1f17f9ac4be284a5b8b
Engine:
* Show engine window centered on screen if not in fullscreen mode

diff -r 4d6bf54a2973 -r adfe8a91658f hedgewars/SDLh.pas
--- a/hedgewars/SDLh.pas	Mon Mar 29 09:52:10 2010 +0000
+++ b/hedgewars/SDLh.pas	Mon Mar 29 13:35:15 2010 +0000
@@ -683,6 +683,9 @@
 function  SDL_JoystickGetButton(joy: PSDL_Joystick; button: LongInt): Byte; cdecl; external SDLLibName;
 procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName;
 
+function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName;
+function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName;
+
 (*  SDL_TTF  *)
 function  TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
diff -r 4d6bf54a2973 -r adfe8a91658f hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas	Mon Mar 29 09:52:10 2010 +0000
+++ b/hedgewars/hwengine.pas	Mon Mar 29 13:35:15 2010 +0000
@@ -28,7 +28,8 @@
 {$ELSE}
 program hwengine;
 {$ENDIF}
-uses    SDLh in 'SDLh.pas',
+uses
+    SDLh in 'SDLh.pas',
     uConsts in 'uConsts.pas',
     uGame in 'uGame.pas',
     uMisc in 'uMisc.pas',
@@ -266,7 +267,10 @@
     SDLTry(TTF_Init() <> -1, true);
     WriteLnToConsole(msgOK);
 
+    s:= SDL_getenv('SDL_VIDEO_CENTERED');
+    SDL_putenv('SDL_VIDEO_CENTERED=1');
     ShowMainWindow();
+    SDL_putenv(str2pchar('SDL_VIDEO_CENTERED=' + s));
 
     AddProgress();