Hello,
A colleague of mine, with whom I work on the game Bitfighter
(bitfighter.org), posted the following question on stackoverflow.com
and asked that I also post it to the SDL mailing list:
Here is the text:
—snip—
We recently ported Bitfighter from GLUT to SDL. There were numerous
benefits to doing this, but a few drawbacks as well, especially in the
area of window management.
Bitfighter runs in a fixed-aspect-ratio window (800x600 pixels). Users
can make their window any size they want, but we capture the resize
event and make adjustments to the requested size to ensure the window
keeps the correct proportions (using SDL_SetVideoMode).
(The following problem applies to Windows, but has not yet been tested
on other platforms. What I describe below refers specifically to
Windows, though I am looking for a platform-independent solution.)
Ordinarily, this works great, except when users maximze their window
by double clicking on the title bar or using the maximize button. In
that case, the window resize event is called with the a window size
approximating the screen size (minus some pixels for window
ornamentation). Unfortunately, when the window is maximized,
SDL_SetVideoMode has no effect (unlike GLUT which was able to resize a
maximized window). Furthermore, subsequent calls to SDL_GetVideoInfo
report the size we requested, not the actual current size of the
window, so it is hard to tell if the attempted resizing worked.
I am looking for a platform independent way to do any of the following
(in descending order of preference):
- Resize a window after it’s been maximized
- Detect when a window has been maximized so that, knowing I can’t
resize it, I can at least adjust the video to be centered - Prevent a window from being maximized (block double clicks on
window title bar, use of the maximize button, and dragging the window
to the top of the screen)
Bitfighter is written in C++, and we’re using the latest official
release of SDL.
—snap—
We are using SDL 1.2.14 at one of the most recent mercurial revisions
for Windows/Mac.
Would there be solutions to any of the above?
Thanks!
D