Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Why allegro pause the game if the window lost focus?

This thread is locked; no one can reply to it. rss feed Print
Why allegro pause the game if the window lost focus?
davidcorns
Member #11,644
January 2010

Hi all,

May I ask why allegro pause the game if the window lost focus??

I use a while loop for running the game.
How can I fix it(as I want to create a game that will still run even the window lose focus)?

Thanks

Evert
Member #794
November 2000
avatar

davidcorns
Member #11,644
January 2010

Thanks for your reply.

I have tried set_display_switch_mode(SWITCH_BACKGROUND) under window xp, but still when the window lose focus, the sound delay to play and the whole game stop.

What's going wrong?

Timorg
Member #2,028
March 2002

A couple of questions..
What platfrom are you running the application on?
What is the return value of set_display_switch_mode()?

Not all modes are supported on all platforms, I can only suggest that you setup your code so that you try the variety of background modes in the most preferable order. Then you either dont use video bitmaps, or be prepared to reload them when you get the display switch callback. (set_display_switch_callback())

If you solve the problem in this way, it will work on more platforms without you having to modify your code.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

davidcorns
Member #11,644
January 2010

Thanks for your reply.

>What platfrom are you running the application on?
MS Window XP sp2

>What is the return value of set_display_switch_mode()?
it is 0.

Thanks

ImLeftFooted
Member #3,935
October 2003
avatar

Quote:

Returns -1 if the requested mode is not currently possible.

....

Quote:

SWITCH_BACKAMNESIA
Like SWITCH_BACKGROUND, but this mode doesn't bother to remember the contents of video memory (see SWITCH_AMNESIA). It is again the only mode supported by the fullscreen drivers under Windows that lets the program keep running in the background.

davidcorns
Member #11,644
January 2010

Thanks you all.

Finally, I found that while it did not work even if I had used set_display_switch_mode(SWITCH_BACKGROUND) under window.

It is because I wrote this code before "set_gfx_mode" = =

Anyway, thanks again

Go to: