Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
SelectorDisplay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Banks/Bank.hpp>
6
8
14 public:
21 void draw() override {
25 setting_t selection = selector.get();
26 display.print(selection * multiplier + offset);
27 previous = selection;
28 }
29
30 bool getDirty() const override { return previous != selector.get(); }
31
32 private:
35 int16_t offset, multiplier, x, y;
36 uint8_t size;
37 uint16_t color;
38};
39
44 public:
46 PixelLocation loc, uint8_t size, uint16_t color)
48 y(loc.y), size(size), color(color) {}
49
50 void draw() override {
54 uint8_t bankoffset = bank.getOffset();
55 display.print(bankoffset + offset);
56 previous = bankoffset;
57 }
58
59 bool getDirty() const override { return previous != bank.getOffset(); }
60
61 private:
63 uint8_t previous = 0xFF;
64 int16_t offset, x, y;
65 uint8_t size;
66 uint16_t color;
67};
68
constexpr setting_t NoSetting
A special setting that indicates an unused or invalid setting.
Definition Def.hpp:55
uint8_t setting_t
The type used for Selectors.
Definition Def.hpp:53
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class for displaying the setting of a Bank object.
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
OutputBank & bank
BankDisplay(DisplayInterface &display, OutputBank &bank, int16_t offset, PixelLocation loc, uint8_t size, uint16_t color)
void draw() override
Draw this DisplayElement to the display buffer.
An interface for elements that draw to a display.
DisplayInterface & display
An interface for displays.
virtual void setTextColor(uint16_t color)=0
Set the text color.
virtual void setCursor(int16_t x, int16_t y)=0
Set the cursor position.
virtual void setTextSize(uint8_t size)=0
Set the text size.
A class for changing the address of BankableMIDIOutputs.
Definition Bank.hpp:16
int8_t getOffset() const
Get the address offset (number of banks times the index of the selected bank after applying the offse...
Definition Bank.hpp:58
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition Selector.hpp:39
setting_t get() const
Get the current selection/setting.
Definition Selector.hpp:46
A class for displaying the setting of a Selector object.
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
SelectorDisplay(DisplayInterface &display, SelectorBase &selector, int16_t offset, int16_t multiplier, PixelLocation loc, uint8_t size, uint16_t color)
SelectorBase & selector
void draw() override
Draw this DisplayElement to the display buffer.
A simple struct representing a pixel with integer coordinates.
Definition Def.hpp:64