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 if(game_init() == -1) {
41 start_time = glutGet(GLUT_ELAPSED_TIME);
55 void game_swap_buffers(void)
60 static void display(void)
62 time_msec = glutGet(GLUT_ELAPSED_TIME) - start_time;
66 static void idle(void)
71 static void keypress(unsigned char key, int x, int y)
73 game_keyboard(key, 1);
76 static void keyrelease(unsigned char key, int x, int y)
78 game_keyboard(key, 0);
81 static void skeypress(int key, int x, int y)
83 if((key = skey_translate(key)) >= 0) {
84 game_keyboard(key, 1);
88 static void skeyrelease(int key, int x, int y)
90 if((key = skey_translate(key)) >= 0) {
91 game_keyboard(key, 0);
95 static void mbutton(int bn, int st, int x, int y)
97 int bidx = bn - GLUT_LEFT_BUTTON;
98 int press = st == GLUT_DOWN;
99 game_mbutton(bidx, press, x, y);
102 static int skey_translate(int key)
113 case GLUT_KEY_PAGE_UP:
115 case GLUT_KEY_PAGE_DOWN: