Martin Donlon wrote:
Uint32 video_flags;
.
.
.
/* Setup video /
video_flags=SDL_HWSURFACE|SDL_DOUBLEBUF;
SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, video_flags);
.
.
/ Switch to fullscreen /
video_flags|=SDL_FULLSCREEN;
SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, video_flags);
.
.
/ Switch to windowed mode */
video_flags&=~SDL_FULLSCREEN;
SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, video_flags);
.
.
it seems that under gtk, that code doesnt work if I have SDL over a
gtkwidget
My code:
/*close the previus screen */
SDL_QuitSubSystem ( SDL_INIT_VIDEO );
unsetenv (“SDL_WINDOWID”);
if ( SDL_Init ( SDL_INIT_VIDEO ) < 0)
{
DK_ERROR ("Unable to init SDL: %s", SDL_GetError() );
return (FALSE);
}
if ( SDL_VideoModeOK (screen->width, screen->height, 32,
SDL_FULLSCREEN) )
{
fullscreen = SDL_SetVideoMode ( screen->width, screen->height, 32,
SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
if (!fullscreen)
{
DK_ERROR (“Unable to set the fullscreen: %s”, SDL_GetError() );
return (FALSE);
}
}
else
{
DK_ERROR (“video mode is not supported”);
return (FALSE);
}
I need to close the window, unset the enviroment, and restart the
videosystem
And I dont preserve the old bitmap contents, by the way…
Also, when I return back to gtk mode (closing the video with
SDL_QuitSubSystem ( SDL_INIT_VIDEO ) ) SDL events crash the program (I
see it under gdb with ‘bt’)
Any suggestion?–
signed
derethor of centolos