How should I tell SDL to maximize the application window?
I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.
Thanks for your replies
How should I tell SDL to maximize the application window?
I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.
Thanks for your replies
There are additional environment variables that can be set to control the display window. Unfortunately the sdl docs are down at the moment, so I can't look up what you need.
SDL_FULLSCREEN is the option you're looking for:
flags |= SDL_FULLSCREEN;
screen = SDL_SetVideoMode(..., flags);
This functionality is controlled by the window manager when you use the SDL_RESIZABLE flag. To simulate the maximizing a window with SDL you would need to first determine the size the window would occupy when maximized. Then you would call SDL_SetVideoMode with this size after placing the window with the SDL_VIDEO_WINDOW_POS environment variable.
If you truly need the window to be maximized as if you had clicked on the maximize button, then you will have to access the underlying window manager directly (i.e. SDL won't help you).
For example, the ShowWindow function can be used to maximize a window using the Win32 API. To get a handle to the window created by SDL use the SDL_GetWMInfo function. The resulting SDL_SysWMinfo struct contains a window field of type HWND. This must be passed to the ShowWindow function along with the SW_MAXIMIZE flag.
SDL_SysWMinfo info;
SDL_GetWMInfo(&info);
ShowWindow(info.window, SW_MAXIMIZE);