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.
SFML2.0 minimize / lost focus problems
I think you should ask this in the SFML forums. They are pretty good about answering these kind of questions and I'm sure there's a solution to your problem.
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.
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement