[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [paragui-users] Windows and toggling full screen mode
From: |
Steve McCrea |
Subject: |
Re: [paragui-users] Windows and toggling full screen mode |
Date: |
Mon, 10 Nov 2003 10:41:33 +0100 |
I found the problem with 1-3 below, for anyone using Windows.
PG_Widget caches a pointer to the screen surface - but that changes in when I
call app.InitScreen().
To work around it, I refresh the cached pointer at the start of
PG_Widget::Redraw, PG_Widget::Blit and PG_Widget::Update like so:
my_srfScreen = PG_Application::GetScreen();
I still reload surfaces if the screen format changes for performance reasons,
but the speed difference without reloading surfaces
nowhere near as pronounced as in point 1.
Cheers,
Steve
----- Original Message -----
From: "Steve McCrea" <address@hidden>
To: <address@hidden>
Sent: Wednesday, October 15, 2003 6:41 PM
Subject: [paragui-users] Windows and toggling full screen mode
> 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;
>
> }
>
>
>
> _______________________________________________
> paragui-users mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/paragui-users
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [paragui-users] Windows and toggling full screen mode,
Steve McCrea <=