X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fmike.c;h=cf1ed73c2b6f53212e690e71576cd202a3cda624;hp=719121ee31f4e44dc1129236e647397027d4d44a;hb=091dc2d13563f81dd3e5c97a585388fc6682184d;hpb=ba3f8e36f9c564d7f1000ccfb78dc63a5a291f5f diff --git a/src/mike.c b/src/mike.c index 719121e..cf1ed73 100644 --- a/src/mike.c +++ b/src/mike.c @@ -9,6 +9,9 @@ #define BG_FILENAME "data/grise.png" +#define MIN_SCROLL 32 +#define MAX_SCROLL (backgroundW - fb_width - MIN_SCROLL) + static int init(void); static void destroy(void); static void start(long trans_time); @@ -51,7 +54,7 @@ static int init(void) static void destroy(void) { - img_free_pixels(background); + //img_free_pixels(background); } static void start(long trans_time) @@ -65,16 +68,17 @@ static void stop(long trans_time) static void draw(void) { - unsigned short *pixels = fb_pixels; - - int j, i; - for (j = 0; j < fb_height; j++) { - for (i = 0; i < fb_width; i++) { - *pixels++ = 0x0000; - } + int scroll = MIN_SCROLL + (MAX_SCROLL - MIN_SCROLL) * mouse_x / fb_width; + unsigned short *dst = fb_pixels; + unsigned short *src = background + 2 * scroll; + int scanline = 0; + + + for (scanline = 0; scanline < fb_height; scanline++) { + memcpy(dst, src, fb_width * 2); + src += backgroundW; + dst += fb_width; } - - memcpy(fb_pixels, background, backgroundW * backgroundH * 2); } /* src and dst can be the same */