PDA

View Full Version : Let player move with keyboard buttons



jasmine
11-21-2016, 05:34 AM
How do I let player move right when i click on right arrow, and left when i click left and up when i click up and down when I click down?

void processSpecialKeys(int key, int x, int y)
{

if (key == GLUT_KEY_UP)
{

}
else if (key == GLUT_KEY_DOWN)
{

}
else if (key == GLUT_KEY_LEFT)
{

}
else if (key == GLUT_KEY_RIGHT)
{

}


glutPostRedisplay();

}