Engine:
authorsmxx
Mon, 29 Mar 2010 13:35:15 +0000
changeset 3153 adfe8a91658f
parent 3152 4d6bf54a2973
child 3154 32e572debb9c
Engine: * Show engine window centered on screen if not in fullscreen mode
hedgewars/SDLh.pas
hedgewars/hwengine.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;
--- 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();