How can I listen for the keys for UP, DOWN, LEFT and RIGHT?
When I ran a test on this using the function below, I fount it hard to display the keys and I don't know their ascii values.
Can anybody help?
1 2 3
void KeyDown(unsignedchar key, int x, int y)
{ cout <<key<<endl;
}
void Special_key_cb(int key, int x, int y){
switch( key ){
case GLUT_KEY_LEFT: //...
case GLUT_KEY_UP: //...
case GLUT_KEY_RIGHT: //...
case GLUT_KEY_DOWN: //...
}
}
//...
glutSpecialFunc(Special_key_cb);