Compare commits

..

4 Commits

Author SHA1 Message Date
dd7a1e935a printHeart 2025-01-23 23:07:21 +01:00
e24d7c5a25 FIX: display x<0 || y<0 2025-01-23 23:07:05 +01:00
7c1167606c Katrin 32. Geburtstag 2025-01-23 22:36:00 +01:00
bc29e0c6b7 made background of characters transparent 2025-01-23 22:36:00 +01:00
3 changed files with 189 additions and 14 deletions

View File

@ -161,8 +161,6 @@ public:
for (uint8_t x = 0; x < DISPLAY_CHAR_WIDTH; ++x) { for (uint8_t x = 0; x < DISPLAY_CHAR_WIDTH; ++x) {
if (*(symbolBit++)) { if (*(symbolBit++)) {
set(xPos + x, yPos + y, color); set(xPos + x, yPos + y, color);
} else {
set(xPos + x, yPos + y, BLACK);
} }
} }
} }
@ -182,8 +180,6 @@ public:
for (int x = 0; x < countof(sym[0]); ++x) { for (int x = 0; x < countof(sym[0]); ++x) {
if (sym[y][x]) { if (sym[y][x]) {
set(xPos + x, yPos + y, color); set(xPos + x, yPos + y, color);
} else {
set(xPos + x, yPos + y, BLACK);
} }
} }
} }
@ -235,6 +231,184 @@ public:
return countof(sym[0]); return countof(sym[0]);
} }
// TODO REMOVE QUICK & DIRTY
uint8_t printHeart(uint8_t xPos, uint8_t yPos) {
bool a[1][1] = {
{X},
};
bool b[3][3] = {
{X, _, X},
{X, X, X},
{_, X, _},
};
bool c[5][5] = {
{_, X, _, X, _},
{X, _, X, _, X},
{X, _, _, _, X},
{_, X, _, X, _},
{_, _, X, _, _},
};
bool d[7][7] = {
{_, X, X, _, X, X, _},
{X, _, _, X, _, _, X},
{X, _, _, _, _, _, X},
{X, _, _, _, _, _, X},
{_, X, _, _, _, X, _},
{_, _, X, _, X, _, _},
{_, _, _, X, _, _, _},
};
bool e[9][9] = {
{_, _, X, _, _, _, X, _, _},
{_, X, _, X, _, X, _, X, _},
{X, _, _, _, X, _, _, _, X},
{X, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, X, _},
{_, _, X, _, _, _, X, _, _},
{_, _, _, X, _, X, _, _, _},
{_, _, _, _, X, _, _, _, _},
};
bool f[11][11] = {
{_, _, X, X, _, _, _, X, X, _, _},
{_, X, _, _, X, _, X, _, _, X, _},
{X, _, _, _, _, X, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, _, _, X, _},
{_, _, X, _, _, _, _, _, X, _, _},
{_, _, _, X, _, _, _, X, _, _, _},
{_, _, _, _, X, _, X, _, _, _, _},
{_, _, _, _, _, X, _, _, _, _, _},
};
bool g[13][13] = {
{_, _, _, X, _, _, _, _, _, X, _, _, _},
{_, _, X, _, X, _, _, _, X, _, X, _, _},
{_, X, _, _, _, X, _, X, _, _, _, X, _},
{X, _, _, _, _, _, X, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, _, _, _, _, X, _},
{_, _, X, _, _, _, _, _, _, _, X, _, _},
{_, _, _, X, _, _, _, _, _, X, _, _, _},
{_, _, _, _, X, _, _, _, X, _, _, _, _},
{_, _, _, _, _, X, _, X, _, _, _, _, _},
{_, _, _, _, _, _, X, _, _, _, _, _, _},
};
bool h[15][15] = {
{_, _, _, X, X, _, _, _, _, _, X, X, _, _, _},
{_, _, X, _, _, X, _, _, _, X, _, _, X, _, _},
{_, X, _, _, _, _, X, _, X, _, _, _, _, X, _},
{X, _, _, _, _, _, _, X, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, _, _, _, _, _, _, X, _},
{_, _, X, _, _, _, _, _, _, _, _, _, X, _, _},
{_, _, _, X, _, _, _, _, _, _, _, X, _, _, _},
{_, _, _, _, X, _, _, _, _, _, X, _, _, _, _},
{_, _, _, _, _, X, _, _, _, X, _, _, _, _, _},
{_, _, _, _, _, _, X, _, X, _, _, _, _, _, _},
{_, _, _, _, _, _, _, X, _, _, _, _, _, _, _},
};
bool i[17][17] = {
{_, _, _, _, X, _, _, _, _, _, _, _, X, _, _, _, _},
{_, _, _, X, _, X, _, _, _, _, _, X, _, X, _, _, _},
{_, _, X, _, _, _, X, _, _, _, X, _, _, _, X, _, _},
{_, X, _, _, _, _, _, X, _, X, _, _, _, _, _, X, _},
{X, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _},
{_, _, X, _, _, _, _, _, _, _, _, _, _, _, X, _, _},
{_, _, _, X, _, _, _, _, _, _, _, _, _, X, _, _, _},
{_, _, _, _, X, _, _, _, _, _, _, _, X, _, _, _, _},
{_, _, _, _, _, X, _, _, _, _, _, X, _, _, _, _, _},
{_, _, _, _, _, _, X, _, _, _, X, _, _, _, _, _, _},
{_, _, _, _, _, _, _, X, _, X, _, _, _, _, _, _, _},
{_, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _},
};
bool j[19][19] = {
{_, _, _, _, X, X, _, _, _, _, _, _, _, X, X, _, _, _, _},
{_, _, _, X, _, _, X, _, _, _, _, _, X, _, _, X, _, _, _},
{_, _, X, _, _, _, _, X, _, _, _, X, _, _, _, _, X, _, _},
{_, X, _, _, _, _, _, _, X, _, X, _, _, _, _, _, _, X, _},
{X, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X},
{_, X, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _},
{_, _, X, _, _, _, _, _, _, _, _, _, _, _, _, _, X, _, _},
{_, _, _, X, _, _, _, _, _, _, _, _, _, _, _, X, _, _, _},
{_, _, _, _, X, _, _, _, _, _, _, _, _, _, X, _, _, _, _},
{_, _, _, _, _, X, _, _, _, _, _, _, _, X, _, _, _, _, _},
{_, _, _, _, _, _, X, _, _, _, _, _, X, _, _, _, _, _, _},
{_, _, _, _, _, _, _, X, _, _, _, X, _, _, _, _, _, _, _},
{_, _, _, _, _, _, _, _, X, _, X, _, _, _, _, _, _, _, _},
{_, _, _, _, _, _, _, _, _, X, _, _, _, _, _, _, _, _, _},
};
const auto now = millis();
static auto step = 0;
static auto last = now;
if (now - last >= 100) {
last = now;
step = (step + 1) % 30;
}
bool *s;
switch (step) {
case 0:
s = (bool *) a;
break;
case 1:
s = (bool *) b;
break;
case 2:
s = (bool *) c;
break;
case 3:
s = (bool *) d;
break;
case 4:
s = (bool *) e;
break;
case 5:
s = (bool *) f;
break;
case 6:
s = (bool *) g;
break;
case 7:
s = (bool *) h;
break;
case 8:
s = (bool *) i;
break;
case 9:
s = (bool *) j;
break;
default:
return 0;
}
auto size = step * 2 + 1;
for (int y = 0; y < size; ++y) {
for (int x = 0; x < size; ++x) {
if (s[y * size + x]) {
set(xPos + x - step, yPos + y - step, RED);
}
}
}
return size;
}
// TODO REMOVE QUICK & DIRTY // TODO REMOVE QUICK & DIRTY
uint8_t printI(uint8_t xPos, uint8_t yPos, Color color) { uint8_t printI(uint8_t xPos, uint8_t yPos, Color color) {
for (int y = 0; y < 5; ++y) { for (int y = 0; y < 5; ++y) {
@ -248,7 +422,7 @@ public:
} }
void set(uint8_t x, uint8_t y, Color color) { void set(uint8_t x, uint8_t y, Color color) {
if (x >= width || y >= height) { if (x < 0 || y < 0 || x >= width || y >= height) {
return; return;
} }
if ((y % 2) != 0) { if ((y % 2) != 0) {

View File

@ -269,18 +269,19 @@ private:
void drawYear(Display& display, int year) const { void drawYear(Display& display, int year) const {
if (plus1DayForSleepingCount) { if (plus1DayForSleepingCount) {
uint8_t x = 0; uint8_t x = 1;
x += display.print(x, 1,SYMBOL_E, WHITE, true); x += display.printM(x, 1, WHITE);
x += 1;
x += display.print(x, 1,SYMBOL_A, WHITE, true);
x += 1; x += 1;
x += display.printM(x, 1, WHITE); x += display.printM(x, 1, WHITE);
x += 1; x += 1;
x += display.printI(x, 1, WHITE); x += display.print(x, 1,SYMBOL_A, WHITE, true);
x += 4;
x += display.print(x, 1, 3, WHITE, true);
x += 1; x += 1;
x += display.print(x, 1,SYMBOL_L, WHITE, true); x += display.print(x, 1, 2, WHITE, true);
x += 3; display.printHeart(15, 4);
x += display.print(x, 1, 5, WHITE, true);
x += 3;
display.printCreeper(x, 0);
} else { } else {
uint8_t x = 8; uint8_t x = 8;
x += display.print(x, 1, year / 1000 % 10, WHITE, true) + 1; x += display.print(x, 1, year / 1000 % 10, WHITE, true) + 1;

View File

@ -5,7 +5,7 @@
#include "display/Display.h" #include "display/Display.h"
#define FAKE_DAYS 0 #define FAKE_DAYS 0
#define FAKE_HOURS 0 #define FAKE_HOURS 2
#define FAKE_MINUTES 0 #define FAKE_MINUTES 0
#define FAKE_SECONDS 0 #define FAKE_SECONDS 0