1 2 3 4 5 6 7 8 9 10 11 12 13
|
Uint32 flags = SDL_SWSURFACE; /* Start with whatever flags you prefer */
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, flags); /* Start with whatever settings you prefer */
/* -- Portable Fullscreen Toggling --
As of SDL 1.2.10, if width and height are both 0, SDL_SetVideoMode will use the
width and height of the current video mode (or the desktop mode, if no mode has been set).
Use 0 for Height, Width, and Color Depth to keep the current values. */
flags = screen->flags; /* Save the current flags in case toggling fails */
screen = SDL_SetVideoMode(0, 0, 0, screen->flags ^ SDL_FULLSCREEN); /*Toggles FullScreen Mode */
if(screen == NULL) screen = SDL_SetVideoMode(0, 0, 0, flags); /* If toggle FullScreen failed, then switch back */
if(screen == NULL) exit(1); /* If you can't switch back for some reason, then epic fail */ |
Partager