Mercurial > hg > touchkeys
diff Source/Display/KeyboardDisplay.h @ 27:eef567a60146
Changed how OpenGL updates are handled so the canvas is only re-rendered when something changes. This should reduce CPU usage in certain circumstances.
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sun, 02 Mar 2014 19:25:50 +0000 |
parents | 73d2ec21de9a |
children | 73576f49ad1c |
line wrap: on
line diff
--- a/Source/Display/KeyboardDisplay.h Sat Feb 22 21:59:05 2014 +0000 +++ b/Source/Display/KeyboardDisplay.h Sun Mar 02 19:25:50 2014 +0000 @@ -95,6 +95,10 @@ public: KeyboardDisplay(); virtual ~KeyboardDisplay() {} + + // Set canvas for triggering rendering; + void setCanvas(OpenGLJuceCanvas *canvas) { canvas_ = canvas; } + void tellCanvasToRepaint(); // Setup methods for display size and keyboard range void setKeyboardRange(int lowest, int highest); @@ -102,7 +106,6 @@ virtual void setDisplaySize(float width, float height); // Drawing methods - virtual bool needsRender() { return needsUpdate_; } virtual void render(); // Interaction methods @@ -159,11 +162,11 @@ int keyForLocation(Point& internalPoint); protected: - + OpenGLJuceCanvas *canvas_; // Reference to object which handles rendering + int lowestMidiNote_, highestMidiNote_; // Which keys should be displayed (use MIDI note numbers) float totalDisplayWidth_, totalDisplayHeight_; // Size of the internal view (centered around origin) float displayPixelWidth_, displayPixelHeight_; // Pixel resolution of the surrounding window - bool needsUpdate_; // Whether the keyboard should be redrawn int currentHighlightedKey_; // What key is being clicked on at the moment bool touchSensingEnabled_; // Whether touch-sensitive keys are being used bool touchSensingPresentOnKey_[128]; // Whether the key with this MIDI note has a touch sensor