aboutsummaryrefslogtreecommitdiffstats
path: root/src/drawing.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-07-12 18:24:46 +0200
committerBad Diode <bd@badd10de.dev>2023-07-12 18:24:46 +0200
commit20b1b448b7a1c8e22cb2e0f2d6294533f7a220af (patch)
treee9a6c30530ec6d222e778d83f6f6bca49d0ca378 /src/drawing.c
parentd2be261b88753c3e0fdeb7588057aa3f1648ead5 (diff)
downloadstepper-20b1b448b7a1c8e22cb2e0f2d6294533f7a220af.tar.gz
stepper-20b1b448b7a1c8e22cb2e0f2d6294533f7a220af.zip
Add a notification system and use it for save/copy/paste events
Diffstat (limited to 'src/drawing.c')
-rw-r--r--src/drawing.c26
1 files changed, 25 insertions, 1 deletions
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() {
1246 u8 x1 = PARAMS_START_X + PARAMS_W; 1246 u8 x1 = PARAMS_START_X + PARAMS_W;
1247 u8 y1 = y0 + 10; 1247 u8 y1 = y0 + 10;
1248 u8 color = COL_FG; 1248 u8 color = COL_FG;
1249 draw_filled_rect(x0, y0, x1, y1, COL_BG);
1249 draw_rect(x0, y0, x1, y1, color); 1250 draw_rect(x0, y0, x1, y1, color);
1250 txt_drawf_small("HELLO WORLD!", x0 + 2, y0 + 1, color); 1251 if (notif.time > 0) {
1252 char msg[32] = {0};
1253 if (notif.time <= 32) {
1254 for (size_t i = 0; i < notif.time; i++) {
1255 msg[i] = notif.msg[i + 32 - notif.time];
1256 }
1257 } else {
1258 for (size_t i = 0; i < 32; i++) {
1259 msg[i] = notif.msg[i];
1260 }
1261 }
1262 txt_drawf_small(msg, x0 + 2, y0 + 1, color);
1263 } else {
1264 // if (notif.time > -16) {
1265 // notif.time--;
1266 // return;
1267 // }
1268 // TODO: More context dependent messages? Use instructions?
1269 if (play_status == 0) {
1270 txt_drawf_small("STOPPED", x0 + 2, y0 + 1, color);
1271 } else {
1272 txt_drawf_small("PLAYING", x0 + 2, y0 + 1, color);
1273 }
1274 }
1251} 1275}