[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-users] Windows and toggling full screen mode
From: |
Steve McCrea |
Subject: |
[paragui-users] Windows and toggling full screen mode |
Date: |
Wed, 15 Oct 2003 19:41:40 +0200 |
Hi,
I'd like to be able to switch between full screen and windowed mode under
Windows, while using a theme and layouts. I'm basically
using the dblbuffer example code.
If I start out with the PG_Application windowed, it runs fine, but when I call
app.InitScreen() with SDL_FULLSCREEN in the flags,
two bad things happen.
1. The framerate drops from 30fps to 7fps and the screen flickers very badly.
2. If the bit depth for full screen is different from my desktop, drawing is
corrupted.
If I start out with the PG_Application fullscreen, it runs fine, but when I
call app.InitScreen() without SDL_FULLSCREEN in the
flags:
3. I get a crash [surface->format == 0xfeeefeee] which suggests that the
surfaces are invalid.
Does anyone know what's going on?
It seems from (2) and (3) that I need to reload all the surfaces, but that's
not easy when there's a layout loaded.
Any suggestions? Solutions?
Thanks,
Steve
My main function (trimmed down) is pasted below:
int main(int argc, char *argv[])
{
PG_Application app;
//int videoflags = SDL_SWSURFACE|SDL_FULLSCREEN;
int videoflags = SDL_SWSURFACE;
app.InitScreen(640, 480, 32, videoflags);
app.SetBulkMode(true);
app.LoadTheme("default");
app.LoadLayout("dblbuffer.xml");
app.SetCursor(app.GetTheme()->FindSurface("Pointer", "Pointer", "normal"));
app.ShowCursor(PG_CURSOR_SOFTWARE);
SDL_Surface *screen = app.GetScreen();
Uint32 background = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
bool done = false;
bool toggleFullScreen = false;
while ( !done )
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_KEYDOWN
&& (event.key.keysym.mod & KMOD_ALT) > 0)
{
if (event.key.keysym.sym == SDLK_RETURN)
{
toggleFullScreen = true;
}
if (event.key.keysym.sym == SDLK_q)
{
done = true;
}
}
app.PumpIntoEventQueue(&event);
}
SDL_FillRect(screen, NULL, background);
PG_Widget::BulkBlit();
SDL_Flip(screen);
if (toggleFullScreen)
{
videoflags ^= SDL_FULLSCREEN;
app.InitScreen(640, 480, 32, videoflags);
screen = app.GetScreen();
toggleFullScreen = false;
}
}
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-users] Windows and toggling full screen mode,
Steve McCrea <=