9 unsigned long start_msec, time_msec, num_frames;
11 static void keyboard(int key, int pressed, void *cls);
12 static void mouse(int bn, int pressed, int x, int y, void *cls);
13 static void motion(int x, int y, void *cls);
16 static int xsz, ysz, depth;
23 int i, trybpp[] = {32, 24, 16, 0};
25 fbgfx_save_video_mode();
26 fbgfx_get_video_mode(&xsz, &ysz, &depth);
28 for(i=0; trybpp[i]; i++) {
29 if(!(vmem = fbgfx_set_video_mode(xsz, ysz, trybpp[i]))) {
32 fbgfx_get_video_mode(&xsz, &ysz, &depth);
33 if(depth == trybpp[i]) {
36 fprintf(stderr, "failed to set color depth: %dbpp\n", trybpp[i]);
39 fprintf(stderr, "no usable color depths found\n");
43 if(fbev_init() == -1) {
46 fbev_keyboard(keyboard, 0);
47 fbev_mbutton(mouse, 0);
48 fbev_mmotion(motion, 0);
50 if(init_tunnel(xsz, ysz, depth) == -1) {
54 start_msec = get_time_msec();
59 time_msec = get_time_msec() - start_msec;
65 time_msec = get_time_msec() - start_msec;
69 fbgfx_restore_video_mode();
70 if(num_frames && time_msec) {
71 printf("\ravg framerate: %.1f\n", (float)num_frames / ((float)time_msec / 1000.0));
76 static void keyboard(int key, int pressed, void *cls)
89 static void mouse(int bn, int pressed, int x, int y, void *cls)
93 static void motion(int x, int y, void *cls)