Browse Source

small cleanups

feature/2015
Christian Kroll 14 years ago
parent
commit
1c3d4978c5
  1. 100
      animations/programm.c
  2. 41
      animations/programm.h
  3. 14
      display_loop.c

100
animations/programm.c

@ -7,68 +7,21 @@
#define RANDOM8() (random8()) #define RANDOM8() (random8())
#ifdef ANIMATION_TESTS #ifdef ANIMATION_TESTS
void test1(){
unsigned char x,y;
for (y=0;y<NUM_ROWS;y++){
for (x=0;x<NUM_COLS;x++){
setpixel((pixel){x,y}, 3);
wait(100);
}
}
}
void test_level1(){
unsigned char x,y;
for (y=0;y<NUM_ROWS;y++){
for (x=0;x<NUM_COLS;x++){
setpixel((pixel){x,y}, 1);
wait(5);
}
}
wait(2000);
}
void test_level2(){ void test_level(unsigned char level){
unsigned char x,y; for (unsigned char y=NUM_ROWS;y--;){
for (y=0;y<NUM_ROWS;y++){ for (unsigned char x=NUM_COLS;x--;){
for (x=0;x<NUM_COLS;x++){ setpixel((pixel){x,y}, level);
setpixel((pixel){x,y}, 2);
wait(5); wait(5);
} }
} }
wait(2000); wait(2000);
} }
void test_level3(){
unsigned char x,y;
for (y=0;y<NUM_ROWS;y++){
for (x=0;x<NUM_COLS;x++){
setpixel((pixel){x,y}, 3);
wait(5);
}
}
wait(2000);
}
void test_levels(){
unsigned char x,y,b;
for(b=1;b<4;b++){
for (y=0;y<NUM_ROWS;y++){
for (x=0;x<NUM_COLS;x++){
setpixel((pixel){x,y}, b);
wait(5);
}
}
}
}
void test_palette(){ void test_palette(){
unsigned char x,y,b; for (unsigned char y=NUM_ROWS;y--;){
for (y=0;y<NUM_ROWS;y++){ for (unsigned char x=NUM_COLS;x--;){
b=y%4; setpixel((pixel){x,y}, y%4);
for (x=0;x<NUM_COLS;x++){
setpixel((pixel){x,y}, b);
// wait(1); // wait(1);
} }
} }
@ -76,38 +29,22 @@ void test_palette(){
} }
void test_palette2(){ void test_palette2(){
unsigned char x,y,b; for (unsigned char x=NUM_COLS;x--;){
for (x=0;x<NUM_COLS;x++){ for (unsigned char y=NUM_ROWS;y--;){
b=x%4; setpixel((pixel){x,y}, x%4);
for (y=0;y<NUM_ROWS;y++){
setpixel((pixel){x,y}, b);
// wait(1); // wait(1);
} }
} }
wait(1000); wait(1000);
for (x=0;x<NUM_COLS;x++){ for (unsigned char x=NUM_COLS;x--;){
// shift image right // shift image right
shift_pixmap_l(); shift_pixmap_l();
wait(30); wait(30);
} }
} }
#endif #endif
#ifdef ANIMATION_OFF
void off()
{
clear_screen(0);
while(1)
wait(100);
}
#endif
#ifdef ANIMATION_SPIRALE #ifdef ANIMATION_SPIRALE
static void walk(cursor_t* cur, unsigned char steps, unsigned int delay){ static void walk(cursor_t* cur, unsigned char steps, unsigned int delay){
@ -153,6 +90,7 @@ void spirale(unsigned int delay){
} }
#endif #endif
#ifdef ANIMATION_JOERN1 #ifdef ANIMATION_JOERN1
void joern1(){ void joern1(){
unsigned char i, j, x; unsigned char i, j, x;
@ -171,6 +109,7 @@ unsigned char i, j, x;
} }
#endif #endif
#ifdef ANIMATION_SCHACHBRETT #ifdef ANIMATION_SCHACHBRETT
void schachbrett(unsigned char times){ void schachbrett(unsigned char times){
clear_screen(0); clear_screen(0);
@ -194,7 +133,6 @@ void feuer()
unsigned char y, x; unsigned char y, x;
unsigned int t; unsigned int t;
unsigned char world[NUM_COLS][FEUER_Y]; // double buffer unsigned char world[NUM_COLS][FEUER_Y]; // double buffer
for(t=0; t<800; t++) { for(t=0; t<800; t++) {
// diffuse // diffuse
@ -228,8 +166,6 @@ void feuer()
/** /**
* void random_bright(void) * void random_bright(void)
* by Daniel Otte * by Daniel Otte
*
*
*/ */
void random_bright(unsigned cycles){ void random_bright(unsigned cycles){
uint8_t t,x,y; uint8_t t,x,y;

41
animations/programm.h

@ -1,41 +1,24 @@
#ifndef PROGRAMM_H_ #ifndef PROGRAMM_H_
#define PROGRAMM_H_ #define PROGRAMM_H_
void off(); void test_level(unsigned char level);
void spirale(unsigned int delay);
void joern1();
void joern2();
void draw_line( unsigned char yabs, signed char delta);
void schachbrett(unsigned char times);
void test1();
void test_level1();
void test_level2();
void test_level3();
void test_levels();
void test_palette(); void test_palette();
void test_palette2(); void test_palette2();
// randon dots appear and stay #ifdef ANIMATION_OFF
void dots1(); inline static void off()
{
// rectangle-pattern clear_screen(0);
void rectangle1();
// random rectangles
void rectangles();
// lines show and disappear quickly while(1)
void lines1(); wait(100);
// 8x8 rectangle with a cross inside }
void checkbox(); #endif
// a scanner effect with moving h & v lines void spirale(unsigned int delay);
void movinglines(); void joern1();
void schachbrett(unsigned char times);
void snake();
void matrix();
void fadein();
void feuer(); void feuer();
void random_bright(unsigned cycles); void random_bright(unsigned cycles);

14
display_loop.c

@ -173,23 +173,23 @@ void display_loop(){
#ifdef ANIMATION_TESTS #ifdef ANIMATION_TESTS
case 31: case 31:
test_level1(); test_level(1);
break; break;
case 32:
test_level2();
case 32:
test_level(2);
break; break;
case 33:
test_level3();
case 33:
test_level(3);
break; break;
case 35: case 35:
test_palette(); test_palette();
test_palette2(); test_palette2();
break; break;
#endif #endif
#ifdef MENU_SUPPORT #ifdef MENU_SUPPORT
case 42: case 42:
mode = 1; mode = 1;

Loading…
Cancel
Save