Jump to content
  • Advertisement
Sign in to follow this  
cwl157

how to detect if an allegro window is inactive

This topic is 3004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a windowed game in allegro in the Windows OS that has sounds. When the window loses focus, like the user clicks off the window, the sounds freeze because the window is no longer the focus. Does anyone know if there is a way in allegro to detect when the window loses focus like that so i can pause the sounds. I know allegro has windows OS specific functions but am not sure how i would use these to do this. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
i think it might work. To get it to work with sound i was thinking of having a int variable that would be set to 1 if the screen is in focus and 0 if it isn't and then just put an if statement wrapper around the code that plays the sounds to check to make sure the screen is in focus before playing the sound, or maybe i could use that callback function to stop play when the window loses focus and resume play when it comes into focus again.


Thanks.

Share this post


Link to post
Share on other sites
that didn't really work, i tried both the regular and the callback version. Now that i think about it, music in full screen games freezes too when the window loses focus or something, so its probably not that straight forwrad to do this.

Thanks for the help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!