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);
15 static long start_msec, num_frames;
22 int i, trybpp[] = {16, 32, 24, 16, 0};
24 fbgfx_save_video_mode();
25 fbgfx_get_video_mode(&fb_width, &fb_height, &fb_depth);
27 for(i=0; trybpp[i]; i++) {
28 if(!(fb_pixels = fbgfx_set_video_mode(fb_width, fb_height, trybpp[i]))) {
31 fbgfx_get_video_mode(&fb_width, &fb_height, &fb_depth);
32 if(fb_depth == trybpp[i]) {
35 fprintf(stderr, "failed to set color fb_depth: %dbpp\n", trybpp[i]);
38 fprintf(stderr, "no usable color fb_depths found\n");
42 if(fbev_init() == -1) {
45 fbev_keyboard(keyboard, 0);
46 fbev_mbutton(mouse, 0);
47 fbev_mmotion(motion, 0);
49 if(scr_init() == -1) {
52 scr_change(scr_lookup("console"), 0);
53 scr_change(scr_lookup("tunnel"), 4000);
55 start_msec = get_time_msec();
60 time_msec = get_time_msec() - start_msec;
64 if(time_msec >= 4000) {
69 time_msec = get_time_msec() - start_msec;
73 fbgfx_restore_video_mode();
74 if(num_frames && time_msec) {
75 printf("\ravg framerate: %.1f\n", (float)num_frames / ((float)(time_msec - 4000) / 1000.0));
80 static void keyboard(int key, int pressed, void *cls)
93 static void mouse(int bn, int pressed, int x, int y, void *cls)
97 static void motion(int x, int y, void *cls)