moving on
[eradicate] / src / menuscr.c
index e3517c4..9c85249 100644 (file)
@@ -6,6 +6,7 @@
 #include "gfx.h"
 #include "gfxutil.h"
 #include "game.h"
+#include "util.h"
 
 static const struct menuent {
        int x, y, len, height;
@@ -38,6 +39,8 @@ void menu_start(void)
 {
        draw = menu_draw;
        key_event = menu_keyb;
+
+       memcpy(fb_pixels, bgpix, fb_size);
 }
 
 void menu_stop(void)
@@ -45,13 +48,13 @@ void menu_stop(void)
 }
 
 
-#define BBW            512
-#define BBH            128
+#define BBW            256
+#define BBH            64
 
 void menu_draw(void)
 {
        static uint16_t blurbuf[2][BBW * BBH];
-       int fboffs, bboffs, tmp;
+       int fboffs, bboffs, tmp, cleartop;
        const struct menuent *ent = menuent + cur;
 
        int blur_rad_x = (int)((sin(time_msec / 1000.0f) * 0.5f + 0.5f) * 50.0f);
@@ -66,15 +69,22 @@ void menu_draw(void)
        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();
+       //wait_vsync();
 
-       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 -= 8 * fb_width + 32;
+       bboffs -= 8 * BBW + 32;
+
+       cleartop = 280 * fb_width;
+       memcpy(fb_pixels + cleartop, bgpix + cleartop, (fb_height - 280) * fb_width << 1);
+
+       blit(fb_pixels + fboffs, fb_width, blurbuf[0] + bboffs, ent->len + 64, ent->height + 16, BBW);
        fboffs = tmp;
-       //blit_key(fb_pixels + fboffs, fb_width, bgpix + fboffs, ent->len, ent->height, bgwidth, 0);
+       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);
 }