SDL Key press help- NEED BAD HELP

Started by
25 comments, last by ????????? 12 years, 8 months ago

Ok, so adding your code still does not fix it. I do know that it is something with the key presses. :(

I'm not sure if the suggestion was to add additional code to your project, per se.

There are a few different diagnostic approaches you can take here. You can find them described elsewhere in the thread (see rip-off's post above, for example), but I'll summarize here for convenience:

1. Start with a brand new clean project, and create a minimal, single-source-file program that demonstrates the problem behavior. (In your case, the program would likely just create a window, poll for input, and produce some output indicating when keys have been pressed or released.) Generally, creating such an example will have one of two possible results: a) the minimal example works correctly, which indicates there's a problem elsewhere in your code, or b) you end up with a concise example that you can post here for us to look at, and/or submit along with a bug report.

2. Back up your project and then start commenting stuff out, as rip-off suggested. With this approach, you're essentially working backwards towards the aforementioned 'minimal example'. A possible outcome of this approach is that at some point the program will start to work correctly, in which case you can look to whatever you commented out last for clues as to why things aren't working.

3. Start with an example that's known to work correctly (like the example rip-off posted) and then progressively add things until it stops working correctly (in which case the last feature added will provide a clue as to why things aren't working).

4. Use the debugger and/or debug output to try and deduce exactly what's going on inside your program. Input-related errors can be tricky to debug sometimes, but by placing breakpoints or adding debug output strategically, you should be able to narrow things down.

Unfortunately debugging can be hard, but sometimes you just have to dig in and take things apart (or put things together) a piece at a time until you find the problem.
Advertisement
Maybe it's not that but have you try to enable SDL_EnableKeyRepeat(int delay, int interval) ? http://pwet.fr/man/linux/fonctions_bibliotheques/sdl_enablekeyrepeat
The [color=#404040] SDL_EnableKeyRepeat(int delay, int interval); did not work. if i gave you the project(its in code::blocks), maybe one of you could look and fix it?
Nevermind, i fixed it! :P
Would you mind posting the actual cause of the problem and exactly how did you fix it? This may help other people who might come here with similar issue.
WBW, capricorn
I actually dont know what i did... just that i fixed it somehow...
What is this doing in OpenGL section?!?!?! angry.gif

This topic is closed to new replies.

Advertisement