The docs say, you should use SDL_PumpEvents() to update the key-array returned from SDL_GetKeyState:
http://lin
Can you try this:
Main Topics
Browse All TopicsHello,
I have been using SDL for the first time, attempting to write a simple game in C++ (MVC++ 2008). Everything has been going great except now I've run into a problem with my keyboard input.
At this point the goal of the program is to allow two balls to be moved around the screen independently and simultaneously, with a held key resulting in continued movement. There are plenty of examples online and fundamentally the code works. I can move both balls independently just fine. I can also move the both simultaneously left/right/up/down without trouble.
The Problem: Very specific key combinations result in one of the two balls not being able to move.
IE: Pressing the down arrow key and the right arrow key together (Moving ball #2 diagonally) makes it so ball #1 cannot be moved at all.
Other key combinations either work fine or generate their own non-functioning directions.
The combinations are not random and have stayed the same through out my troubleshooting.
What I've Tried: I've tried two different methods for reading the keyboard and storing the information (Both present in the code provided, with one commented out). Both seem to run exactly the same, with the same problems arising. I also tried switching from the arrow keys to jikl. This configuration has the same type of problems, however the problematic directional combinations have changed.
Speculation: I currently think that this is due to my keyboard's physical hardware. IE when I enter notepad and hold the down and right arrows, I am similarly unable to use asdw. I have read online that this can be a problem.
Question: If this is the problem, how do I get around it (in a keyboard independent manner)? How do commercial games deal with this issue? If this isn't the problem, did I miss something stupid? I am still a little shaky on sdl events.
Thank you.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The docs say, you should use SDL_PumpEvents() to update the key-array returned from SDL_GetKeyState:
http://lin
Can you try this:
Thank you for your comments. I tried both and didn't have any luck. (the SDL_PollEvent already pumps the queque and turning off the repeating keys unfortunately didn't help.)
That the problem also happens in notepad has me convinced it's a problem with the keyboard's hardware. At this point I think I'll just add joystick support and control customization. It's not perfect, but I'm not selling the game or anything, so It will be fine.
Thanks again for your help.
Business Accounts
Answer for Membership
by: ikeworkPosted on 2009-08-24 at 22:45:21ID: 25174793
Hi maeve100,
ki/SDL_Ena bleKeyRepe at
Did you try disabling key-repeat?
http://sdl.beuc.net/sdl.wi
ike