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

Author Topic: Way to check for window focus?  (Read 1602 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 11
    • View Profile
Way to check for window focus?
« on: November 14, 2012, 03:37:08 pm »
I currently use the sf::Keyboard::isKeyPressed() function to check for input, because if I use window events, I can't handle multiple key presses.

However, using this makes it so input is recognized, even if I don't have window focus. Is there a way to check if my window has focus?


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10936
    • View Profile
    • development blog
    • Email
Re: Way to check for window focus?
« Reply #1 on: November 14, 2012, 03:57:56 pm »
By using the forum's search function? ::)

Check for the LostFocus and GainFocus event. (See tutorial & docu for more info.)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/