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

Author Topic: Issue with GetInput(). Space is not being detected under certain conditions  (Read 2092 times)

0 Members and 1 Guest are viewing this topic.

Falcord

  • Newbie
  • *
  • Posts: 2
    • View Profile
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.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
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.

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.
« Last Edit: August 25, 2012, 02:40:28 pm by thePyro_13 »

Falcord

  • Newbie
  • *
  • Posts: 2
    • View Profile
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