aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-07-13 12:25:30 +0200
committerBad Diode <bd@badd10de.dev>2023-07-13 12:25:30 +0200
commit24785160836a68ee360a61c0fabf1b7d042ffc98 (patch)
treea5f787298d7d96d0ace8c8df7fc9168ec4c0e2fe
parent7f57051c51c16c88e5dcaa7bd51ccaec31469c4a (diff)
downloadstepper-24785160836a68ee360a61c0fabf1b7d042ffc98.tar.gz
stepper-24785160836a68ee360a61c0fabf1b7d042ffc98.zip
Improve chain notif bar drawing
-rw-r--r--src/drawing.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/drawing.c b/src/drawing.c
index 4e793ea..0872733 100644
--- a/src/drawing.c
+++ b/src/drawing.c
@@ -1296,28 +1296,25 @@ draw_notif_bar() {
1296 } 1296 }
1297 1297
1298 if (chain.len != 0) { 1298 if (chain.len != 0) {
1299 char msg[64] = {0}; 1299 u8 x = x0 + 2;
1300 char *ptr = msg; 1300 u8 y = y0 + 1;
1301 *ptr++ = 'c'; 1301 txt_drawf_small("CHAIN: ", x, y, color);
1302 *ptr++ = 'h'; 1302 x += 4 * 7;
1303 *ptr++ = 'a';
1304 *ptr++ = 'i';
1305 *ptr++ = 'n';
1306 *ptr++ = ':';
1307 *ptr++ = ' ';
1308 bool first = true; 1303 bool first = true;
1309 for (size_t i = 0; i < MAX_CHAIN; i++) { 1304 for (size_t i = 0, k = 0; i < MAX_CHAIN; i++) {
1310 if (chain.active[i] != 1) { 1305 if (chain.active[i] != 1) {
1311 continue; 1306 continue;
1312 } 1307 }
1313 if (!first) { 1308 if (!first) {
1314 *ptr++ = '-'; 1309 txt_drawc_small('-', x + 4 * k++, y, COL_FG);
1315 } 1310 }
1316 *ptr++ = 'A' + chain.chain[i]; 1311 u8 color = COL_FG;
1312 if (i == chain.current) {
1313 color = COL_OFF;
1314 }
1315 txt_drawc_small('A' + chain.chain[i], x + 4 * k++, y, color);
1317 first = false; 1316 first = false;
1318 } 1317 }
1319 *ptr++ = '\0';
1320 txt_drawf_small(msg, x0 + 2, y0 + 1, color);
1321 } else { 1318 } else {
1322 if (play_status == 0) { 1319 if (play_status == 0) {
1323 txt_drawf_small("STOPPED", x0 + 2, y0 + 1, color); 1320 txt_drawf_small("STOPPED", x0 + 2, y0 + 1, color);
@@ -1343,8 +1340,10 @@ draw_pattern_chain() {
1343 if (chain.active[i]) { 1340 if (chain.active[i]) {
1344 txt_drawc('A' + chain.chain[i], x0 + 4, y0 + 3, color); 1341 txt_drawc('A' + chain.chain[i], x0 + 4, y0 + 3, color);
1345 } 1342 }
1343 color = COL_OFF;
1346 if (chain.current == i && chain.len != 0) { 1344 if (chain.current == i && chain.len != 0) {
1347 draw_line(x0 + 5, y1 - 2, x1 - 5, y1 - 2, COL_ACC_0); 1345 color = COL_ACC_2;
1348 } 1346 }
1347 draw_line(x0 + 5, y1 - 2, x1 - 5, y1 - 2, color);
1349 } 1348 }
1350} 1349}