Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » switch back mode for Windows

This thread is locked; no one can reply to it. rss feed Print
switch back mode for Windows
Neil Walker
Member #210
April 2000
avatar

Hello,
After testing on various computers of mine and friends I've noticed that the PAUSE switchback mode works in Windows when running windowed mode, but when you go to fullscreen PAUSE fails and the best you can get is AMNESIA

Is there any reason for this?

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

gnolam
Member #2,030
March 2002
avatar

I believe it's a DirectX limitation. It's the same for BACKGROUND/BACKAMNESIA BTW - I can't ever remember which one works for which mode, so I always do:

 if (set_display_switch_mode(SWITCH_BACKGROUND)) {
    if (set_display_switch_mode(SWITCH_BACKAMNESIA))
       allegro_message("Something, somewhere, went wrong somehow.\n");
   }

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Neil Walker
Member #210
April 2000
avatar

Kind of what I do, but why would you want your game to continue when someone switches out?

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Avenger
Member #4,550
April 2004

Quote:

but why would you want your game to continue when someone switches out?

What if it is a simulator or computation program instead? Allegro is not only for games

Tobias Dammers
Member #2,604
August 2002
avatar

...or a (networked) multiplayer game for that matter. If the program pauses when in background, the server will think you client is dead, or you will have to pause all other clients and the server when one client loses focus. Not good. Better keep running, but then without rendering anything (simple hook will do the trick).

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Bob
Free Market Evangelist
September 2000
avatar

Quote:

Is there any reason for this?

Yes. Microsoft has this idea that whenever your program is switched out from the foreground, has the screen resolution changed, etc, Windows should go ahead and clear all of video memory for you.

Once it's done that, it then notifies the driver that hey, you probably want to reset your GPU's context cause I trampled all over it. Then, it notifies the app that all video memory was lost and can't be retrived. Thanks.

Apps are supposed to hold on to all surface data in main memory and be able to resend them on notice.

This made sense in a world of 1 and 2 MB framebuffers and no hardware acceleration, back in 1992 or so.

--
- Bob
[ -- All my signature links are 404 -- ]

Go to: