How can I got the state about some key

I use glut

fuction glutKeyboardFunc to register a
call back funtion to get some key event.

but this funtion seems can only the one char
when some key is pressed

and if I want to know some key is in KEY_DOWN state or KEY_UP state, what can I do?

Thanks

Use GetKeyboardState or GetKeyState functions.
Or better, use DirectInput.
Shouldn’t be too hard to find some appropriate tutorials.

Originally posted by Inquisitor:
Use GetKeyboardState or GetKeyState functions.
Or better, use DirectInput.
Shouldn’t be too hard to find some appropriate tutorials.

I have solved my problem like this:

use glutKeyboardFunc to register the call back function to get some key down message

use glutKeyboardUpFunc to register the call back function to get some key up message

and glutKeyboardIngoreRepeat to ingore the auto repeat message when any key is held down

and I will try the suggestion from you

thank you very much

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.