7 static void display(void);
8 static void idle(void);
9 static void keypress(unsigned char key, int x, int y);
10 static void keyrelease(unsigned char key, int x, int y);
11 static void skeypress(int key, int x, int y);
12 static void skeyrelease(int key, int x, int y);
13 static void mbutton(int bn, int st, int x, int y);
14 static int skey_translate(int key);
17 static long start_time;
19 int main(int argc, char **argv)
21 glutInit(&argc, argv);
22 glutInitWindowSize(1280, 720);
23 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_SRGB);
24 glutCreateWindow("lugburz VR");
26 glutDisplayFunc(display);
28 glutReshapeFunc(game_reshape);
29 glutKeyboardFunc(keypress);
30 glutKeyboardUpFunc(keyrelease);
31 glutSpecialFunc(skeypress);
32 glutSpecialUpFunc(skeyrelease);
33 glutMouseFunc(mbutton);
34 glutMotionFunc(game_mmotion);
35 glutPassiveMotionFunc(game_mmotion);
37 glutIgnoreKeyRepeat(1);
39 if(game_init() == -1) {
43 start_time = glutGet(GLUT_ELAPSED_TIME);
57 void game_swap_buffers(void)
62 static void display(void)
64 time_msec = glutGet(GLUT_ELAPSED_TIME) - start_time;
68 static void idle(void)
73 static void keypress(unsigned char key, int x, int y)
75 game_keyboard(key, 1);
78 static void keyrelease(unsigned char key, int x, int y)
80 game_keyboard(key, 0);
83 static void skeypress(int key, int x, int y)
85 if((key = skey_translate(key)) >= 0) {
86 game_keyboard(key, 1);
90 static void skeyrelease(int key, int x, int y)
92 if((key = skey_translate(key)) >= 0) {
93 game_keyboard(key, 0);
97 static void mbutton(int bn, int st, int x, int y)
99 int bidx = bn - GLUT_LEFT_BUTTON;
100 int press = st == GLUT_DOWN;
101 game_mbutton(bidx, press, x, y);
104 static int skey_translate(int key)
115 case GLUT_KEY_PAGE_UP:
117 case GLUT_KEY_PAGE_DOWN: