diff options
author | Bad Diode <bd@badd10de.dev> | 2023-05-29 16:44:50 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-05-29 16:44:50 +0200 |
commit | 3b5ee67114bf789c93db23b7a3611302dce7142e (patch) | |
tree | 32b5bbd2879b5ffeecd7df6e20c836f80f555c72 | |
parent | ac17920096b18caa4cadec3fea347f9fc804baea (diff) | |
download | stepper-3b5ee67114bf789c93db23b7a3611302dce7142e.tar.gz stepper-3b5ee67114bf789c93db23b7a3611302dce7142e.zip |
Add initial theming support
-rw-r--r-- | src/drawing.c | 108 | ||||
-rw-r--r-- | src/globals.c | 18 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/renderer_m0.c | 52 | ||||
-rw-r--r-- | src/sequencer.c | 1 | ||||
-rw-r--r-- | src/settings.c | 22 | ||||
-rw-r--r-- | src/settings.h | 7 |
7 files changed, 133 insertions, 79 deletions
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) { | |||
23 | case 2: { active = patterns[pattern_selection_loc].ch3.active; } break; | 23 | case 2: { active = patterns[pattern_selection_loc].ch3.active; } break; |
24 | case 3: { active = patterns[pattern_selection_loc].ch4.active; } break; | 24 | case 3: { active = patterns[pattern_selection_loc].ch4.active; } break; |
25 | } | 25 | } |
26 | u8 clr = active ? colors[i] : COL_GREY; | 26 | u8 clr = active ? colors[i] : COL_OFF; |
27 | size_t y = CHAN_START_Y + i * CHAN_OFFSET_Y; | 27 | size_t y = CHAN_START_Y + i * CHAN_OFFSET_Y; |
28 | draw_channel_sprite(CHAN_START_X, y, clr, i); | 28 | draw_channel_sprite(CHAN_START_X, y, clr, i); |
29 | } | 29 | } |
@@ -150,7 +150,7 @@ draw_bank_buttons() { | |||
150 | 'A', 'B', 'C', 'D', | 150 | 'A', 'B', 'C', 'D', |
151 | }; | 151 | }; |
152 | for (int i = 0; i < 4; i++) { | 152 | for (int i = 0; i < 4; i++) { |
153 | int color = COL_GREY; | 153 | int color = COL_OFF; |
154 | if (i == current_bank) { | 154 | if (i == current_bank) { |
155 | color = COL_FG; | 155 | color = COL_FG; |
156 | } | 156 | } |
@@ -175,12 +175,12 @@ draw_pattern_buttons() { | |||
175 | 'E', 'F', 'G', 'H', | 175 | 'E', 'F', 'G', 'H', |
176 | }; | 176 | }; |
177 | for (int i = 0; i < 8; i++) { | 177 | for (int i = 0; i < 8; i++) { |
178 | int color = COL_GREY; | 178 | int color = COL_OFF; |
179 | if (i == current_pattern) { | 179 | if (i == current_pattern) { |
180 | color = COL_FG; | 180 | color = COL_FG; |
181 | } | 181 | } |
182 | if (i == next_pattern && current_pattern != next_pattern) { | 182 | if (i == next_pattern && current_pattern != next_pattern) { |
183 | color = COL_BLUE; | 183 | color = COL_ACC_0; |
184 | } | 184 | } |
185 | draw_rect(x, y, x + PAT_W, y + PAT_H, color); | 185 | draw_rect(x, y, x + PAT_W, y + PAT_H, color); |
186 | txt_drawc(pat_names[i], x + 4, y + 2, color); | 186 | txt_drawc(pat_names[i], x + 4, y + 2, color); |
@@ -203,18 +203,18 @@ draw_play() { | |||
203 | size_t x = PLAY_START_X; | 203 | size_t x = PLAY_START_X; |
204 | size_t y = PLAY_START_Y; | 204 | size_t y = PLAY_START_Y; |
205 | draw_filled_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_BG); | 205 | draw_filled_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_BG); |
206 | draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_CYAN); | 206 | draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_ACC_2); |
207 | if (play_status == 1) { | 207 | if (play_status == 1) { |
208 | // Pause button | 208 | // Pause button |
209 | draw_filled_rect(x + 10, y + 3, x + 11, y + 7, COL_CYAN); | 209 | draw_filled_rect(x + 10, y + 3, x + 11, y + 7, COL_ACC_2); |
210 | draw_filled_rect(x + 13, y + 3, x + 14, y + 7, COL_CYAN); | 210 | draw_filled_rect(x + 13, y + 3, x + 14, y + 7, COL_ACC_2); |
211 | } else { | 211 | } else { |
212 | // Play button | 212 | // Play button |
213 | x += 1; | 213 | x += 1; |
214 | draw_line(x + 10, y + 2, x + 10, y + 8, COL_CYAN); | 214 | draw_line(x + 10, y + 2, x + 10, y + 8, COL_ACC_2); |
215 | draw_line(x + 11, y + 3, x + 11, y + 7, COL_CYAN); | 215 | draw_line(x + 11, y + 3, x + 11, y + 7, COL_ACC_2); |
216 | draw_line(x + 12, y + 4, x + 12, y + 6, COL_CYAN); | 216 | draw_line(x + 12, y + 4, x + 12, y + 6, COL_ACC_2); |
217 | draw_line(x + 13, y + 5, x + 13, y + 5, COL_CYAN); | 217 | draw_line(x + 13, y + 5, x + 13, y + 5, COL_ACC_2); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
@@ -222,8 +222,8 @@ void | |||
222 | draw_stop() { | 222 | draw_stop() { |
223 | size_t x = STOP_START_X; | 223 | size_t x = STOP_START_X; |
224 | size_t y = STOP_START_Y; | 224 | size_t y = STOP_START_Y; |
225 | draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_RED); | 225 | draw_rect(x, y, x + R_COL_W, y + PLAY_STOP_H, COL_ACC_1); |
226 | draw_filled_rect(x + 10, y + 3, x + 14, y + 7, COL_RED); | 226 | draw_filled_rect(x + 10, y + 3, x + 14, y + 7, COL_ACC_1); |
227 | } | 227 | } |
228 | 228 | ||
229 | void | 229 | void |
@@ -528,7 +528,7 @@ void | |||
528 | draw_parameters_wave(ChannelWaveParams *params, bool global) { | 528 | draw_parameters_wave(ChannelWaveParams *params, bool global) { |
529 | u8 col_fg = COL_FG; | 529 | u8 col_fg = COL_FG; |
530 | if (global && input_handler == handle_channel_selection) { | 530 | if (global && input_handler == handle_channel_selection) { |
531 | col_fg = COL_GREY; | 531 | col_fg = COL_OFF; |
532 | } | 532 | } |
533 | 533 | ||
534 | // Draw current wave data. | 534 | // Draw current wave data. |
@@ -540,8 +540,8 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) { | |||
540 | size_t y = PARAMS_START_Y + 13; | 540 | size_t y = PARAMS_START_Y + 13; |
541 | 541 | ||
542 | // Wave Patterns. | 542 | // Wave Patterns. |
543 | draw_wave_pattern(wave_a, x, y, COL_WAVE_A); | 543 | draw_wave_pattern(wave_a, x, y, COL_ACC_1); |
544 | draw_wave_pattern(wave_b, x + 70, y, COL_WAVE_B); | 544 | draw_wave_pattern(wave_b, x + 70, y, COL_ACC_2); |
545 | 545 | ||
546 | // Wave text. | 546 | // Wave text. |
547 | x -= 2; | 547 | x -= 2; |
@@ -624,7 +624,7 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { | |||
624 | size_t x_offset = sweep ? 0 : 30; | 624 | size_t x_offset = sweep ? 0 : 30; |
625 | u8 col_fg = COL_FG; | 625 | u8 col_fg = COL_FG; |
626 | if (global && input_handler == handle_channel_selection) { | 626 | if (global && input_handler == handle_channel_selection) { |
627 | col_fg = COL_GREY; | 627 | col_fg = COL_OFF; |
628 | } | 628 | } |
629 | 629 | ||
630 | // Duty cycle. | 630 | // Duty cycle. |
@@ -673,18 +673,18 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { | |||
673 | x5 += 20; | 673 | x5 += 20; |
674 | } break; | 674 | } break; |
675 | } | 675 | } |
676 | draw_line(x0, y0, x1, y0, COL_RED); | 676 | draw_line(x0, y0, x1, y0, COL_ACC_1); |
677 | draw_line(x1, y1, x1, y0, COL_RED); | 677 | draw_line(x1, y1, x1, y0, COL_ACC_1); |
678 | draw_line(x1, y1, x2, y1, COL_RED); | 678 | draw_line(x1, y1, x2, y1, COL_ACC_1); |
679 | draw_line(x2, y1, x2, y0, COL_RED); | 679 | draw_line(x2, y1, x2, y0, COL_ACC_1); |
680 | draw_line(x2, y0, x3, y0, COL_RED); | 680 | draw_line(x2, y0, x3, y0, COL_ACC_1); |
681 | draw_line(x3, y1, x3, y0, COL_RED); | 681 | draw_line(x3, y1, x3, y0, COL_ACC_1); |
682 | draw_line(x3, y1, x4, y1, COL_RED); | 682 | draw_line(x3, y1, x4, y1, COL_ACC_1); |
683 | draw_line(x4, y1, x4, y0, COL_RED); | 683 | draw_line(x4, y1, x4, y0, COL_ACC_1); |
684 | draw_line(x4, y0, x5, y0, COL_RED); | 684 | draw_line(x4, y0, x5, y0, COL_ACC_1); |
685 | 685 | ||
686 | // Bounding box. | 686 | // Bounding box. |
687 | draw_rect(x, y - 3, x + 24, y + 18, COL_RED); | 687 | draw_rect(x, y - 3, x + 24, y + 18, COL_ACC_1); |
688 | } | 688 | } |
689 | 689 | ||
690 | // Param box. | 690 | // Param box. |
@@ -717,7 +717,7 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { | |||
717 | size_t y0 = PARAMS_START_Y + PARAMS_H - 47; | 717 | size_t y0 = PARAMS_START_Y + PARAMS_H - 47; |
718 | size_t x1 = x0 + 79; | 718 | size_t x1 = x0 + 79; |
719 | size_t y1 = y0 + 21; | 719 | size_t y1 = y0 + 21; |
720 | draw_rect(x0, y0, x1, y1, COL_CYAN); | 720 | draw_rect(x0, y0, x1, y1, COL_ACC_2); |
721 | } | 721 | } |
722 | 722 | ||
723 | size_t x = PARAMS_START_X + 42 + x_offset; | 723 | size_t x = PARAMS_START_X + 42 + x_offset; |
@@ -731,10 +731,10 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) { | |||
731 | 731 | ||
732 | // Env. | 732 | // Env. |
733 | if (params->env_time == 0) { | 733 | if (params->env_time == 0) { |
734 | draw_line(x1, y0, x2, y0, COL_CYAN); | 734 | draw_line(x1, y0, x2, y0, COL_ACC_2); |
735 | } else { | 735 | } else { |
736 | draw_line(x0, y0, x1, y1, COL_CYAN); | 736 | draw_line(x0, y0, x1, y1, COL_ACC_2); |
737 | draw_line(x1, y1, x2, y2, COL_CYAN); | 737 | draw_line(x1, y1, x2, y2, COL_ACC_2); |
738 | } | 738 | } |
739 | } | 739 | } |
740 | 740 | ||
@@ -894,7 +894,7 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { | |||
894 | size_t x_offset = 30; | 894 | size_t x_offset = 30; |
895 | u8 col_fg = COL_FG; | 895 | u8 col_fg = COL_FG; |
896 | if (global && input_handler == handle_channel_selection) { | 896 | if (global && input_handler == handle_channel_selection) { |
897 | col_fg = COL_GREY; | 897 | col_fg = COL_OFF; |
898 | } | 898 | } |
899 | 899 | ||
900 | // Bit mode. | 900 | // Bit mode. |
@@ -927,7 +927,7 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { | |||
927 | size_t y0 = PARAMS_START_Y + PARAMS_H - 47; | 927 | size_t y0 = PARAMS_START_Y + PARAMS_H - 47; |
928 | size_t x1 = x0 + 79; | 928 | size_t x1 = x0 + 79; |
929 | size_t y1 = y0 + 21; | 929 | size_t y1 = y0 + 21; |
930 | draw_rect(x0, y0, x1, y1, COL_CYAN); | 930 | draw_rect(x0, y0, x1, y1, COL_ACC_2); |
931 | } | 931 | } |
932 | 932 | ||
933 | size_t x = PARAMS_START_X + 42 + x_offset; | 933 | size_t x = PARAMS_START_X + 42 + x_offset; |
@@ -941,10 +941,10 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) { | |||
941 | 941 | ||
942 | // Env. | 942 | // Env. |
943 | if (params->env_time == 0) { | 943 | if (params->env_time == 0) { |
944 | draw_line(x1, y0, x2, y0, COL_CYAN); | 944 | draw_line(x1, y0, x2, y0, COL_ACC_2); |
945 | } else { | 945 | } else { |
946 | draw_line(x0, y0, x1, y1, COL_CYAN); | 946 | draw_line(x0, y0, x1, y1, COL_ACC_2); |
947 | draw_line(x1, y1, x2, y2, COL_CYAN); | 947 | draw_line(x1, y1, x2, y2, COL_ACC_2); |
948 | } | 948 | } |
949 | } | 949 | } |
950 | 950 | ||
@@ -1073,42 +1073,42 @@ clear_cursors(void) { | |||
1073 | draw_pattern_cursor(last_pattern_loc, COL_BG); | 1073 | draw_pattern_cursor(last_pattern_loc, COL_BG); |
1074 | draw_right_col_cursor(last_right_col_loc, COL_BG); | 1074 | draw_right_col_cursor(last_right_col_loc, COL_BG); |
1075 | for (size_t i = 0; i < 16; i++) { | 1075 | for (size_t i = 0; i < 16; i++) { |
1076 | draw_current_step(i, COL_GREY); | 1076 | draw_current_step(i, COL_OFF); |
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | void | 1080 | void |
1081 | draw_cursors(void) { | 1081 | draw_cursors(void) { |
1082 | clear_cursors(); | 1082 | clear_cursors(); |
1083 | draw_current_step(step_counter, COL_RED); | 1083 | draw_current_step(step_counter, COL_ACC_1); |
1084 | if (input_handler == handle_trigger_selection) { | 1084 | if (input_handler == handle_trigger_selection) { |
1085 | draw_trig_cursor(trig_selection_loc, COL_CURSOR); | 1085 | draw_trig_cursor(trig_selection_loc, COL_ACC_0); |
1086 | } | 1086 | } |
1087 | if (input_handler == handle_channel_selection) { | 1087 | if (input_handler == handle_channel_selection) { |
1088 | draw_channel_cursor(channel_selection_loc, COL_CURSOR); | 1088 | draw_channel_cursor(channel_selection_loc, COL_ACC_0); |
1089 | } else { | 1089 | } else { |
1090 | draw_channel_cursor(channel_selection_loc, COL_GREY); | 1090 | draw_channel_cursor(channel_selection_loc, COL_OFF); |
1091 | } | 1091 | } |
1092 | if (input_handler == handle_pattern_selection) { | 1092 | if (input_handler == handle_pattern_selection) { |
1093 | draw_pattern_cursor(pattern_selection_loc, COL_CURSOR); | 1093 | draw_pattern_cursor(pattern_selection_loc, COL_ACC_0); |
1094 | } else { | 1094 | } else { |
1095 | draw_pattern_cursor(pattern_selection_loc, COL_GREY); | 1095 | draw_pattern_cursor(pattern_selection_loc, COL_OFF); |
1096 | } | 1096 | } |
1097 | if (input_handler == handle_right_col_selection) { | 1097 | if (input_handler == handle_right_col_selection) { |
1098 | draw_right_col_cursor(right_col_selection_loc, COL_CURSOR); | 1098 | draw_right_col_cursor(right_col_selection_loc, COL_ACC_0); |
1099 | } | 1099 | } |
1100 | if (input_handler == handle_param_selection_sq1 || | 1100 | if (input_handler == handle_param_selection_sq1 || |
1101 | input_handler == handle_param_selection_sq2 || | 1101 | input_handler == handle_param_selection_sq2 || |
1102 | input_handler == handle_param_selection_wave || | 1102 | input_handler == handle_param_selection_wave || |
1103 | input_handler == handle_param_selection_noise) { | 1103 | input_handler == handle_param_selection_noise) { |
1104 | draw_params_cursor(param_selection_loc, COL_CURSOR); | 1104 | draw_params_cursor(param_selection_loc, COL_ACC_0); |
1105 | draw_trig_cursor(trig_selection_loc, COL_GREY); | 1105 | draw_trig_cursor(trig_selection_loc, COL_OFF); |
1106 | } | 1106 | } |
1107 | if (input_handler == handle_param_selection_ch1 || | 1107 | if (input_handler == handle_param_selection_ch1 || |
1108 | input_handler == handle_param_selection_ch2 || | 1108 | input_handler == handle_param_selection_ch2 || |
1109 | input_handler == handle_param_selection_ch3 || | 1109 | input_handler == handle_param_selection_ch3 || |
1110 | input_handler == handle_param_selection_ch4) { | 1110 | input_handler == handle_param_selection_ch4) { |
1111 | draw_params_cursor(param_selection_loc, COL_CURSOR); | 1111 | draw_params_cursor(param_selection_loc, COL_ACC_0); |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | 1114 | ||
@@ -1124,17 +1124,17 @@ draw_piano_notes(void) { | |||
1124 | switch (channel_selection_loc) { | 1124 | switch (channel_selection_loc) { |
1125 | case 0: { | 1125 | case 0: { |
1126 | if (pat->ch1.active && pat->ch1.notes[step].active) { | 1126 | if (pat->ch1.active && pat->ch1.notes[step].active) { |
1127 | draw_note(pat->ch1.notes[step].note, COL_NOTE_PRESSED); | 1127 | draw_note(pat->ch1.notes[step].note, COL_OFF); |
1128 | } | 1128 | } |
1129 | } break; | 1129 | } break; |
1130 | case 1: { | 1130 | case 1: { |
1131 | if (pat->ch2.active && pat->ch2.notes[step].active) { | 1131 | if (pat->ch2.active && pat->ch2.notes[step].active) { |
1132 | draw_note(pat->ch2.notes[step].note, COL_NOTE_PRESSED); | 1132 | draw_note(pat->ch2.notes[step].note, COL_OFF); |
1133 | } | 1133 | } |
1134 | } break; | 1134 | } break; |
1135 | case 2: { | 1135 | case 2: { |
1136 | if (pat->ch3.active && pat->ch3.notes[step].active) { | 1136 | if (pat->ch3.active && pat->ch3.notes[step].active) { |
1137 | draw_note(pat->ch3.notes[step].note, COL_NOTE_PRESSED); | 1137 | draw_note(pat->ch3.notes[step].note, COL_OFF); |
1138 | } | 1138 | } |
1139 | } break; | 1139 | } break; |
1140 | } | 1140 | } |
@@ -1146,20 +1146,20 @@ draw_piano_notes(void) { | |||
1146 | input_handler == handle_param_selection_noise) { | 1146 | input_handler == handle_param_selection_noise) { |
1147 | // Show currently selected trigger note. | 1147 | // Show currently selected trigger note. |
1148 | TriggerNote *trig = get_current_trig(); | 1148 | TriggerNote *trig = get_current_trig(); |
1149 | draw_note(trig->note, COL_NOTE_PRESSED); | 1149 | draw_note(trig->note, COL_OFF); |
1150 | } else { | 1150 | } else { |
1151 | // Show last/current played notes in all channels. | 1151 | // Show last/current played notes in all channels. |
1152 | if (play_status == 1) { | 1152 | if (play_status == 1) { |
1153 | Pattern *pat = &patterns[current_pattern]; | 1153 | Pattern *pat = &patterns[current_pattern]; |
1154 | u8 step = (step_counter - 1) % 16; | 1154 | u8 step = (step_counter - 1) % 16; |
1155 | if (pat->ch3.active && pat->ch3.notes[step].active) { | 1155 | if (pat->ch3.active && pat->ch3.notes[step].active) { |
1156 | draw_note(pat->ch3.notes[step].note, COL_NOTE_PRESSED); | 1156 | draw_note(pat->ch3.notes[step].note, COL_OFF); |
1157 | } | 1157 | } |
1158 | if (pat->ch2.active && pat->ch2.notes[step].active) { | 1158 | if (pat->ch2.active && pat->ch2.notes[step].active) { |
1159 | draw_note(pat->ch2.notes[step].note, COL_NOTE_PRESSED); | 1159 | draw_note(pat->ch2.notes[step].note, COL_OFF); |
1160 | } | 1160 | } |
1161 | if (pat->ch1.active && pat->ch1.notes[step].active) { | 1161 | if (pat->ch1.active && pat->ch1.notes[step].active) { |
1162 | draw_note(pat->ch1.notes[step].note, COL_NOTE_PRESSED); | 1162 | draw_note(pat->ch1.notes[step].note, COL_OFF); |
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | } | 1165 | } |
diff --git a/src/globals.c b/src/globals.c index 7396968..7ad5e5a 100644 --- a/src/globals.c +++ b/src/globals.c | |||
@@ -23,18 +23,12 @@ bool clear_screen = true; | |||
23 | // Color indexes. | 23 | // Color indexes. |
24 | // | 24 | // |
25 | 25 | ||
26 | #define COL_BG 0 | 26 | #define COL_BG 0 |
27 | #define COL_FG 1 | 27 | #define COL_FG 1 |
28 | #define COL_RED 2 | 28 | #define COL_ACC_0 2 |
29 | #define COL_BLUE 3 | 29 | #define COL_ACC_1 3 |
30 | #define COL_CYAN 4 | 30 | #define COL_ACC_2 4 |
31 | #define COL_GREY 5 | 31 | #define COL_OFF 5 |
32 | |||
33 | // Theme colors. | ||
34 | #define COL_CURSOR COL_BLUE | ||
35 | #define COL_NOTE_PRESSED COL_GREY | ||
36 | #define COL_WAVE_A COL_RED | ||
37 | #define COL_WAVE_B COL_CYAN | ||
38 | 32 | ||
39 | #define CHAN_W 19 | 33 | #define CHAN_W 19 |
40 | #define CHAN_H 8 | 34 | #define CHAN_H 8 |
@@ -12,10 +12,12 @@ WITH REGARD TO THIS SOFTWARE. | |||
12 | // TODO: A list of features I would like to get to implement in the near future. | 12 | // TODO: A list of features I would like to get to implement in the near future. |
13 | // | 13 | // |
14 | // UI tweaks. | 14 | // UI tweaks. |
15 | // + Theming support, with a number of pre-configured themes and custom colors. | ||
16 | // - Add more default themes | ||
17 | // - Add custom user themes | ||
15 | // - Notification support for feedback when doing some operations | 18 | // - Notification support for feedback when doing some operations |
16 | // (copying/pasting) | 19 | // (copying/pasting) |
17 | // - Animations for cursor movement/current step highlight. (A fade out maybe?) | 20 | // - Animations for cursor movement/current step highlight. (A fade out maybe?) |
18 | // - Theming support, with a number of pre-configured themes and custom colors. | ||
19 | // - Add panning support. We could send ch1-3 to the left and ch4 to the right | 21 | // - Add panning support. We could send ch1-3 to the left and ch4 to the right |
20 | // to act as metronome and achieve analog sync. | 22 | // to act as metronome and achieve analog sync. |
21 | // | 23 | // |
diff --git a/src/renderer_m0.c b/src/renderer_m0.c index eb19718..9373b73 100644 --- a/src/renderer_m0.c +++ b/src/renderer_m0.c | |||
@@ -782,6 +782,48 @@ txt_drawc_small(char c, size_t x, size_t y, u8 clr) { | |||
782 | // Initialization. | 782 | // Initialization. |
783 | // | 783 | // |
784 | 784 | ||
785 | Palette themes[] = { | ||
786 | { | ||
787 | COLOR_BLACK, // BG | ||
788 | COLOR_WHITE, // FG | ||
789 | COLOR_BLUE, // ACC_0 | ||
790 | COLOR_RED, // ACC_1 | ||
791 | COLOR_CYAN, // ACC_2 | ||
792 | COLOR_GREY, // COL_OFF | ||
793 | }, | ||
794 | { | ||
795 | RGB15(31, 31, 31), // BG | ||
796 | RGB15( 8, 8, 8), // FG | ||
797 | RGB15( 2, 17, 31), // ACC_0 | ||
798 | RGB15(31, 0, 10), // ACC_1 | ||
799 | RGB15( 0, 27, 30), // ACC_2 | ||
800 | RGB15(16, 17, 19), // COL_OFF | ||
801 | }, | ||
802 | { | ||
803 | RGB15( 0, 0, 31), // BG | ||
804 | RGB15(31, 31, 31), // FG | ||
805 | RGB15( 0, 31, 14), // ACC_0 | ||
806 | RGB15(24, 7, 19), // ACC_1 | ||
807 | RGB15(31, 17, 27), // ACC_2 | ||
808 | RGB15(22, 22, 31), // COL_OFF | ||
809 | }, | ||
810 | { | ||
811 | RGB15(11, 24, 31), // BG | ||
812 | RGB15(31, 31, 31), // FG | ||
813 | RGB15(8, 17, 22), // COL_OFF | ||
814 | RGB15(29, 17, 22), // ACC_1 | ||
815 | RGB15(29, 17, 22), // ACC_1 | ||
816 | RGB15(25, 27, 29), // COL_OFF | ||
817 | }, | ||
818 | }; | ||
819 | |||
820 | void | ||
821 | swap_palette(int idx) { | ||
822 | for (size_t i = 0; i < 16; i++) { | ||
823 | PAL_BUFFER_BG[i] = themes[idx][i]; | ||
824 | } | ||
825 | } | ||
826 | |||
785 | void | 827 | void |
786 | renderer_init(void) { | 828 | renderer_init(void) { |
787 | // Initialize display mode and bg palette. | 829 | // Initialize display mode and bg palette. |
@@ -815,15 +857,7 @@ renderer_init(void) { | |||
815 | BG_H_SCROLL_1 = -240; | 857 | BG_H_SCROLL_1 = -240; |
816 | 858 | ||
817 | // Initialize default palette. | 859 | // Initialize default palette. |
818 | PAL_BUFFER_BG[0] = COLOR_BLACK; | 860 | swap_palette(0); |
819 | PAL_BUFFER_BG[1] = COLOR_WHITE; | ||
820 | PAL_BUFFER_BG[2] = COLOR_RED; | ||
821 | PAL_BUFFER_BG[3] = COLOR_BLUE; | ||
822 | PAL_BUFFER_BG[4] = COLOR_CYAN; | ||
823 | PAL_BUFFER_BG[5] = COLOR_GREY; | ||
824 | PAL_BUFFER_BG[6] = COLOR_WHITE; | ||
825 | PAL_BUFFER_BG[7] = COLOR_GREEN; | ||
826 | PAL_BUFFER_BG[8] = COLOR_PURPLE; | ||
827 | 861 | ||
828 | // Initialize text engine. | 862 | // Initialize text engine. |
829 | txt_init(txt_drawc); | 863 | txt_init(txt_drawc); |
diff --git a/src/sequencer.c b/src/sequencer.c index 52e0e01..115d848 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -1014,6 +1014,7 @@ sequencer_init(void) { | |||
1014 | settings = metadata.settings; | 1014 | settings = metadata.settings; |
1015 | load_bank(metadata.current_bank); | 1015 | load_bank(metadata.current_bank); |
1016 | } | 1016 | } |
1017 | swap_palette(settings.theme); | ||
1017 | 1018 | ||
1018 | // Initialize input handler. | 1019 | // Initialize input handler. |
1019 | input_handler = handle_trigger_selection; | 1020 | input_handler = handle_trigger_selection; |
diff --git a/src/settings.c b/src/settings.c index fca5696..15d4bdf 100644 --- a/src/settings.c +++ b/src/settings.c | |||
@@ -8,9 +8,9 @@ void | |||
8 | draw_settings_cursor(void) { | 8 | draw_settings_cursor(void) { |
9 | int x = 6; | 9 | int x = 6; |
10 | int y = 17 + settings_cursor_loc * 12; | 10 | int y = 17 + settings_cursor_loc * 12; |
11 | draw_line(x + 1, y + 3, x + 1, y + 7, COL_CYAN); | 11 | draw_line(x + 1, y + 3, x + 1, y + 7, COL_ACC_0); |
12 | draw_line(x + 2, y + 4, x + 2, y + 6, COL_CYAN); | 12 | draw_line(x + 2, y + 4, x + 2, y + 6, COL_ACC_0); |
13 | draw_line(x + 3, y + 5, x + 3, y + 5, COL_CYAN); | 13 | draw_line(x + 3, y + 5, x + 3, y + 5, COL_ACC_0); |
14 | } | 14 | } |
15 | 15 | ||
16 | void | 16 | void |
@@ -40,6 +40,14 @@ handle_settings_input(void) { | |||
40 | settings.sync++; | 40 | settings.sync++; |
41 | } | 41 | } |
42 | } break; | 42 | } break; |
43 | case 1: { | ||
44 | if ((settings.theme + 1) >= THEME_NUM) { | ||
45 | settings.theme = 0; | ||
46 | } else { | ||
47 | settings.theme++; | ||
48 | } | ||
49 | swap_palette(settings.theme); | ||
50 | } break; | ||
43 | } | 51 | } |
44 | save_metadata(); | 52 | save_metadata(); |
45 | clear_screen = true; | 53 | clear_screen = true; |
@@ -53,6 +61,14 @@ handle_settings_input(void) { | |||
53 | settings.sync--; | 61 | settings.sync--; |
54 | } | 62 | } |
55 | } break; | 63 | } break; |
64 | case 1: { | ||
65 | if (settings.theme == 0) { | ||
66 | settings.theme = THEME_NUM - 1; | ||
67 | } else { | ||
68 | settings.theme--; | ||
69 | } | ||
70 | swap_palette(settings.theme); | ||
71 | } break; | ||
56 | } | 72 | } |
57 | save_metadata(); | 73 | save_metadata(); |
58 | clear_screen = true; | 74 | clear_screen = true; |
diff --git a/src/settings.h b/src/settings.h index 57b61a5..c742db9 100644 --- a/src/settings.h +++ b/src/settings.h | |||
@@ -20,10 +20,17 @@ char * sync_setting_str[] = { | |||
20 | 20 | ||
21 | typedef enum ThemeSetting { | 21 | typedef enum ThemeSetting { |
22 | THEME_DEFAULT = 0, | 22 | THEME_DEFAULT = 0, |
23 | THEME_INVERTED, | ||
24 | THEME_CLASSIC_BLUE, | ||
25 | THEME_HUMAN_RIGHTS, | ||
26 | THEME_NUM, | ||
23 | } ThemeSetting; | 27 | } ThemeSetting; |
24 | 28 | ||
25 | char * theme_setting_str[] = { | 29 | char * theme_setting_str[] = { |
26 | "DEFAULT", | 30 | "DEFAULT", |
31 | "INVERTED", | ||
32 | "CLASSIC BLUE", | ||
33 | "HUMAN RIGHTS", | ||
27 | }; | 34 | }; |
28 | 35 | ||
29 | typedef enum CursorSetting { | 36 | typedef enum CursorSetting { |