From 4959741a7eaac3b429912a1ccfd7ebe06d41ef0d Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 23 Apr 2023 20:45:37 +0200 Subject: Add back cursor drawing --- src/drawing.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src/drawing.c') diff --git a/src/drawing.c b/src/drawing.c index 0f6afb0..83ffb50 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -80,7 +80,7 @@ draw_trigger(size_t chan, size_t i) { size_t offset_y = i < 8 ? 0 : TRIG_OFFSET_Y; size_t x = TRIG_START_X + offset_x; size_t y = TRIG_START_Y + offset_y; - u32 *tile = ¬e_name_sprites[4 * trig.note]; + const u32 *tile = ¬e_name_sprites[4 * trig.note]; draw_icn(x, y, &tile[0], COL_FG, 1, 0); draw_icn(x + 8, y, &tile[2], COL_FG, 1, 0); } else { @@ -99,11 +99,11 @@ draw_trig_cursor(size_t i, u8 clr) { } void -draw_right_col_cursor(u8 clr) { +draw_right_col_cursor(int i, u8 clr) { size_t x0 = 0; size_t x1 = 0; size_t y = 0; - switch (right_col_selection_loc) { + switch (i) { case R_COL_BPM: { x0 = BPM_START_X; x1 = x0 + R_COL_W; @@ -593,7 +593,7 @@ draw_parameters_wave(void) { // Draw default wave buttons. { - u32 *tile = default_wave_buttons; + const u32 *tile = default_wave_buttons; size_t x = PARAMS_START_X; size_t y = PARAMS_START_Y + PARAMS_H - 12; for (size_t i = 0, k = 0; i < 4 * 2; i += 2, k++) { @@ -1246,6 +1246,36 @@ draw_parameters(void) { } void -draw_cursors(void) { +clear_cursors(void) { + draw_trig_cursor(last_trig_loc, COL_BG); + draw_channel_cursor(last_channel_loc, COL_BG); + draw_pattern_cursor(last_pattern_loc, COL_BG); + draw_right_col_cursor(last_right_col_loc, COL_BG); +} +void +draw_cursors(void) { + clear_cursors(); + if (input_handler == handle_trigger_selection) { + draw_trig_cursor(trig_selection_loc, COL_CURSOR); + } + if (input_handler == handle_channel_selection) { + draw_channel_cursor(channel_selection_loc, COL_CURSOR); + } else { + draw_channel_cursor(channel_selection_loc, COL_GREY); + } + if (input_handler == handle_pattern_selection) { + draw_pattern_cursor(pattern_selection_loc, COL_CURSOR); + } else { + draw_pattern_cursor(pattern_selection_loc, COL_GREY); + } + if (input_handler == handle_right_col_selection) { + draw_right_col_cursor(right_col_selection_loc, COL_CURSOR); + } + 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); + } } -- cgit v1.2.1