Bad key repeat in SDL

Started by
0 comments, last by enigmamwu03 21 years, 6 months ago
I am having some trouble with the sdl key repeat. I have a sphere on the screen that I want to move between a few positions. When I press up the sphere moves through all the positions until I release the key and I can''t press the key quick enough to get it to move only one position. I have tried enabling the sdl key repeat, but it only seems to work for one key press. Here is the repeat activation: if( SDL_EnableKeyRepeat(100,SDL_DEFAULT_REPEAT_DELAY) ) { cerr << "Failed enabling key repeat" << endl; Exit(1); } I have tried using larger than 100 and INTERVAL instead of delay but it always only works once. Is there an easy way to fix this?
Advertisement
You probably should be checking the event queue for keydown events, instead of checking the keyboard state directly.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

This topic is closed to new replies.

Advertisement