PDA

View Full Version : Keyboard Problems



DimsterEEG
10-25-2006, 05:27 PM
Hello Everyone,
I have the following for the keyboard routine:


void keyboard(unsigned char key, int x, int y){
if(key == 27) {
exit(0);
}
}I have also added it in the main function:

glutKeyboardFunc(keyboard);When the program runs (full screen) it doesn't not respond to any keyboard input. Any idea why this would be?

Thank you.

10-25-2006, 08:01 PM
Originally posted by DimsterEEG:
When the program runs (full screen) it doesn't not respond to any keyboard input. So what is the problem? ;)

Double negative notwithstanding, can you post the entirety of you code? Perhaps in so doing the error will be revealed. Consider also stepping through your code with the debugger. This can help you to track down programmatic errors that are sometimes difficult to spot.

10-26-2006, 04:02 PM
Heh...didn't not even notice the double negative :p
Anyways, the code it self it pretty lengthy. Runs smoothly, just never enters into the keyboard function. I can explain berifly what it does. There are a bunch of circles which are moving (move side at a time). They move on a timed bases, so the initial movement is 1second long and then they return to the original location which takes another second. This is repeated numerous times. The only thing I could think of was that the fact that there is ongoing (timed) movement the app doesn't get a chance to break into the keyboard routine. But I'm sure this can be worked around, people do make apps with constant movement and are still able to interupt with a keyboard event.

Is there a manual keyboard check which can be done throught a routine? Instead of leaving all the handling to the glutKeyboardFunc?

Thank you.