X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fscr%2Fminifx.c;fp=src%2Fscr%2Fminifx.c;h=84f9c388a35e369c1daed16ea52c49f9001a83fd;hp=0000000000000000000000000000000000000000;hb=280b3d2a948e965d7af7f017809c27a2b2ee2ce2;hpb=0d60e0e144c0faf5efb9551d1d23b7463ce8a4c0 diff --git a/src/scr/minifx.c b/src/scr/minifx.c new file mode 100644 index 0000000..84f9c38 --- /dev/null +++ b/src/scr/minifx.c @@ -0,0 +1,169 @@ +#include "demo.h" +#include "imago2.h" +#include "screen.h" +#include +#include +#include +#include +#include + +#include "rlebmap.h" + +/* APPROX. 170 FPS Minimum */ + +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 updatePropeller(float t, RleBitmap *rle); + +static unsigned short *backBuffer; + +static unsigned char miniFXBuffer[1024]; + +static long lastFrameTime = 0; + +static struct screen scr = {"minifx", init, destroy, start, 0, draw}; + +struct screen *minifx_screen(void) { + return &scr; +} + +static int init(void) { + /* Allocate back buffer */ + backBuffer = calloc(FB_WIDTH * FB_HEIGHT, sizeof(unsigned short)); + + return 0; +} + +static void destroy(void) { + free(backBuffer); + backBuffer = 0; +} + +static void start(long trans_time) { lastFrameTime = time_msec; } + +static void draw(void) { + long lastFrameDuration; + int i, stride; + RleBitmap *rle; + int clearColor; + unsigned short clearColor16; + + lastFrameDuration = (time_msec - lastFrameTime) / 1000.0f; + lastFrameTime = time_msec; + + clearColor = 0x888888; + clearColor16 = ((clearColor << 8) & 0xF800) /* R */ + | ((clearColor >> 5) & 0x07E0) /* G */ + | ((clearColor >> 19) & 0x001F); /* B */ + + for (i=0; i= 2; + } + } + + /* Then, encode to rle */ + rleEncode(rle, miniFXBuffer, 32, 32); + + /* Distribute the produced streaks so that they don't produce garbage when interpolated */ + rleDistributeStreaks(rle); +}