PDA

View Full Version : SDL_WM_ToggleFullScreen



Sektor
01-02-2003, 10:24 AM
If someone is working with SDL, can he tell me if SDL_WM_ToggleFullScreen works for him?

01-02-2003, 04:58 PM
Originally posted by Sektor:
If someone is working with SDL, can he tell me if SDL_WM_ToggleFullScreen works for him?
http://sdldoc.csn.ul.ie/sdlwmtogglefullscreen.php

Toggles the application between windowed and fullscreen mode, if supported. (X11 is the only target currently supported, BeOS support is experimental).

You'd better use SetVideoMode again to switch between the modes!

Sektor
01-03-2003, 04:11 AM
I have tried using again the SDL_SetVideoMode, but it doesn't work.
Here is a piece of the code (the variables and functions are pretty self explanatory, I think - if not, I will explain):



SDL_GL_SetAttribute( SDL_GL_RED_SIZE, bpp_red.Value.i );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, bpp_green.Value.i );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, bpp_blue.Value.i );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, depth_size.Value.i );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, double_buf.Value.i );

if ( SDL_SetVideoMode( screen_width.Value.i, screen_height.Value.i, bpp.Value.i, SDL_OPENGL )== NULL )
{
tLog::Log( 3, "Fatal: video mode set failed: SDL_GetError=", SDL_GetError(), ".\n" );
Quit( 1 );
}
else tLog::Log( 1, "Setting up video mode.\n" );


If I use this code, everything is OK. If I set the flags as "SDL_OPENGL | SDL_FULLSCREEN" again everything is OK.
But if I add immediately after this code the following one, the resolution changes (because I have my screen width and height as 800 and 600 in the program and the resolution of my monitor is now 1024 x 768) and the program displays "Setting up the video mode." (SDL does not return an error). Still, I can not see anything on the monitor.



if ( SDL_SetVideoMode( screen_width.Value.i, screen_height.Value.i, bpp.Value.i, SDL_OPENGL | SDL_FULLSCREEN )== NULL )
{
tLog::Log( 3, "Fatal: video mode set failed: SDL_GetError=", SDL_GetError(), ".\n" );
Quit( 1 );
}
else tLog::Log( 1, "Setting up video mode.\n" );
Any ideas? Maybe I should unlock the surface??