14 unsigned long time_msec;
16 unsigned int mouse_bmask;
18 static unsigned long nframes;
19 static const char *start_scr_name;
21 int demo_init(int argc, char **argv)
26 start_scr_name = argv[1];
29 if(scr_init() == -1) {
33 scr = scr_lookup(start_scr_name);
38 if(!scr || scr_change(scr, 4000) == -1) {
39 fprintf(stderr, "screen %s not found\n", start_scr_name ? start_scr_name : "0");
43 /* clear the framebuffer at least once */
44 memset(fb_pixels, 0, fb_width * fb_height * fb_bpp / CHAR_BIT);
48 void demo_cleanup(void)
53 float fps = (float)nframes / ((float)time_msec / 1000.0f);
54 printf("average framerate: %.1f\n", fps);
66 void demo_keyboard(int key, int state)
75 if(key >= '1' && key <= '1' + scr_num_screens()) {
77 printf("change screen %d\n", idx);
78 scr_change(scr_screen(idx), 4000);