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

Author Topic: [SOLVED] Prolonged key press timeout  (Read 5874 times)

0 Members and 1 Guest are viewing this topic.

MickeyKnox

  • Newbie
  • *
  • Posts: 43
    • View Profile
[SOLVED] Prolonged key press timeout
« on: August 30, 2021, 07:53:59 pm »
When pressing a key an Event is fired for that key being pressed. After that there is a timeout, in which no Event is fired for the same key still being pressed. The timeout seems to be about one second. After the timeout an Event is fired every frame.

Is it possible to control the lenght of this timeout, setting it to 0? Or is it possible to simply disable the timeout?
« Last Edit: August 30, 2021, 10:27:56 pm by MickeyKnox »

G.

  • Hero Member
  • *****
  • Posts: 1554
    • View Profile
Re: Prolonged key press timeout
« Reply #1 on: August 30, 2021, 09:45:07 pm »
No, it's user preferences dependent. For example in windows 10:


You can disable key repeat with window.setKeyRepeatEnabled if you only want the first keypressed event.
Or you can set a boolean to true when the key pressed event is triggered and set it back to false when key released is triggered.
You can also always check the state of key with sf::Keyboard::isKeyPressed

 

anything