Reputation: 1577
I am trying to read keyboard input. I can read 2 keys being simultaneously pressed just fine, but when I try 3, the results differ depending on what keys are pressed. For example, if I press and hold the left array key my sprite moves left. Then when I press and hold the right arrow key (still holding the left arrow key) my sprite stops (just like it should). But here is where things get dicey. If I then press and hold the down arrow key the sprite moves down (left, right, and down arrow keys all pressed). If, however, I press and hold the up arrow key (left, right, and up arrow keys all pressed), the sprite does not move at all.
I tried the sample code for the basic keyboard example on Allegro's wiki and got the same result as my code.
I couldn't figure out how I could modify either my code (which is very similar to the example code) or the example code be able to read all the input.
Note: If I press left or right followed by the up arrow key it will move diagonally, but when I press the other left or right arrow key it keeps moving diagonally even though it should just be moving vertically.
Thank you,
tehAlgorithmist
Upvotes: 0
Views: 683
Reputation: 5289
You have to try your code with other keyboard that is capable of sensing more keypresses at once. Preferably gaming one. Usually notebook keyboards are very bad in this. To press more keys at once try to connect two keyboards to your computer and press those keys that exclude each other on separate keyboards.
Upvotes: 1