Jump to content
  • Advertisement
Sign in to follow this  
BaneTrapper

SFML2.0 minimize / lost focus problems

This topic is 2149 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

Hello.
I am currently trying to add alt+tab functionality while ingame and fullscreen to perform "minimize",
also if screen loses focus invoke same behaviour.

What i am trying to achieve is when user wants to alt tab, or clicks away from the application,
to hide application and only to be shown at "taskbar" also when holding alt and pressing tab to be visible(when using windows)

I have successfully edited my game to handle this, but the window is still up and not minimized as i wish.

Question the first:
How to hide application window, but be able to see it at "task bar"? (how to invoke minimize on window with code)

Question the second:
When i start application, its not shown at "taskbar" until 5-30 seconds pass, any way to speed up this?

Question the third:
When alt tab is pressed, is there a way to get this event in sfml2.0. If not, what is a way to invoke "minimize" when alt tab is pressed?

Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
After mayor fight with bugs here is how i done it.
Using "windows.h" and sfml events

Here is how i done it in a nutshell if anyone needs it.

when sf::Event::LostFocus is triggered i do following

if isFullScreen == true{save all data of window, create a new window that is not fullscreen "NOTE most update handle from window.h when you recreate a new window", limit frames per second to 1 to save process, and using windwos.h function ShowWindow(myWindow, SW_MINIMIZE), make infinite loop where games only handles 1 event "sf::Event::GainedFocus" }

else { limit frames per second to 1, make infinite loop where games only handles 1 event "sf::Event::GainedFocus}

when in this infinite loop the sf::Event::GainedFocus is triggered

if isFullScreen == true { recreate old window using data that was stored "NOTE most update handle from window.h when you recreate a new window" and use windwos.h function ShowWindow(myWindow, SW_RESTORE) to restore window to its previous location and info, turn off limit on FPS, break the infinite loop and go into game}

else{turn off limit on FPS, go intro normal game related stuff / break the infinite loop};[/quote]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!