How to recenter my window

Right before I call SDL_SetVideoMode, I’m calling

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

and it seems to be working fine. All this happens within a "Player"
class. Well, when I delete my instance of Player, and create another one
it doesn’t “recenter” my window, it just puts de window in the place the
other one was (it matches their top-left corners). How could I recenter
the window?

Hello !

Right before I call SDL_SetVideoMode, I’m calling

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

Try to put it at the start of your app, before calling
SDL_Init …

Just a guess.

CU

I actually AM calling it before SDL_Init, I just didn’t mention it
because I thought SetVideoMode was the one important… Anyway, no, it’s
not working that way. It keeps using the same spot for the top left
corner, the one that centered the first window. Any time I create a new
instance of my class it appears there. I could even accept using a
platform dependent solution, BTW (Windows). I just don’t have much more
time now…

Torsten Giebl escribi?:> Hello !

Right before I call SDL_SetVideoMode, I’m calling

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

Try to put it at the start of your app, before calling
SDL_Init …

Just a guess.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello,
The only way that I’ve been able to always have a recentered window on
resizing is for the evironment variable to be set on the “global” level - in
the Windows environment variables (I have only used Windows…)
I’ve experienced the same top-left-corner issue as you, and have found no
solution except to have the env. var. set globally, but that doesn’t seem to
be an acceptable solution if you want to distribute your program to
others…
-Dave> ----- Original Message -----

From: manugarciac5@yahoo.com.ar (Manuel Garcia Cabrera)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Sunday, June 17, 2007 7:42 AM
Subject: Re: [SDL] How to recenter my window…

I actually AM calling it before SDL_Init, I just didn’t mention it
because I thought SetVideoMode was the one important… Anyway, no, it’s
not working that way. It keeps using the same spot for the top left
corner, the one that centered the first window. Any time I create a new
instance of my class it appears there. I could even accept using a
platform dependent solution, BTW (Windows). I just don’t have much more
time now…

Torsten Giebl escribi?:

Hello !

Right before I call SDL_SetVideoMode, I’m calling

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

Try to put it at the start of your app, before calling
SDL_Init …

Just a guess.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Right before I call SDL_SetVideoMode, I’m calling

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

Can you put together a minimal test case and enter a bug at:
http://bugzilla.libsdl.org/

Thanks!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment