12 #define PADX2 (PADX * 2)
14 #define PADY2 (PADY * 2)
16 static const struct menuent {
17 int x, y, len, height;
19 {252 - PADX, 281 - PADY, 147 + PADX2, 37 + PADY2},
20 {244 - PADX, 344 - PADY, 161 + PADX2, 37 + PADY2},
21 {276 - PADX, 407 - PADY, 102 + PADX2, 38 + PADY2}
26 static uint16_t *bgpix;
27 static int bgwidth, bgheight;
31 if(!(bgpix = img_load_pixels("data/menbg640.png", &bgwidth, &bgheight, IMG_FMT_RGB565))) {
32 fprintf(stderr, "failed to load menu bg image\n");
38 void menu_cleanup(void)
40 img_free_pixels(bgpix);
46 key_event = menu_keyb;
48 memcpy(fb_pixels, bgpix, fb_size);
61 static uint16_t blurbuf[2][BBW * BBH];
62 int fboffs, tmp, cleartop;
63 const struct menuent *ent = menuent + cur;
65 int blur_rad_x = (int)((sin(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f);
66 int blur_rad_y = (int)((cos(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f);
68 fboffs = ent->y * fb_width + ent->x;
70 memset(blurbuf[0], 0, sizeof blurbuf[0]);
71 blit(blurbuf[0], BBW, bgpix + fboffs, ent->len, ent->height, bgwidth);
73 blur_horiz(blurbuf[1], blurbuf[0], BBW, BBH, blur_rad_x + 3, 0x140);
74 blur_vert(blurbuf[0], blurbuf[1], BBW, BBH, blur_rad_y / 4 + 3, 0x140);
78 cleartop = 280 * fb_width;
79 memcpy(fb_pixels + cleartop, bgpix + cleartop, (fb_height - 280) * fb_width << 1);
81 blit(fb_pixels + fboffs, fb_width, blurbuf[0], ent->len, ent->height, BBW);
82 blit_key(fb_pixels + fboffs, fb_width, bgpix + fboffs, ent->len, ent->height, bgwidth, 0);
85 blit(fb_pixels, fb_width, bgpix, 64, 16, bgwidth);
88 blit_frame(fb_pixels, 0);
91 void menu_keyb(int key, int pressed)
105 if(cur < sizeof menuent / sizeof *menuent - 1) {