aboutsummaryrefslogtreecommitdiffstats
path: root/src/drawing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drawing.c')
-rw-r--r--src/drawing.c80
1 files changed, 49 insertions, 31 deletions
diff --git a/src/drawing.c b/src/drawing.c
index 653351d..8fef74f 100644
--- a/src/drawing.c
+++ b/src/drawing.c
@@ -667,6 +667,49 @@ clear_parameters(void) {
667 draw_filled_rect(x0, y0, x1, y1, COL_BG); 667 draw_filled_rect(x0, y0, x1, y1, COL_BG);
668} 668}
669 669
670void
671draw_prob(u8 prob, u8 clr) {
672 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 4 + 3;
673 size_t y = PARAMS_START_Y + 5;
674 switch (prob) {
675 case PROB_100: {
676 txt_drawf("100", x, y, clr);
677 txt_drawc('%', x + 18, y, clr);
678 } break;
679 case PROB_80: {
680 txt_drawf("80", x + 3, y, clr);
681 txt_drawc('%', x + 15, y, clr);
682 } break;
683 case PROB_60: {
684 txt_drawf("60", x + 3, y, clr);
685 txt_drawc('%', x + 15, y, clr);
686 } break;
687 case PROB_40: {
688 txt_drawf("40", x + 3, y, clr);
689 txt_drawc('%', x + 15, y, clr);
690 } break;
691 case PROB_20: {
692 txt_drawf("20", x + 3, y, clr);
693 txt_drawc('%', x + 15, y, clr);
694 } break;
695 case PROB_FIRST: { txt_drawf("1st", x + 3, y, clr); } break;
696 case PROB_NOT_FIRST: {
697 txt_drawf("1st", x + 3, y, clr);
698 draw_line(x + 3, y - 1, x + 21, y - 1, clr);
699 } break;
700 case PROB_ONE_TWO: { txt_drawf("1:2", x + 3, y, clr); } break;
701 case PROB_TWO_TWO: { txt_drawf("2:2", x + 3, y, clr); } break;
702 case PROB_ONE_THREE: { txt_drawf("1:3", x + 3, y, clr); } break;
703 case PROB_TWO_THREE: { txt_drawf("2:3", x + 3, y, clr); } break;
704 case PROB_THREE_THREE: { txt_drawf("3:3", x + 3, y, clr); } break;
705 case PROB_ONE_FOUR: { txt_drawf("1:4", x + 3, y, clr); } break;
706 case PROB_TWO_FOUR: { txt_drawf("2:4", x + 3, y, clr); } break;
707 case PROB_THREE_FOUR: { txt_drawf("3:4", x + 3, y, clr); } break;
708 case PROB_FOUR_FOUR: { txt_drawf("4:4", x + 3, y, clr); } break;
709 default: break;
710 }
711}
712
670IWRAM_CODE 713IWRAM_CODE
671void 714void
672draw_parameters_wave(ChannelWaveParams *params, bool global) { 715draw_parameters_wave(ChannelWaveParams *params, bool global) {
@@ -685,13 +728,8 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) {
685 draw_wave_pattern(waves[params->shape_b][params->phase_b], x + PARAMS_BOX_OFFSET_X * 2, y, COL_ACC_2); 728 draw_wave_pattern(waves[params->shape_b][params->phase_b], x + PARAMS_BOX_OFFSET_X * 2, y, COL_ACC_2);
686 } 729 }
687 730
688 // TODO: Trig probability 731 // Trig probability.
689 { 732 draw_prob(params->prob, col_fg);
690 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 4 + 3;
691 size_t y = PARAMS_START_Y + 5;
692 txt_drawf("100", x, y, col_fg);
693 txt_drawc('%', x + 18, y, col_fg);
694 }
695 733
696 // Mode selection. 734 // Mode selection.
697 { 735 {
@@ -814,11 +852,6 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) {
814 852
815 // Env. 853 // Env.
816 if (params->env_time == 0) { 854 if (params->env_time == 0) {
817 // TODO: Time 0 vol 0 (dir) doesn't make sense (mute)
818 // TODO: Time 0 vol 100 doesn't make sense (constant max volume)
819 // NOTE: Maybe it's just a matter of handling it better on the
820 // control? Have to check every time we change direction to swap
821 // the conditions.
822 draw_line(x0, y0, x2, y0, COL_ACC_2); 855 draw_line(x0, y0, x2, y0, COL_ACC_2);
823 } else { 856 } else {
824 draw_line(x0, y0, x1, y1, COL_ACC_2); 857 draw_line(x0, y0, x1, y1, COL_ACC_2);
@@ -826,13 +859,8 @@ draw_parameters_square(ChannelSquareParams *params, bool sweep, bool global) {
826 } 859 }
827 } 860 }
828 861
829 // TODO: Trig probability 862 // Trig probability.
830 { 863 draw_prob(params->prob, col_fg);
831 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 4 + 3;
832 size_t y = PARAMS_START_Y + 5;
833 txt_drawf("100", x, y, col_fg);
834 txt_drawc('%', x + 18, y, col_fg);
835 }
836 864
837 // Sweep. 865 // Sweep.
838 if (sweep) { 866 if (sweep) {
@@ -943,11 +971,6 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) {
943 971
944 // Env. 972 // Env.
945 if (params->env_time == 0) { 973 if (params->env_time == 0) {
946 // TODO: Time 0 vol 0 (dir) doesn't make sense (mute)
947 // TODO: Time 0 vol 100 doesn't make sense (constant max volume)
948 // NOTE: Maybe it's just a matter of handling it better on the
949 // control? Have to check every time we change direction to swap
950 // the conditions.
951 draw_line(x0, y0, x2, y0, COL_ACC_2); 974 draw_line(x0, y0, x2, y0, COL_ACC_2);
952 } else { 975 } else {
953 draw_line(x0, y0, x1, y1, COL_ACC_2); 976 draw_line(x0, y0, x1, y1, COL_ACC_2);
@@ -955,13 +978,8 @@ draw_parameters_noise(ChannelNoiseParams* params, bool global) {
955 } 978 }
956 } 979 }
957 980
958 // TODO: Trig probability 981 // Trig probability.
959 { 982 draw_prob(params->prob, col_fg);
960 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 4 + 3;
961 size_t y = PARAMS_START_Y + 5;
962 txt_drawf("100", x, y, col_fg);
963 txt_drawc('%', x + 18, y, col_fg);
964 }
965 983
966 // Labels. 984 // Labels.
967 { 985 {