From 3b5ee67114bf789c93db23b7a3611302dce7142e Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 29 May 2023 16:44:50 +0200 Subject: Add initial theming support --- src/drawing.c | 108 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'src/drawing.c') diff --git a/src/drawing.c b/src/drawing.c index 3264ad8..622b468 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -23,7 +23,7 @@ draw_channels(void) { case 2: { active = patterns[pattern_selection_loc].ch3.active; } break; case 3: { active = patterns[pattern_selection_loc].ch4.active; } break; } - u8 clr = active ? colors[i] : COL_GREY; + u8 clr = active ? colors[i] : COL_OFF; size_t y = CHAN_START_Y + i * CHAN_OFFSET_Y; draw_channel_sprite(CHAN_START_X, y, clr, i); } @@ -150,7 +150,7 @@ draw_bank_buttons() { 'A', 'B', 'C', 'D', }; for (int i = 0; i < 4; i++) { - int color = COL_GREY; + int color = COL_OFF; if (i == current_bank) { color = COL_FG; } @@ -175,12 +175,12 @@ draw_pattern_buttons() { 'E', 'F', 'G', 'H', }; for (int i = 0; i < 8; i++) { - int color = COL_GREY; + int color = COL_OFF; if (i == current_pattern) { color = COL_FG; } if (i == next_pattern && current_pattern != next_pattern) { - color = COL_BLUE; + color = COL_ACC_0; } draw_rect(x, y, x + PAT_W, y + PAT_H, color); txt_drawc(pat_names[i], x + 4, y + 2, color); @@ -203,18 +203,18 @@ draw_play() { size_t x = PLAY_START_X; size_t y = PLAY_START_Y; draw_filled_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_BG); - draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_CYAN); + draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_ACC_2); if (play_status == 1) { // Pause button - draw_filled_rect(x + 10, y + 3, x + 11, y + 7, COL_CYAN); - draw_filled_rect(x + 13, y + 3, x + 14, y + 7, COL_CYAN); + draw_filled_rect(x + 10, y + 3, x + 11, y + 7, COL_ACC_2); + draw_filled_rect(x + 13, y + 3, x + 14, y + 7, COL_ACC_2); } else { // Play button x += 1; - draw_line(x + 10, y + 2, x + 10, y + 8, COL_CYAN); - draw_line(x + 11, y + 3, x + 11, y + 7, COL_CYAN); - draw_line(x + 12, y + 4, x + 12, y + 6, COL_CYAN); - draw_line(x + 13, y + 5, x + 13, y + 5, COL_CYAN); + draw_line(x + 10, y + 2, x + 10, y + 8, COL_ACC_2); + draw_line(x + 11, y + 3, x + 11, y + 7, COL_ACC_2); + draw_line(x + 12, y + 4, x + 12, y + 6, COL_ACC_2); + draw_line(x + 13, y + 5, x + 13, y + 5, COL_ACC_2); } } @@ -222,8 +222,8 @@ void draw_stop() { size_t x = STOP_START_X; size_t y = STOP_START_Y; - draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_RED); - draw_filled_rect(x + 10, y + 3, x + 14, y + 7, COL_RED); + draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_ACC_1); + draw_filled_rect(x + 10, y + 3, x + 14, y + 7, COL_ACC_1); } void @@ -528,7 +528,7 @@ void draw_parameters_wave(ChannelWaveParams *params, bool global) { u8 col_fg = COL_FG; if (global && input_handler == handle_channel_selection) { - col_fg = COL_GREY; + col_fg = COL_OFF; } // Draw current wave data. @@ -540,8 +540,8 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) { size_t y = PARAMS_START_Y + 13; // Wave Patterns. - draw_wave_pattern(wave_a, x, y, COL_WAVE_A); - draw_wave_pattern(wave_b, x + 70, y, COL_WAVE_B); + draw_wave_pattern(wave_a, x, y, COL_ACC_1); + draw_wave_pattern(wave_b, x + 70, y, COL_ACC_2); // Wave text. x -= 2; @@ -624,7 +624,7 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { size_t x_offset = sweep ? 0 : 30; u8 col_fg = COL_FG; if (global && input_handler == handle_channel_selection) { - col_fg = COL_GREY; + col_fg = COL_OFF; } // Duty cycle. @@ -673,18 +673,18 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { x5 += 20; } break; } - draw_line(x0, y0, x1, y0, COL_RED); - draw_line(x1, y1, x1, y0, COL_RED); - draw_line(x1, y1, x2, y1, COL_RED); - draw_line(x2, y1, x2, y0, COL_RED); - draw_line(x2, y0, x3, y0, COL_RED); - draw_line(x3, y1, x3, y0, COL_RED); - draw_line(x3, y1, x4, y1, COL_RED); - draw_line(x4, y1, x4, y0, COL_RED); - draw_line(x4, y0, x5, y0, COL_RED); + draw_line(x0, y0, x1, y0, COL_ACC_1); + draw_line(x1, y1, x1, y0, COL_ACC_1); + draw_line(x1, y1, x2, y1, COL_ACC_1); + draw_line(x2, y1, x2, y0, COL_ACC_1); + draw_line(x2, y0, x3, y0, COL_ACC_1); + draw_line(x3, y1, x3, y0, COL_ACC_1); + draw_line(x3, y1, x4, y1, COL_ACC_1); + draw_line(x4, y1, x4, y0, COL_ACC_1); + draw_line(x4, y0, x5, y0, COL_ACC_1); // Bounding box. - draw_rect(x, y - 3, x + 24, y + 18, COL_RED); + draw_rect(x, y - 3, x + 24, y + 18, COL_ACC_1); } // Param box. @@ -717,7 +717,7 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { size_t y0 = PARAMS_START_Y + PARAMS_H - 47; size_t x1 = x0 + 79; size_t y1 = y0 + 21; - draw_rect(x0, y0, x1, y1, COL_CYAN); + draw_rect(x0, y0, x1, y1, COL_ACC_2); } size_t x = PARAMS_START_X + 42 + x_offset; @@ -731,10 +731,10 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { // Env. if (params->env_time == 0) { - draw_line(x1, y0, x2, y0, COL_CYAN); + draw_line(x1, y0, x2, y0, COL_ACC_2); } else { - draw_line(x0, y0, x1, y1, COL_CYAN); - draw_line(x1, y1, x2, y2, COL_CYAN); + draw_line(x0, y0, x1, y1, COL_ACC_2); + draw_line(x1, y1, x2, y2, COL_ACC_2); } } @@ -894,7 +894,7 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { size_t x_offset = 30; u8 col_fg = COL_FG; if (global && input_handler == handle_channel_selection) { - col_fg = COL_GREY; + col_fg = COL_OFF; } // Bit mode. @@ -927,7 +927,7 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { size_t y0 = PARAMS_START_Y + PARAMS_H - 47; size_t x1 = x0 + 79; size_t y1 = y0 + 21; - draw_rect(x0, y0, x1, y1, COL_CYAN); + draw_rect(x0, y0, x1, y1, COL_ACC_2); } size_t x = PARAMS_START_X + 42 + x_offset; @@ -941,10 +941,10 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { // Env. if (params->env_time == 0) { - draw_line(x1, y0, x2, y0, COL_CYAN); + draw_line(x1, y0, x2, y0, COL_ACC_2); } else { - draw_line(x0, y0, x1, y1, COL_CYAN); - draw_line(x1, y1, x2, y2, COL_CYAN); + draw_line(x0, y0, x1, y1, COL_ACC_2); + draw_line(x1, y1, x2, y2, COL_ACC_2); } } @@ -1073,42 +1073,42 @@ clear_cursors(void) { draw_pattern_cursor(last_pattern_loc, COL_BG); draw_right_col_cursor(last_right_col_loc, COL_BG); for (size_t i = 0; i < 16; i++) { - draw_current_step(i, COL_GREY); + draw_current_step(i, COL_OFF); } } void draw_cursors(void) { clear_cursors(); - draw_current_step(step_counter, COL_RED); + draw_current_step(step_counter, COL_ACC_1); if (input_handler == handle_trigger_selection) { - draw_trig_cursor(trig_selection_loc, COL_CURSOR); + draw_trig_cursor(trig_selection_loc, COL_ACC_0); } if (input_handler == handle_channel_selection) { - draw_channel_cursor(channel_selection_loc, COL_CURSOR); + draw_channel_cursor(channel_selection_loc, COL_ACC_0); } else { - draw_channel_cursor(channel_selection_loc, COL_GREY); + draw_channel_cursor(channel_selection_loc, COL_OFF); } if (input_handler == handle_pattern_selection) { - draw_pattern_cursor(pattern_selection_loc, COL_CURSOR); + draw_pattern_cursor(pattern_selection_loc, COL_ACC_0); } else { - draw_pattern_cursor(pattern_selection_loc, COL_GREY); + draw_pattern_cursor(pattern_selection_loc, COL_OFF); } if (input_handler == handle_right_col_selection) { - draw_right_col_cursor(right_col_selection_loc, COL_CURSOR); + draw_right_col_cursor(right_col_selection_loc, COL_ACC_0); } if (input_handler == handle_param_selection_sq1 || input_handler == handle_param_selection_sq2 || input_handler == handle_param_selection_wave || input_handler == handle_param_selection_noise) { - draw_params_cursor(param_selection_loc, COL_CURSOR); - draw_trig_cursor(trig_selection_loc, COL_GREY); + draw_params_cursor(param_selection_loc, COL_ACC_0); + draw_trig_cursor(trig_selection_loc, COL_OFF); } if (input_handler == handle_param_selection_ch1 || input_handler == handle_param_selection_ch2 || input_handler == handle_param_selection_ch3 || input_handler == handle_param_selection_ch4) { - draw_params_cursor(param_selection_loc, COL_CURSOR); + draw_params_cursor(param_selection_loc, COL_ACC_0); } } @@ -1124,17 +1124,17 @@ draw_piano_notes(void) { switch (channel_selection_loc) { case 0: { if (pat->ch1.active && pat->ch1.notes[step].active) { - draw_note(pat->ch1.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch1.notes[step].note, COL_OFF); } } break; case 1: { if (pat->ch2.active && pat->ch2.notes[step].active) { - draw_note(pat->ch2.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch2.notes[step].note, COL_OFF); } } break; case 2: { if (pat->ch3.active && pat->ch3.notes[step].active) { - draw_note(pat->ch3.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch3.notes[step].note, COL_OFF); } } break; } @@ -1146,20 +1146,20 @@ draw_piano_notes(void) { input_handler == handle_param_selection_noise) { // Show currently selected trigger note. TriggerNote *trig = get_current_trig(); - draw_note(trig->note, COL_NOTE_PRESSED); + draw_note(trig->note, COL_OFF); } else { // Show last/current played notes in all channels. if (play_status == 1) { Pattern *pat = &patterns[current_pattern]; u8 step = (step_counter - 1) % 16; if (pat->ch3.active && pat->ch3.notes[step].active) { - draw_note(pat->ch3.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch3.notes[step].note, COL_OFF); } if (pat->ch2.active && pat->ch2.notes[step].active) { - draw_note(pat->ch2.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch2.notes[step].note, COL_OFF); } if (pat->ch1.active && pat->ch1.notes[step].active) { - draw_note(pat->ch1.notes[step].note, COL_NOTE_PRESSED); + draw_note(pat->ch1.notes[step].note, COL_OFF); } } } -- cgit v1.2.1