PDA

View Full Version : how can I got the state about some key



yanxiaowen
03-07-2004, 12:35 AM
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

Inquisitor
03-11-2004, 08:01 AM
Use GetKeyboardState or GetKeyState functions.
Or better, use DirectInput.
Shouldn't be too hard to find some appropriate tutorials.

yanxiaowen
03-13-2004, 03:43 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif