Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: problem with unactive window and events  (Read 2122 times)

0 Members and 1 Guest are viewing this topic.

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
problem with unactive window and events
« 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?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: problem with unactive window and events
« Reply #1 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: problem with unactive window and events
« Reply #2 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").
Laurent Gomila - SFML developer

Soul

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: problem with unactive window and events
« Reply #3 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 :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: problem with unactive window and events
« Reply #4 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)
Laurent Gomila - SFML developer

 

anything