X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmenuscr.c;h=22846f40d730f173b96dadf1f585c80bd419bc1b;hb=070956bc54dbfedca82aee3e05f5723af63089ed;hp=04b36f39a58af60d5b179ac97aa4f54b57d6be6b;hpb=5a00ac1b6ff18814600e84e74d4d1e34847e9103;p=eradicate diff --git a/src/menuscr.c b/src/menuscr.c index 04b36f3..22846f4 100644 --- a/src/menuscr.c +++ b/src/menuscr.c @@ -1,17 +1,24 @@ #include #include +#include #include "screens.h" #include "imago2.h" #include "gfx.h" #include "gfxutil.h" #include "game.h" +#include "util.h" + +#define PADX 42 +#define PADX2 (PADX * 2) +#define PADY 16 +#define PADY2 (PADY * 2) static const struct menuent { int x, y, len, height; } menuent[] = { - {240, 300, 170, 40}, - {230, 360, 184, 40}, - {260, 424, 130, 40} + {252 - PADX, 281 - PADY, 147 + PADX2, 37 + PADY2}, + {244 - PADX, 344 - PADY, 161 + PADX2, 37 + PADY2}, + {276 - PADX, 407 - PADY, 102 + PADX2, 38 + PADY2} }; static int cur; @@ -37,6 +44,8 @@ void menu_start(void) { draw = menu_draw; key_event = menu_keyb; + + memcpy(fb_pixels, bgpix, fb_size); } void menu_stop(void) @@ -44,24 +53,37 @@ void menu_stop(void) } +#define BBW 256 +#define BBH 64 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, tmp, cleartop; const struct menuent *ent = menuent + cur; - y = ent->y - ent->height / 2; - offs = y * fb_width + 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, 7, 0x100); + fboffs = ent->y * fb_width + ent->x; - wait_vsync(); + memset(blurbuf[0], 0, sizeof blurbuf[0]); + blit(blurbuf[0], BBW, bgpix + fboffs, ent->len, ent->height, bgwidth); - memcpy(fb_pixels, bgpix, fb_size); - blit(fb_pixels + offs, fb_width, blurbuf[1], ent->len, ent->height, ent->len); + 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(); + + cleartop = 280 * fb_width; + memcpy(fb_pixels + cleartop, bgpix + cleartop, (fb_height - 280) * fb_width << 1); + + blit(fb_pixels + fboffs, fb_width, blurbuf[0], ent->len, ent->height, BBW); + blit_key(fb_pixels + fboffs, fb_width, bgpix + fboffs, ent->len, ent->height, bgwidth, 0); + + if(show_fps) { + blit(fb_pixels, fb_width, bgpix, 64, 16, bgwidth); + } blit_frame(fb_pixels, 0); } @@ -84,5 +106,21 @@ void menu_keyb(int key, int pressed) cur++; } break; + + case '\n': + case '\r': + switch(cur) { + case 0: + /* enter game */ + break; + + case 1: + //options_start(); + break; + + case 2: + game_quit(); + break; + } } }