View Full Version : keyboard input
Vlasko
09-07-2001, 12:13 AM
I'm using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right ....)
marcus256
09-07-2001, 12:21 AM
Originally posted by vlasko:
I'm using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right ....)
I am not a GLUT expert, but with GLFW (http://opengl.freehosting.net/glfw/), which is very similar to GLUT, you can use glfwGetKey() to check for several keys. E.g.:
if( glfwGetKey( GLFW_KEY_UP ) )
{
... move up ...
}
if( glfwGetKey( GLFW_KEY_DOWN ) ) {
... move down ...
} etc.
/Marcus
Morglum
09-08-2001, 12:24 AM
Don't use callback functions, use GetAsyncKeyState (see my reply in the GLUT&Input thread).
marcus256
09-21-2001, 04:34 AM
How much better is GetAsyncKeyState? I've heard that you get better response times. Is there a point in using GetAsyncKeyState if I'm already using a callback function for polling other events?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.