From 20b1b448b7a1c8e22cb2e0f2d6294533f7a220af Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 12 Jul 2023 18:24:46 +0200 Subject: Add a notification system and use it for save/copy/paste events --- src/drawing.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/drawing.c') diff --git a/src/drawing.c b/src/drawing.c index 3e00e17..b488ed1 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1246,6 +1246,30 @@ draw_notif_bar() { u8 x1 = PARAMS_START_X + PARAMS_W; u8 y1 = y0 + 10; u8 color = COL_FG; + draw_filled_rect(x0, y0, x1, y1, COL_BG); draw_rect(x0, y0, x1, y1, color); - txt_drawf_small("HELLO WORLD!", x0 + 2, y0 + 1, color); + if (notif.time > 0) { + char msg[32] = {0}; + if (notif.time <= 32) { + for (size_t i = 0; i < notif.time; i++) { + msg[i] = notif.msg[i + 32 - notif.time]; + } + } else { + for (size_t i = 0; i < 32; i++) { + msg[i] = notif.msg[i]; + } + } + txt_drawf_small(msg, x0 + 2, y0 + 1, color); + } else { + // if (notif.time > -16) { + // notif.time--; + // return; + // } + // TODO: More context dependent messages? Use instructions? + if (play_status == 0) { + txt_drawf_small("STOPPED", x0 + 2, y0 + 1, color); + } else { + txt_drawf_small("PLAYING", x0 + 2, y0 + 1, color); + } + } } -- cgit v1.2.1