Windows problem with multiple SDL_VIDEO_WINDO W_POS

Hello,

when I start my SDL application I want to display a splash screen centered on
the screen so I do:

// We want the splashscreen to be centered
SDL_putenv (“SDL_VIDEO_WINDOW_POS=center”);

// We create a window the size and color depth of the splash screen.
splashhwnd = SDL_SetVideoMode (splashbitmap.width,
splashbitmap.height,
splashbitmap.bpp,
SDL_SWSURFACE | SDL_NOFRAME);

So far it works as expected. Later on when I have loaded all my data and I’m
ready to roll I want to create a new window in a different location so I do:

sprintf (window_position,
“SDL_VIDEO_WINDOW_POS=%d,%d”,
windowposition.x,
windowposition.y);
SDL_putenv (window_position);
width = windowposition.width;
height = windowposition.height;
bpp = windowbpp;

// Set the video mode using OpenGL now
screen = SDL_SetVideoMode (width,
height,
bpp,
SDL_OPENGL);

I’m not sure if it’s because by then I switched to using OpenGL but my new
windows instead of being at the coordinates I specified in the second
SDL_putenv, starts at the same coordinates as my splash screen which was
previously centered. The result is my big windows goes off screen instead of
fitting nicely.

I know the env variables are not officially supported but is it a bug in my
code? Or somewhere inside SDL? Or in windows for not updating the variable
properly?

Thanks for your help.

-WildCoder

I just found out that if I compile my application with Visual Studio 2003 (VC7)
my big windows ends up at the new coordinates I specified (almost but more on
that later).
It seems to be only when I compile it with Visual Studio 2005 Express (VC8
Express) that the second window is in the wrong place.

I tried the same project under Gentoo Linux and both windows appear in the
correct place: Splash screen is centered and main window is positioned where I
tell it to.

I set my main window to be in 0,0. Under VC7 the client area of the window
appear in 0,0 which mean that the frame and title are off screen. I would like
to avoid making a special case for windows and have to figure out the size of
the title and frame to adjust my coordinates accordingly on this platform.

I’m sorry I’m new to SDL and I’m not sure if it’s a bug and I should report it
or if I’m doing something wrong.

Thanks for your help.

-WildCoder