X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmenuscr.c;h=e3517c494bc310905c5ad2da855669a2876fa70c;hb=ae47c13224ea63ac83f80ab332f7436b3265cdce;hp=51f8ae96370adf14960adf3821b147cdc7fd5616;hpb=7b3c578d22e5eebc4d048655da7bc711662e2179;p=eradicate diff --git a/src/menuscr.c b/src/menuscr.c index 51f8ae9..e3517c4 100644 --- a/src/menuscr.c +++ b/src/menuscr.c @@ -1,4 +1,6 @@ #include +#include +#include #include "screens.h" #include "imago2.h" #include "gfx.h" @@ -8,9 +10,9 @@ static const struct menuent { int x, y, len, height; } menuent[] = { - {240, 300, 170, 32}, - {230, 360, 184, 32}, - {260, 424, 130, 32} + {240, 300, 170, 48}, + {230, 360, 184, 48}, + {260, 424, 130, 48} }; static int cur; @@ -43,36 +45,73 @@ void menu_stop(void) } +#define BBW 512 +#define BBH 128 void menu_draw(void) { - static uint16_t blurbuf[2][16384]; - int y, offs; - int i, j; + static uint16_t blurbuf[2][BBW * BBH]; + int fboffs, bboffs, tmp; 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); + int blur_rad_x = (int)((sin(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f); + int blur_rad_y = (int)((cos(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f); - //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]; - } - } + fboffs = (ent->y - ent->height / 2) * fb_width + ent->x; + bboffs = (BBH - ent->height) / 2 * BBW + BBW / 2; + + memset(blurbuf[0], 0, sizeof blurbuf[0]); + blit(blurbuf[0] + bboffs, BBW, bgpix + fboffs, ent->len, ent->height, bgwidth); + + blur_horiz(blurbuf[1], blurbuf[0], BBW, BBH, blur_rad_x + 3, 0x140); + blur_vert(blurbuf[0], blurbuf[1], BBW, BBH, blur_rad_y / 4 + 3, 0x140); wait_vsync(); - blit_frame(bgpix, 0); - blit(fb_pixels + offs, fb_width, blurbuf[1], ent->len, ent->height, ent->len); + memcpy(fb_pixels, bgpix, fb_size); + tmp = fboffs; + fboffs -= 16 * fb_width + 128; + bboffs -= 16 * BBW + 128; + blit_key(fb_pixels + fboffs, fb_width, blurbuf[0] + bboffs, ent->len + 256, ent->height + 32, BBW, 0); + fboffs = tmp; + //blit_key(fb_pixels + fboffs, fb_width, bgpix + fboffs, ent->len, ent->height, bgwidth, 0); + + blit_frame(fb_pixels, 0); } void menu_keyb(int key, int pressed) { + if(!pressed) return; + switch(key) { case 27: game_quit(); break; + + case KB_UP: + if(cur > 0) cur--; + break; + + case KB_DOWN: + if(cur < sizeof menuent / sizeof *menuent - 1) { + cur++; + } + break; + + case '\n': + case '\r': + switch(cur) { + case 0: + /* enter game */ + break; + + case 1: + //options_start(); + break; + + case 2: + game_quit(); + break; + } } }