The OpenGL drawing function. This UI will draw a row of 12 keys, with on/off states according to pressed status. */
| 63 | This UI will draw a row of 12 keys, with on/off states according to pressed status. |
| 64 | */ |
| 65 | void onDisplay() override |
| 66 | { |
| 67 | const GraphicsContext& context(getGraphicsContext()); |
| 68 | |
| 69 | for (int key = 0; key < 12; ++key) |
| 70 | { |
| 71 | bool pressed = fKeyState[key]; |
| 72 | Rectangle<int> bounds = getKeyBounds(key); |
| 73 | |
| 74 | if (pressed) |
| 75 | Color(0.8f, 0.5f, 0.3f).setFor(context); |
| 76 | else |
| 77 | Color(0.3f, 0.5f, 0.8f).setFor(context); |
| 78 | |
| 79 | bounds.draw(context); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | Mouse press event. |