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

Author Topic: get events when window is not in focus  (Read 2997 times)

0 Members and 1 Guest are viewing this topic.

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
get events when window is not in focus
« on: August 07, 2018, 06:19:27 pm »
Is it possible to get events with waitEvent (or even pollEvent) without the window being in focus? Some (although not many) programs do that. For example you can play with PCSX2 while the window is not in focus.

An example would be making an on screen keyboard which highlights buttons pressed without being on focus, for making usage videos of another program.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: get events when window is not in focus
« Reply #1 on: August 07, 2018, 07:35:59 pm »
You can continue to get the real-time state of input devices without using window events; maybe that's what you're hoping to do?

For the example given, you can simply use something like
if (sf::Keyboard::isKeypressed(sf::Keyboard::A))
    aIsPressed = true;
to see if the A key is pressed, for example.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything