diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/drawing.c | 260 |
1 files changed, 144 insertions, 116 deletions
diff --git a/src/drawing.c b/src/drawing.c index 78021c0..fcbdb95 100644 --- a/src/drawing.c +++ b/src/drawing.c | |||
@@ -464,135 +464,163 @@ draw_piano(void) { | |||
464 | 464 | ||
465 | void | 465 | void |
466 | draw_params_cursor_wave(size_t i, u8 clr) { | 466 | draw_params_cursor_wave(size_t i, u8 clr) { |
467 | u8 x_positions[] = { | 467 | // u8 x_positions[] = { |
468 | // 32 half bytes (Wave A). | 468 | // // 32 half bytes (Wave A). |
469 | 0, 4, 8, 12, 16, 20, 24, 28, | 469 | // 0, 4, 8, 12, 16, 20, 24, 28, |
470 | 34, 38, 42, 46, 50, 54, 58, 62, | 470 | // 34, 38, 42, 46, 50, 54, 58, 62, |
471 | 0, 4, 8, 12, 16, 20, 24, 28, | 471 | // 0, 4, 8, 12, 16, 20, 24, 28, |
472 | 34, 38, 42, 46, 50, 54, 58, 62, | 472 | // 34, 38, 42, 46, 50, 54, 58, 62, |
473 | // 32 half bytes (Wave B). | 473 | // // 32 half bytes (Wave B). |
474 | 70, 74, 78, 82, 86, 90, 94, 98, | 474 | // 70, 74, 78, 82, 86, 90, 94, 98, |
475 | 104, 108, 112, 116, 120, 124, 128, 132, | 475 | // 104, 108, 112, 116, 120, 124, 128, 132, |
476 | 70, 74, 78, 82, 86, 90, 94, 98, | 476 | // 70, 74, 78, 82, 86, 90, 94, 98, |
477 | 104, 108, 112, 116, 120, 124, 128, 132, | 477 | // 104, 108, 112, 116, 120, 124, 128, 132, |
478 | // Default wave A. | 478 | // // Default wave A. |
479 | 1, 18, 35, 52, | 479 | // 1, 18, 35, 52, |
480 | // Default wave B. | 480 | // // Default wave B. |
481 | 71, 88, 105, 122, | 481 | // 71, 88, 105, 122, |
482 | // Mode selection. | 482 | // // Mode selection. |
483 | 141, | 483 | // 141, |
484 | // Volume selection. | 484 | // // Volume selection. |
485 | 141, | 485 | // 141, |
486 | }; | 486 | // }; |
487 | u8 y_positions[] = { | 487 | // u8 y_positions[] = { |
488 | // 32 half bytes (Wave A) | 488 | // // 32 half bytes (Wave A) |
489 | 0, 0, 0, 0, 0, 0, 0, 0, | 489 | // 0, 0, 0, 0, 0, 0, 0, 0, |
490 | 0, 0, 0, 0, 0, 0, 0, 0, | 490 | // 0, 0, 0, 0, 0, 0, 0, 0, |
491 | 9, 9, 9, 9, 9, 9, 9, 9, | 491 | // 9, 9, 9, 9, 9, 9, 9, 9, |
492 | 9, 9, 9, 9, 9, 9, 9, 9, | 492 | // 9, 9, 9, 9, 9, 9, 9, 9, |
493 | // 32 half bytes (Wave B) | 493 | // // 32 half bytes (Wave B) |
494 | 0, 0, 0, 0, 0, 0, 0, 0, | 494 | // 0, 0, 0, 0, 0, 0, 0, 0, |
495 | 0, 0, 0, 0, 0, 0, 0, 0, | 495 | // 0, 0, 0, 0, 0, 0, 0, 0, |
496 | 9, 9, 9, 9, 9, 9, 9, 9, | 496 | // 9, 9, 9, 9, 9, 9, 9, 9, |
497 | 9, 9, 9, 9, 9, 9, 9, 9, | 497 | // 9, 9, 9, 9, 9, 9, 9, 9, |
498 | // Default wave A. | 498 | // // Default wave A. |
499 | 21, 21, 21, 21, | 499 | // 21, 21, 21, 21, |
500 | // Default wave B. | 500 | // // Default wave B. |
501 | 21, 21, 21, 21, | 501 | // 21, 21, 21, 21, |
502 | // Mode selection. | 502 | // // Mode selection. |
503 | 21, | 503 | // 21, |
504 | // Volume selection. | 504 | // // Volume selection. |
505 | 1, | 505 | // 1, |
506 | }; | 506 | // }; |
507 | size_t cursor_length = 0; | 507 | // size_t cursor_length = 0; |
508 | if (i < 64) { | 508 | // if (i < 64) { |
509 | cursor_length = 4; | 509 | // cursor_length = 4; |
510 | } else if (i < 72) { | 510 | // } else if (i < 72) { |
511 | cursor_length = 13; | 511 | // cursor_length = 13; |
512 | } else { | 512 | // } else { |
513 | cursor_length = 30; | 513 | // cursor_length = 30; |
514 | } | 514 | // } |
515 | size_t x = PARAMS_START_X + x_positions[i] - 1; | 515 | // size_t x = PARAMS_START_X + x_positions[i] - 1; |
516 | size_t y = PARAMS_START_Y + PARAMS_H - 25 + y_positions[i]; | 516 | // size_t y = PARAMS_START_Y + PARAMS_H - 25 + y_positions[i]; |
517 | switch (settings.cursor) { | 517 | // switch (settings.cursor) { |
518 | case CURSOR_THICK_LINE: { | 518 | // case CURSOR_THICK_LINE: { |
519 | draw_line(x, y, x + cursor_length, y, clr); | 519 | // draw_line(x, y, x + cursor_length, y, clr); |
520 | draw_line(x, y + 1, x + cursor_length, y + 1, clr); | 520 | // draw_line(x, y + 1, x + cursor_length, y + 1, clr); |
521 | } break; | 521 | // } break; |
522 | default: { | 522 | // default: { |
523 | draw_line(x, y, x + cursor_length, y, clr); | 523 | // draw_line(x, y, x + cursor_length, y, clr); |
524 | } break; | 524 | // } break; |
525 | } | 525 | // } |
526 | } | 526 | } |
527 | 527 | ||
528 | void | 528 | void |
529 | draw_params_cursor_noise(size_t i, u8 clr) { | 529 | draw_params_cursor_noise(size_t i, u8 clr) { |
530 | u8 x_positions[] = { | 530 | // u8 x_positions[] = { |
531 | 0, // Bit mode. | 531 | // 0, // Bit mode. |
532 | 31, // Env. Vol. | 532 | // 31, // Env. Vol. |
533 | 59, // Env. Direction. | 533 | // 59, // Env. Direction. |
534 | 87, // Env. Time. | 534 | // 87, // Env. Time. |
535 | }; | 535 | // }; |
536 | u8 y_positions[] = { | 536 | // u8 y_positions[] = { |
537 | 20, // Bit mode. | 537 | // 20, // Bit mode. |
538 | 20, // Env. Vol. | 538 | // 20, // Env. Vol. |
539 | 20, // Env. Direction. | 539 | // 20, // Env. Direction. |
540 | 20, // Env. Time. | 540 | // 20, // Env. Time. |
541 | }; | 541 | // }; |
542 | size_t cursor_length = 24; | 542 | // size_t cursor_length = 24; |
543 | size_t x = PARAMS_START_X + x_positions[i] + 30; | 543 | // size_t x = PARAMS_START_X + x_positions[i] + 30; |
544 | size_t y = PARAMS_START_Y + PARAMS_H - 24 + y_positions[i]; | 544 | // size_t y = PARAMS_START_Y + PARAMS_H - 24 + y_positions[i]; |
545 | switch (settings.cursor) { | 545 | // switch (settings.cursor) { |
546 | case CURSOR_THICK_LINE: { | 546 | // case CURSOR_THICK_LINE: { |
547 | draw_line(x, y, x + cursor_length, y, clr); | 547 | // draw_line(x, y, x + cursor_length, y, clr); |
548 | draw_line(x, y + 1, x + cursor_length, y + 1, clr); | 548 | // draw_line(x, y + 1, x + cursor_length, y + 1, clr); |
549 | } break; | 549 | // } break; |
550 | default: { | 550 | // default: { |
551 | draw_line(x, y, x + cursor_length, y, clr); | 551 | // draw_line(x, y, x + cursor_length, y, clr); |
552 | } break; | 552 | // } break; |
553 | } | 553 | // } |
554 | } | 554 | } |
555 | 555 | ||
556 | void | 556 | void |
557 | draw_params_cursor_square(size_t i, u8 clr, bool sweep) { | 557 | draw_params_cursor_square(size_t i, u8 clr) { |
558 | size_t x_offset = sweep ? 0 : 30; | 558 | size_t x = PARAMS_START_X + (i % 5) * PARAMS_BOX_OFFSET_X; |
559 | u8 x_positions[] = { | 559 | size_t y = PARAMS_START_Y + PARAMS_BOX_H; |
560 | 0, // Duty. | 560 | if (i >= 5) { |
561 | 31, // Env. Vol. | 561 | y += PARAMS_BOX_OFFSET_Y; |
562 | 59, // Env. Direction. | 562 | } |
563 | 87, // Env. Time. | 563 | u8 x0 = x; |
564 | 118, // Sweep Number. | 564 | u8 x1 = x + PARAMS_BOX_W; |
565 | 146, // Sweep Time. | 565 | u8 y0 = y - 6; |
566 | 132, // Sweep Direction. | 566 | u8 y1 = y; |
567 | }; | 567 | draw_filled_rect(x0 + 1, y0, x1 - 1, y1, clr); |
568 | u8 y_positions[] = { | 568 | draw_line(x0, y0 + 1, x0, y1 - 1, clr); |
569 | 20, // Duty. | 569 | draw_line(x1, y0 + 1, x1, y1 - 1, clr); |
570 | 20, // Env. Vol. | 570 | { |
571 | 20, // Env. Direction. | 571 | size_t x = PARAMS_START_X; |
572 | 20, // Env. Time. | 572 | size_t y = PARAMS_START_Y; |
573 | 20, // Sweep Number. | 573 | switch (i) { |
574 | 20, // Sweep Time. | 574 | case 0: { |
575 | 0, // Sweep Direction. | 575 | x += 4 + PARAMS_BOX_OFFSET_X * 0; |
576 | }; | 576 | y += PARAMS_BOX_H - 7; |
577 | size_t cursor_length = 24; | 577 | txt_drawf_small("shape", x, y, COL_BG); |
578 | size_t x = PARAMS_START_X + x_positions[i] + x_offset; | 578 | } break; |
579 | size_t y = PARAMS_START_Y + PARAMS_H - 24 + y_positions[i]; | 579 | case 1: { |
580 | switch (settings.cursor) { | 580 | x += 8 + PARAMS_BOX_OFFSET_X * 1; |
581 | case CURSOR_THICK_LINE: { | 581 | y += PARAMS_BOX_H - 7; |
582 | draw_line(x, y, x + cursor_length, y, clr); | 582 | txt_drawf_small("vol", x, y, COL_BG); |
583 | draw_line(x, y + 1, x + cursor_length, y + 1, clr); | 583 | } break; |
584 | } break; | 584 | case 2: { |
585 | default: { | 585 | x += 6 + PARAMS_BOX_OFFSET_X * 2; |
586 | draw_line(x, y, x + cursor_length, y, clr); | 586 | y += PARAMS_BOX_H - 7; |
587 | } break; | 587 | txt_drawf_small("time", x, y, COL_BG); |
588 | } break; | ||
589 | case 3: { | ||
590 | x += 8 + PARAMS_BOX_OFFSET_X * 3; | ||
591 | y += PARAMS_BOX_H - 7; | ||
592 | txt_drawf_small("dir", x, y, COL_BG); | ||
593 | } break; | ||
594 | case 4: { | ||
595 | x += 6 + PARAMS_BOX_OFFSET_X * 4; | ||
596 | y += PARAMS_BOX_H - 7; | ||
597 | txt_drawf_small("prob", x, y, COL_BG); | ||
598 | } break; | ||
599 | case 5: { | ||
600 | x += 4 + PARAMS_BOX_OFFSET_X * 0; | ||
601 | y += PARAMS_BOX_H - 7 + PARAMS_BOX_OFFSET_Y; | ||
602 | txt_drawf_small("sweep", x, y, COL_BG); | ||
603 | } break; | ||
604 | case 6: { | ||
605 | x += 6 + PARAMS_BOX_OFFSET_X * 1; | ||
606 | y += PARAMS_BOX_H - 7 + PARAMS_BOX_OFFSET_Y; | ||
607 | txt_drawf_small("time", x, y, COL_BG); | ||
608 | } break; | ||
609 | case 7: { | ||
610 | x += 8 + PARAMS_BOX_OFFSET_X * 2; | ||
611 | y += PARAMS_BOX_H - 7 + PARAMS_BOX_OFFSET_Y; | ||
612 | txt_drawf_small("dir", x, y, COL_BG); | ||
613 | } break; | ||
614 | default: break; | ||
615 | } | ||
588 | } | 616 | } |
589 | } | 617 | } |
590 | 618 | ||
591 | void | 619 | void |
592 | draw_params_cursor(size_t i, u8 clr) { | 620 | draw_params_cursor(size_t i, u8 clr) { |
593 | switch (channel_selection_loc) { | 621 | switch (channel_selection_loc) { |
594 | case 0: { draw_params_cursor_square(i, clr, true); } break; | 622 | case 0: { draw_params_cursor_square(i, clr); } break; |
595 | case 1: { draw_params_cursor_square(i, clr, false); } break; | 623 | case 1: { draw_params_cursor_square(i, clr); } break; |
596 | case 2: { draw_params_cursor_wave(i, clr); } break; | 624 | case 2: { draw_params_cursor_wave(i, clr); } break; |
597 | case 3: { draw_params_cursor_noise(i, clr); } break; | 625 | case 3: { draw_params_cursor_noise(i, clr); } break; |
598 | } | 626 | } |