Jump to content

  • Log In with Google      Sign In   
  • Create Account


SFML2.0 minimize / lost focus problems


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 BaneTrapper   Members   -  Reputation: 1147

Like
0Likes
Like

Posted 27 November 2012 - 11:53 AM

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.

Current projects:
The Wanderer, 2d turn based rpg style game

www.gamedev.net/topic/641117-check-up-the-wanderer/


Sponsor:

#2 BeerNutts   Crossbones+   -  Reputation: 2756

Like
2Likes
Like

Posted 27 November 2012 - 02:14 PM

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.
My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#3 BaneTrapper   Members   -  Reputation: 1147

Like
0Likes
Like

Posted 28 November 2012 - 08:04 AM

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};


Current projects:
The Wanderer, 2d turn based rpg style game

www.gamedev.net/topic/641117-check-up-the-wanderer/





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS