SFML community forums

Help => Window => Topic started by: tobybear on March 23, 2010, 11:37:05 pm

Title: SMFL2: proper handling of 2 simultaneous keypresses?
Post by: tobybear on March 23, 2010, 11:37:05 pm
Hi!
I am using SFML2 and I am having a problem with GetInput().IsKeyDown() when two keys are pressed simultaneously, in my case the "Left" and the "Up" arrow keys:

In my code I use the following lines:
...
bool key_l=window.GetInput().IsKeyDown(sf::Key::Left);
bool key_u=window.GetInput().IsKeyDown(sf::Key::Up);
...

Now when I press the left and up arrow simultaneously, both bools above will be set to true (correct), but releasing both keys causes only the key_u to be set to false, not the key_l, which will then stay forever in "true" (not good for a jump n run, obviously :-)

Seems to happen only with specific key combinations though. Dunno, maybe it is my computer, but can I do anything about it?

Thx,
Toby
Title: SMFL2: proper handling of 2 simultaneous keypresses?
Post by: Laurent on March 24, 2010, 08:22:45 am
Keyboards usually have the other problem (some keys are not reported as down when you press too many of them), but yes it could be a keyboard issue too.

If so, there's nothing you can do about it. You can try your program on other computers to test if it's really caused by your own keyboard.