X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=eradicate;a=blobdiff_plain;f=src%2Fmenuscr.c;h=51f8ae96370adf14960adf3821b147cdc7fd5616;hp=b0e7fb92a848003b987384758c2c3d7ec24b79df;hb=7b3c578d22e5eebc4d048655da7bc711662e2179;hpb=3fe0918c7a62a8e8a3ff169b108c74a1211e9003 diff --git a/src/menuscr.c b/src/menuscr.c index b0e7fb9..51f8ae9 100644 --- a/src/menuscr.c +++ b/src/menuscr.c @@ -5,16 +5,25 @@ #include "gfxutil.h" #include "game.h" -static void *bgpix; +static const struct menuent { + int x, y, len, height; +} menuent[] = { + {240, 300, 170, 32}, + {230, 360, 184, 32}, + {260, 424, 130, 32} +}; + +static int cur; + +static uint16_t *bgpix; static int bgwidth, bgheight; int menu_init(void) { - if(!(bgpix = img_load_pixels("data/menbg640.png", &bgwidth, &bgheight, IMG_FMT_RGB24))) { + if(!(bgpix = img_load_pixels("data/menbg640.png", &bgwidth, &bgheight, IMG_FMT_RGB565))) { fprintf(stderr, "failed to load menu bg image\n"); return -1; } - convimg_rgb24_rgb16(bgpix, bgpix, bgwidth, bgheight); return 0; } @@ -33,9 +42,30 @@ void menu_stop(void) { } + + void menu_draw(void) { - blit_frame(bgpix, 1); + static uint16_t blurbuf[2][16384]; + int y, offs; + int i, j; + const struct menuent *ent = menuent + cur; + + y = ent->y - ent->height / 2; + offs = y * ent->len + ent->x; + blit(blurbuf[0], ent->len, bgpix + offs, ent->len, ent->height, bgwidth); + + //blur_grey_horiz(blurbuf[1], blurbuf[0], ent->len, ent->height, 5, 0x100); + for(i=0; iheight; i++) { + for(j=0; jlen; j++) { + blurbuf[1][i * ent->len + j] = 0xff;//~blurbuf[0][i * ent->len + j]; + } + } + + wait_vsync(); + + blit_frame(bgpix, 0); + blit(fb_pixels + offs, fb_width, blurbuf[1], ent->len, ent->height, ent->len); } void menu_keyb(int key, int pressed)