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