Original Post
Hi, So after finding that SDL_WM_ToggleFullScreen() doesn't work well I am unsure about the way I implemented my solution: on keypress.... fullscreen = toggle_fullscreen(fullscreen); The above works, what I am unsure, is the following needed: 1) Free old DisplaySurface 2) Create new tempSurface 3) Set DisplaySurface points to new surface Or could I call SDL_SetVideoMode(... flags); straight away without concerning myself with its return value? [Edited by - NDR008 on August 12, 2008 8:49:52 PM]
[source="cpp"]
bool toggle_fullscreen(bool fullscreen) {
SDL_FreeSurface(g_pDisplaySurface);
SDL_Surface* temp;
if (fullscreen == false) {temp = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, SDL_DOUBLEBUF | SDL_ANYFORMAT | SDL_FULLSCREEN);}
else {temp = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, SDL_DOUBLEBUF | SDL_ANYFORMAT);}
g_pDisplaySurface = temp;
fullscreen = !fullscreen;
return(fullscreen);
}