SFML community forums

Help => Window => Topic started by: Soul on May 03, 2014, 04:13:10 pm

Title: problem with unactive window and events
Post by: Soul on May 03, 2014, 04:13:10 pm
Hey, i have a problem with renderwindow and events, when my mouse is outside window, this window capture mouse position and keyboard events, how can i disable that functions?
Title: Re: problem with unactive window and events
Post by: Ixrec on May 03, 2014, 04:36:51 pm
You can't disable it, but since you have access to mouse position, window position and window size, it's fairly easy to filter out these events on your own if you don't want to process them.
Title: Re: problem with unactive window and events
Post by: Laurent on May 03, 2014, 04:45:17 pm
If you really use events, you shouldn't receive them if the window doesn't have the focus (which is different from "mouse outside the window").
Title: Re: problem with unactive window and events
Post by: Soul on May 03, 2014, 04:52:09 pm
u use sf::Keyboard, hmm so i must code a simple function to make the solution, thanks for help :)
Title: Re: problem with unactive window and events
Post by: Laurent on May 03, 2014, 05:06:54 pm
Ok, so you're not really using events ;) Be careful when you describe your problem.

Two simple solutions:
- use events instead (sf::Event::KeyPressed)
- grab the latest revision and use the new hasFocus() function (I think it's still in a separate branch)