-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyboard.cpp
More file actions
45 lines (35 loc) · 762 Bytes
/
keyboard.cpp
File metadata and controls
45 lines (35 loc) · 762 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include "keyboard.h"
bool pause = false;
void processNormalKeys(unsigned char key, int x, int y)
{
if(key == 27)
exit(0);
else if(key == 80 || key == 112)
pause ^= true;
}
void processSpecialKeys(int key, int x, int y)
{
if(pause)
return;
switch(key)
{
case GLUT_KEY_LEFT:
glRotatef(1, 0, 1, 0);
break;
case GLUT_KEY_RIGHT:
glRotatef(-1, 0, 1, 0);
break;
case GLUT_KEY_UP:
glRotatef(1, 1, 0, 0);
break;
case GLUT_KEY_DOWN:
glRotatef(-1, 1, 0, 0);
break;
}
}