Пример #1
0
void CWndTuner::DrawKey(int nKey, bool bEnabled) {
  const int arrFull[] = {0, -1, 1, -2, 2, 3, -4, 4, -5, 5, -6, 6};
  const char *notes[] = {"C",  "C#", "D",  "D#", "E",  "F",
                         "F#", "G",  "G#", "A",  "A#", "B"};
  CRect rc;
  int nFull = arrFull[nKey];
  if (nFull >= 0) {
    rc = CRect(nFull * 20, 45, nFull * 20 + 18, 80);
    rc.Offset(40, 100);
    BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(b0b0b0));

    if (bEnabled) {
      BIOS::LCD::Print(rc.CenterX() - 4 + 1, rc.bottom - 20 + 1, RGB565(800000),
                       RGBTRANS, notes[nKey]);
      BIOS::LCD::Print(rc.CenterX() - 4, rc.bottom - 20, RGB565(ffff00),
                       RGBTRANS, notes[nKey]);
    }

    int nCutLeft = 7, nCutRight = 4;
    if (nKey == 0 || arrFull[nKey - 1] >= 0) nCutLeft = 0;
    if (nKey == 11 || arrFull[nKey + 1] >= 0) nCutRight = 0;
    rc = CRect(nFull * 20 + nCutLeft, 0, nFull * 20 + 18 - nCutRight, 45);
    rc.Offset(40, 100);
    BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(b0b0b0));
  } else {
    int nHalf = -nFull - 1;
    CRect rc(nHalf * 20 + 9 + 4, 0, nHalf * 20 + 18 + 9 - 4, 40);
    rc.Offset(40, 100);
    BIOS::LCD::Bar(rc, bEnabled ? RGB565(ff0000) : RGB565(000000));
  }
}