PDA

View Full Version : what are the codes for arrow keys to use in glut keyboard callback function



BigShooter
10-22-2003, 04:29 PM
Hi, I have a keyboard callback function that I use in glutKeyboardFunc. In there, there is the switch that takes different parameters. I'm just not sure what is the character code for space or the arrow keys...?
I hope someone here can help.
Thank you,
Luke

mdog1234
10-22-2003, 07:01 PM
for arrow keys you will need to use glutSpecialFunc(); Example:

main()
{
glutSpecialFunc(SpecialInput);
}

void SpecialInput(int key, int x, int y)
{
switch(key)
{
case GLUT_KEY_UP:
//do something here
break;
case GLUT_KEY_DOWN:
//do something here
break;
case GLUT_KEY_LEFT:
//do something here
break;
case GLUT_KEY_RIGHT:
//do something here
break;
}

glutPostRedisplay();
}

BigShooter
10-22-2003, 08:35 PM
Thank you,
Luke