aboutsummaryrefslogtreecommitdiffstats
path: root/src/drawing.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-23 18:48:32 +0200
committerBad Diode <bd@badd10de.dev>2023-04-23 18:48:32 +0200
commitec5c1ad9f16772434f0f49811c87ec58a3569e83 (patch)
tree854894d7e4e9abb15eceb71332dd9678adc21506 /src/drawing.c
parentef6af29d99f7df6acf088ee28dc026023258c10c (diff)
downloadstepper-ec5c1ad9f16772434f0f49811c87ec58a3569e83.tar.gz
stepper-ec5c1ad9f16772434f0f49811c87ec58a3569e83.zip
Add conditional redrawing
This covers most of the previous functionality, but separating the input handling and rendering functions. Only cursor drawing and a few corner cases missing.
Diffstat (limited to 'src/drawing.c')
-rw-r--r--src/drawing.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drawing.c b/src/drawing.c
index b790595..89d3ef6 100644
--- a/src/drawing.c
+++ b/src/drawing.c
@@ -29,7 +29,7 @@ draw_channels(void) {
29 } 29 }
30 u8 clr = active ? COL_FG : COL_GREY; 30 u8 clr = active ? COL_FG : COL_GREY;
31 size_t y = CHAN_START_Y + i * CHAN_OFFSET_Y; 31 size_t y = CHAN_START_Y + i * CHAN_OFFSET_Y;
32 draw_channel_sprite(CHAN_START_X, y, active, i); 32 draw_channel_sprite(CHAN_START_X, y, clr, i);
33 } 33 }
34} 34}
35 35
@@ -175,8 +175,12 @@ draw_bank_buttons() {
175 175
176void 176void
177draw_pattern_buttons() { 177draw_pattern_buttons() {
178 // Clear patterns.
178 size_t x = PAT_START_X; 179 size_t x = PAT_START_X;
179 size_t y = PAT_START_Y; 180 size_t y = PAT_START_Y;
181
182 draw_filled_rect(x, y, x + PAT_W, y + PAT_H * 8, COL_BG);
183
180 txt_drawf_small("PAT", x, y - 10, COL_FG); 184 txt_drawf_small("PAT", x, y - 10, COL_FG);
181 char pat_names[] = { 185 char pat_names[] = {
182 'A', 'B', 'C', 'D', 186 'A', 'B', 'C', 'D',
@@ -190,7 +194,6 @@ draw_pattern_buttons() {
190 if (i == next_pattern && current_pattern != next_pattern) { 194 if (i == next_pattern && current_pattern != next_pattern) {
191 color = COL_BLUE; 195 color = COL_BLUE;
192 } 196 }
193 draw_filled_rect(x, y, x + PAT_W, y + PAT_H, COL_BG);
194 draw_rect(x, y, x + PAT_W, y + PAT_H, color); 197 draw_rect(x, y, x + PAT_W, y + PAT_H, color);
195 txt_drawc(pat_names[i], x + 4, y + 2, color); 198 txt_drawc(pat_names[i], x + 4, y + 2, color);
196 y += PAT_OFFSET_Y; 199 y += PAT_OFFSET_Y;