VOGONS


Center DOSBOX window

Topic actions

First post, by acd2001

User metadata
Rank Newbie
Rank
Newbie

I found this code to center SDL window from http://www.cplusplus.com/forum/general/106823/
I try in sdl_gui.cpp before SDL_SetVideoMode but isn't working.
Where can i add this code in DOSBOX source ?
Thanks for hints.

char center_env[] = "SDL_VIDEO_CENTERED=center";
SDL_putenv(center_env);

Reply 2 of 3, by acd2001

User metadata
Rank Newbie
Rank
Newbie

diff -Nru dosbox/src/gui/sdlmain.cpp dosbox/src/gui/sdlmain.cpp
--- dosbox/src/gui/sdlmain.cpp 2015-10-22 15:01:38.000000000 +0200
+++ dosbox/src/gui/sdlmain.cpp 2015-10-17 04:39:09.000000000 +0200
@@ -1969,6 +1969,8 @@
*/
putenv(const_cast<char*>("SDL_DISABLE_LOCK_KEYS=1"));
#endif
+ char center_env[] = "SDL_VIDEO_CENTERED=center";
+ SDL_putenv(center_env);
if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM
|SDL_INIT_NOPARACHUTE
) < 0 ) E_Exit("Can't init SDL %s",SDL_GetError());

this centre dosbox window without put stuff in environment