[SDL] Changing the Screen Size at Runtime

Bob Pendleton bob at pendleton.com
Tue Jan 11 07:04:06 PST 2005

On Tue, 2005-01-11 at 13:29 +0000, Michael Wyrzykowski wrote:
> >Short answer: not reliably.
> >
> >Previous threads about this include:
> >  http://twomix.devolution.com/pipermail/sdl/2004-September/064870.html
> >  http://twomix.devolution.com/pipermail/sdl/2004-November/065847.html
> I looked over the threads, but I still had one question. Maybe its not exactly changing the resolution, but more like "changing the window size". I can do this by using the mouse to resize the window, but I was wondering if I could manually push an event to accomplish the same thing. There is no need to reload the textures when I just change the window size with the mouse, and I was wondering if anyone knew how to specify this with code, as pushing an event of type SDL_VIDEORESIZE did not change the window size.

The SDL_VIDEORESIZE event doesn't do anything by itself. SDL does not
take any action when it sees that event or when it generates that event.
The event is there to tell you that the window has changed size. Your
code is responsible for actually changing the displayable size of the
window. What does your code do to handle the event? It should be calling
SDL_SetVideoMode() to make the SDL surface match the new window size,
and then (on Windows) reloading all your textures and probably
recreating your OpenGL context. 

If your code is not handling the SDL_VIDEORESIZE event then your program
is not doing the right things when the window changes size. 

		Bob Pendleton

> ___________________________________________________________________
> Speed up your surfing with Juno SpeedBand.
> Now includes pop-up blocker!
> Only $14.95/month -visit http://www.juno.com/surf to sign up today!
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl

More information about the SDL mailing list