X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmenuscr.c;h=51f8ae96370adf14960adf3821b147cdc7fd5616;hb=7b3c578d22e5eebc4d048655da7bc711662e2179;hp=11abf4435b395cba4d33c28e0ceb5143535130cf;hpb=1ee7845621c04020321fa8dfb6dcbf3d8c6c9b51;p=eradicate diff --git a/src/menuscr.c b/src/menuscr.c index 11abf44..51f8ae9 100644 --- a/src/menuscr.c +++ b/src/menuscr.c @@ -1,20 +1,29 @@ #include -#include "menuscr.h" +#include "screens.h" #include "imago2.h" #include "gfx.h" #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/menpg640.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; } @@ -25,15 +34,38 @@ void menu_cleanup(void) void menu_start(void) { + draw = menu_draw; + key_event = menu_keyb; } 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)