[SDL] SDL_SetVideoMode problem

David Olsen jolynsbass at gmail.com
Sun Feb 4 12:35:51 PST 2007


This will work well:
SDL_putenv("SDL_VIDEO_CENTERED=1");

However, it will only work for the first window that is initialized. I mean 
that if you start with a splash screen which is say at 100x100, and then 
after loading all your stuff, you change the window size to 450x450, the 
upper left corner will remain in the same spot. REALLY annoying.

This can be resolved by having the SDL_VIDEO_CENTERED = 1 as a global 
environmental variable (set in the OS's global env var's), but that's a 
stretch to ask the end-user to do such a thing.

I find that even if I call SDL_putenv("SDL_VIDEO_CENTERED=1") again before 
making the 2nd window, it still behaves in the annoying manner of not 
actually being centered.

If all you do is use one window size throughout, though, you're set!
Hope this helps!
-Dave Olsen


----- Original Message ----- 
From: "Adrian Grigore" <adrian at lobstersoft.com>
To: <sdl at libsdl.org>
Sent: Sunday, February 04, 2007 1:48 PM
Subject: Re: [SDL] SDL_SetVideoMode problem


> Ryan C. Gordon <icculus <at> icculus.org> writes:
>
>>
>>
>> > putenv(("SDL_VIDEO_WINDOW_POS="
>>
>> In general, don't use SDL_VIDEO_WINDOW_POS, and never, never use it for
>> fullscreen video modes.
>>
>> --ryan.
>>
>
> Thanks for the suggestion, I will try that.
>
> Is there any other way to make sure that the window (when playing in 
> windowed
> mode) ist nicely set to the middle of the screen?
>
>
> -- Adrian
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 



More information about the SDL mailing list