From 2fc64cbc442588dfb0763833cf8785e3cf81d132 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 6 Nov 2011 22:07:24 +0100 Subject: lauftext META MEUTE --- Matrix_5x6/Charlie/Charlie.pde | 47 ++++++++++++++++++++++++++++++++++++++++++ Matrix_5x6/Charlie/font.h | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 Matrix_5x6/Charlie/font.h (limited to 'Matrix_5x6') diff --git a/Matrix_5x6/Charlie/Charlie.pde b/Matrix_5x6/Charlie/Charlie.pde index fa7f4a0..32b1e83 100644 --- a/Matrix_5x6/Charlie/Charlie.pde +++ b/Matrix_5x6/Charlie/Charlie.pde @@ -1,5 +1,7 @@ #include +#include "font.h" + /* TODO: * Laufschrift * Ameise @@ -156,8 +158,53 @@ void schnecke(int s) { } } +void shift_scr_left() { + int x, y; + + for (x=0; x<5; x++) + for (y=0; y<5; y++) + scr[x][y] = scr[x+1][y]; + +} + +void lauftext(char *text) { + byte c; + byte *f; + int x, y; + x = 5; + int i; + + while (c = *(text++)) { + + i = 6; + while (i--) { + if (c > 0x40 && c < 0x5B) { + f = &(font_chars[c-0x41][0]); + } else if (c >= 0x30 && c < 0x3A) { + f = &(font_numbers[c-0x20][0]); + } else if (c == ' ') + f = &(font_space[0][0]); + + for (y=0; y<5; y++) { + scr[x][4-y] = (*(f+y)>>(i+1)&1) * 20; + } + + drawscr(5); + + if (x > 4) { + shift_scr_left(); + } else + x++; + } + + } + + +} + void loop() { // zufall_fading_up(); // zufall_fading_down(); + lauftext("META MEUTE"); schnecke(random(4)); } diff --git a/Matrix_5x6/Charlie/font.h b/Matrix_5x6/Charlie/font.h new file mode 100644 index 0000000..b01794e --- /dev/null +++ b/Matrix_5x6/Charlie/font.h @@ -0,0 +1,47 @@ +/* font from b00lean http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234005825 */ + +byte font_space[][5] = { + {0x00,0x00,0x00,0x00,0x00} +}; + +byte font_chars[][5] = { + {0x7c,0x44,0x44,0x7c,0x44}, // a + {0x7c,0x44,0x78,0x44,0x7c}, + {0x7c,0x40,0x40,0x40,0x7c}, + {0x78,0x44,0x44,0x44,0x78}, + {0x7c,0x40,0x78,0x40,0x7c}, + {0x7c,0x40,0x70,0x40,0x40}, + {0x7c,0x40,0x4c,0x44,0x7c}, + {0x44,0x44,0x7c,0x44,0x44}, + {0x7c,0x10,0x10,0x10,0x7c}, + {0x0c,0x04,0x04,0x44,0x7c}, + {0x44,0x48,0x70,0x48,0x44}, + {0x40,0x40,0x40,0x40,0x7c}, + {0x44,0x6c,0x54,0x44,0x44}, + {0x44,0x64,0x54,0x4c,0x44}, + {0x38,0x44,0x44,0x44,0x38}, + {0x78,0x44,0x78,0x40,0x40}, + {0x7c,0x44,0x44,0x7c,0x10}, + {0x78,0x44,0x78,0x44,0x44}, + {0x7c,0x40,0x7c,0x04,0x7c}, + {0x7c,0x10,0x10,0x10,0x10}, + {0x44,0x44,0x44,0x44,0x7c}, + {0x44,0x44,0x28,0x28,0x10}, + {0x44,0x44,0x54,0x54,0x28}, + {0x44,0x28,0x10,0x28,0x44}, + {0x44,0x44,0x28,0x10,0x10}, + {0x7c,0x08,0x10,0x20,0x7c} // z +}; + +byte font_numbers[][5] = { + {0x7c,0x4c,0x54,0x64,0x7c}, // 0 + {0x10,0x30,0x10,0x10,0x38}, // 1 + {0x78,0x04,0x38,0x40,0x7c}, + {0x7c,0x04,0x38,0x04,0x7c}, + {0x40,0x40,0x50,0x7c,0x10}, + {0x7c,0x40,0x78,0x04,0x78}, + {0x7c,0x40,0x7c,0x44,0x7c}, + {0x7c,0x04,0x08,0x10,0x10}, + {0x7c,0x44,0x7c,0x44,0x7c}, + {0x7c,0x44,0x7c,0x04,0x7c} // 9 +}; -- cgit v1.2.3