10 static const struct menuent {
11 int x, y, len, height;
20 static uint16_t *bgpix;
21 static int bgwidth, bgheight;
25 if(!(bgpix = img_load_pixels("data/menbg640.png", &bgwidth, &bgheight, IMG_FMT_RGB565))) {
26 fprintf(stderr, "failed to load menu bg image\n");
32 void menu_cleanup(void)
34 img_free_pixels(bgpix);
40 key_event = menu_keyb;
53 static uint16_t blurbuf[2][BBW * BBH];
54 int fboffs, bboffs, tmp;
55 const struct menuent *ent = menuent + cur;
57 int blur_rad_x = (int)((sin(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f);
58 int blur_rad_y = (int)((cos(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f);
60 fboffs = (ent->y - ent->height / 2) * fb_width + ent->x;
61 bboffs = (BBH - ent->height) / 2 * BBW + BBW / 2;
63 memset(blurbuf[0], 0, sizeof blurbuf[0]);
64 blit(blurbuf[0] + bboffs, BBW, bgpix + fboffs, ent->len, ent->height, bgwidth);
66 blur_horiz(blurbuf[1], blurbuf[0], BBW, BBH, blur_rad_x + 3, 0x140);
67 blur_vert(blurbuf[0], blurbuf[1], BBW, BBH, blur_rad_y / 4 + 3, 0x140);
71 memcpy(fb_pixels, bgpix, fb_size);
73 fboffs -= 8 * fb_width + 32;
74 bboffs -= 8 * BBW + 32;
75 blit(fb_pixels + fboffs, fb_width, blurbuf[0] + bboffs, ent->len + 64, ent->height + 16, BBW);
77 blit_key(fb_pixels + fboffs, fb_width, bgpix + fboffs, ent->len, ent->height, bgwidth, 0);
79 blit_frame(fb_pixels, 0);
82 void menu_keyb(int key, int pressed)
96 if(cur < sizeof menuent / sizeof *menuent - 1) {