1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
void keySpecialPressed(int key, int x, int y) {
switch(key) {
case GLUT_KEY_LEFT: hero->setDirection(LEFT, true);
break;
case GLUT_KEY_RIGHT: hero->setDirection(RIGHT, true);
break;
case GLUT_KEY_UP: hero->setDirection(UP, true);
break;
case GLUT_KEY_DOWN: hero->setDirection(DOWN, true);
break;
default:
break;
}
}
void keySpecialReleased(int key, int x, int y) {
switch(key) {
case GLUT_KEY_LEFT: hero->setDirection(LEFT, false);
break;
case GLUT_KEY_RIGHT: hero->setDirection(RIGHT, false);
break;
case GLUT_KEY_UP: hero->setDirection(UP, false);
break;
case GLUT_KEY_DOWN: hero->setDirection(DOWN, false);
break;
default:
break;
}
} |
Partager