PDA

View Full Version : Keyboard Input



04-26-2003, 12:15 PM
Hello,
I'v started learning OpenGL and am a bit stuck! I'v got a polygon to rotate around its centre but wish to be able to control it through the keyboard. I'v managed this and it changes direction when I press the LEFT/RIGHT keys Once!!! I want my polygon to move only when I hold down the keys, not when I just press once.

Is this something to do with
keyPressed()
keyTyped()
or
key released?

I'v put my method in keyPressed

Does anyone have any ideas? Thanks very much, this is really confusing me

btw I'm using C++.

SThomas
04-26-2003, 01:01 PM
stuff like keyboard input isn't standardized in c++. what you need to do depends on what windowing framework you're using. if you're using win32, look up the GetKeyState() function. or better yet, consider handling the WM_*BUTTON* messages. if you're using glut, take a look at glutKeyboardFunc() (http://www.opengl.org/developers/documentation/glut/spec3/node49.html) .

-steve

EDIT: ubb code is really stupid.

[This message has been edited by SThomas (edited 04-26-2003).]