#include "../config.h" #include "../compat/pgmspace.h" #include "../random/prng.h" #include "../pixel.h" #include "../util.h" #define RANDOM8() (random8()) #ifdef ANIMATION_TESTS void test_level(unsigned char level){ for (unsigned char y=NUM_ROWS;y--;){ for (unsigned char x=NUM_COLS;x--;){ setpixel((pixel){x,y}, level); wait(5); } } wait(2000); } void test_palette(){ for (unsigned char y=NUM_ROWS;y--;){ for (unsigned char x=NUM_COLS;x--;){ setpixel((pixel){x,y}, y%4); // wait(1); } } wait(2000); } void test_palette2(){ for (unsigned char x=NUM_COLS;x--;){ for (unsigned char y=NUM_ROWS;y--;){ setpixel((pixel){x,y}, x%4); // wait(1); } } wait(1000); for (unsigned char x=NUM_COLS;x--;){ // shift image right shift_pixmap_l(); wait(30); } } #endif #ifdef ANIMATION_SPIRAL static void walk(cursor_t* cur, unsigned char steps, int delay){ unsigned char x; for(x=steps;x--;){ set_cursor(cur, next_pixel(cur->pos, cur->dir)); wait(delay); } } void spiral(int delay){ clear_screen(0); cursor_t cur; cur.dir = right; cur.mode = set; set_cursor (&cur, (pixel){NUM_COLS-1,0}); unsigned char clearbit=0; while(clearbit == 0){ clearbit = 1; while (!get_next_pixel(cur.pos, cur.dir)){ clearbit = 0; walk(&cur, 1, delay); } cur.dir = direction_r(cur.dir); } cur.mode = clear; set_cursor(&cur, (pixel){(NUM_COLS/2)-1,(NUM_ROWS/2)-1}); for(clearbit=0;clearbit==0;){ if( get_next_pixel(cur.pos, direction_r(cur.dir)) ){ cur.dir = direction_r(cur.dir); } if( get_next_pixel(cur.pos, cur.dir) == 1 ){ walk(&cur , 1, delay); }else{ clearbit = 1; } } } #endif #ifdef ANIMATION_JOERN1 void joern1(){ unsigned char i, j, x; unsigned char rolr=0x01 , rol; clear_screen(3); for(i = 0; i< 80;i++){ rol = rolr; for(j = 0 ;j < NUM_ROWS; j++){ for(x=0;x> 5); } } wait(FIRE_DELAY); } } #endif #ifdef ANIMATION_RANDOM_BRIGHT /** * void random_bright(void) * by Daniel Otte */ void random_bright(unsigned cycles){ uint8_t t,x,y; while(cycles--){ for(y=0; y>0)); setpixel((pixel){x*4+1, y}, 0x3&(t>>2)); setpixel((pixel){x*4+2, y}, 0x3&(t>>4)); setpixel((pixel){x*4+3, y}, 0x3&(t>>6)); } wait(200); } } #endif