SFML community forums

Help => Window => Topic started by: Falcord on August 25, 2012, 02:21:06 pm

Title: Issue with GetInput(). Space is not being detected under certain conditions
Post by: Falcord on August 25, 2012, 02:21:06 pm
OS: Ubuntu 12.04, compiling with GCC, no other libraries used except for SFML 1.6.

I'm working on a small game and I've come to find a strange problem:

[...]GetInput().IsKeyDown(sf::Key::Space) will return True normally if I press space, but it will NOT if I'm pressing either the UP and LEFT arrow keys at once, DOWN and LEFT, or DOWN and RIGHT.

This surprisingly specific problem doesn't happen if I'm pressing UP and RIGHT, or any of the arrow keys by themselves. I am certain there isn't anything in my source code causing it, as I've isolated the problem to a very small expression.

In fact, if I use another key (such as the letter J) instead of Space, it works just fine in all directions.

Do you have any idea why the Space key is behaving in such a strange way? Could that be an ubuntu-specific issue? Thank you very much for your insight.
Title: Re: Issue with GetInput(). Space is not being detected under certain conditions
Post by: thePyro_13 on August 25, 2012, 02:37:30 pm
It's probably to do with your keyboard hardware, not your OS or code. Check if this happens in other programs too.

This thread explains the problem pretty well. (http://gaming.stackexchange.com/questions/6669/how-do-i-remove-the-limit-on-pc-keyboard-button-presses)

Try picking a different group of buttons to use as your movement keys, like wasd, tfgh or ijkl. These keys are usually on different circuits due to their common use in games.
Title: Re: Issue with GetInput(). Space is not being detected under certain conditions
Post by: Falcord on August 25, 2012, 02:46:26 pm
Thank you!

Yes, it appears it is a hardware issue. I changed the game bindings to WASD and it works like a charm. Now I can keep working without turning my code sideways again and again =P