Skip to content

Instantly share code, notes, and snippets.

@ggmm-0
Last active August 29, 2015 14:02
Show Gist options
  • Save ggmm-0/a2fb62115ee8bad9f7ad to your computer and use it in GitHub Desktop.
Save ggmm-0/a2fb62115ee8bad9f7ad to your computer and use it in GitHub Desktop.
/** key code constants definition **/
#define LEFT_KEY_CODE 100
#define RIGHT_KEY_CODE 102
#define UP_KEY_CODE 101
#define DOWN_KEY_CODE 103
//...
void keyboard(int key, int x, int y) {
switch(key) {
case UP_KEY_CODE:
xRot -= 1.0f;
glutPostRedisplay();
break;
case DOWN_KEY_CODE:
xRot += 1.0f;
glutPostRedisplay();
break;
case RIGHT_KEY_CODE:
rotateRight();
break;
case LEFT_KEY_CODE:
rotateLeft();
break;
default:
break;
}
}
// w main:
glutSpecialFunc(keyboard); // zamiast glutKeyboardFunc(keyboard);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment