X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=fbgfx;a=blobdiff_plain;f=src%2Ftunnel.c;h=4707d81a9adb65f712a22265bf463934a6d94412;hp=c6504ce24f99031ce1219cb5f30e400642168c10;hb=70c067c2da05fb71f3d2de115cefbc225eff3667;hpb=21180fdf54f0c578af0959df088de308ce25ca61 diff --git a/src/tunnel.c b/src/tunnel.c index c6504ce..4707d81 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -4,7 +4,8 @@ #include #include #include "tpool.h" -#include "tunnel.h" +#include "demo.h" +#include "screen.h" #define TEX_FNAME "data/grid.png" #define TEX_USCALE 4 @@ -13,7 +14,11 @@ #define USCALE 2 #define VSCALE 1 -extern unsigned long time_msec; +static int init(void); +static void destroy(void); +static void start(long trans_time); +static void stop(long trans_time); +static void draw(void); static void (*draw_tunnel_range)(void*, int, int); @@ -22,6 +27,15 @@ static void draw_tunnel_range32(void *pixels, int starty, int num_lines); static int count_bits(unsigned int x); static int count_zeros(unsigned int x); +static struct screen scr = { + "tunnel", + init, + destroy, + start, + stop, + draw +}; + static int xsz, ysz, vxsz, vysz; static unsigned int *tunnel_map; static unsigned char *tunnel_fog; @@ -34,14 +48,20 @@ static unsigned int tex_xmask, tex_ymask; static struct thread_pool *tpool; -int init_tunnel(int x, int y, int bpp) +struct screen *tunnel_screen(void) +{ + return &scr; +} + + +static int init(void) { int i, j, n; unsigned int *tmap; unsigned char *fog; - float aspect = (float)x / (float)y; + float aspect = (float)fb_width / (float)fb_height; - switch(bpp) { + switch(fb_depth) { case 16: draw_tunnel_range = draw_tunnel_range16; break; @@ -49,12 +69,12 @@ int init_tunnel(int x, int y, int bpp) draw_tunnel_range = draw_tunnel_range32; break; default: - fprintf(stderr, "unsupported color depth: %d\n", bpp); + fprintf(stderr, "unsupported color depth: %d\n", fb_depth); return -1; } - xsz = x; - ysz = y; + xsz = fb_width; + ysz = fb_height; vxsz = xsz / USCALE; vysz = ysz / VSCALE; @@ -117,13 +137,21 @@ int init_tunnel(int x, int y, int bpp) return 0; } -void destroy_tunnel(void) +static void destroy(void) { tpool_destroy(tpool); free(tunnel_map); free(tunnel_fog); } +static void start(long trans_time) +{ +} + +static void stop(long trans_time) +{ +} + #define NUM_WORK_ITEMS 32 static struct work { @@ -137,11 +165,11 @@ static void work_func(void *cls) draw_tunnel_range(w->pixels, w->starty, w->num_lines); } -void draw_tunnel(void *pixels) +static void draw(void) { int i, num_lines = vysz / NUM_WORK_ITEMS; for(i=0; i