Control Surface  1.1.1
MIDI Control Surface library for Arduino
SelectorDisplay.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Banks/Bank.hpp>
5 #include <Selectors/Selector.hpp>
6 
8 
13  public:
15  int16_t offset, int16_t multiplier, PixelLocation loc,
16  uint8_t size, uint16_t color)
18  multiplier(multiplier), x(loc.x), y(loc.y), size(size), color(color) {
19  }
20  void draw() override {
23  display.setCursor(x, y);
24  display.print(selector.get() * multiplier + offset);
25  }
26 
27  private:
29  int16_t offset, multiplier, x, y;
30  uint8_t size;
31  uint16_t color;
32 };
33 
37 class BankDisplay : public DisplayElement {
38  public:
40  PixelLocation loc, uint8_t size, uint16_t color)
42  y(loc.y), size(size), color(color) {}
43 
44  void draw() override {
47  display.setCursor(x, y);
48  display.print(bank.getOffset() + offset);
49  }
50 
51  private:
53  int16_t offset, x, y;
54  uint8_t size;
55  uint16_t color;
56 };
57 
OutputBank
A class for changing the address of BankableMIDIOutputs.
Definition: Bank.hpp:20
SelectorDisplay
A class for displaying the setting of a Selector object.
Definition: SelectorDisplay.hpp:12
BankDisplay::size
uint8_t size
Definition: SelectorDisplay.hpp:54
DisplayElement
An interface for elements that draw to a display.
Definition: DisplayElement.hpp:11
BankDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition: SelectorDisplay.hpp:44
DisplayInterface
An interface for displays.
Definition: DisplayInterface.hpp:14
SelectorBase::get
setting_t get() const
Get the current selection/setting.
Definition: Selector.hpp:47
SelectorBase
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition: Selector.hpp:40
SelectorDisplay::selector
SelectorBase & selector
Definition: SelectorDisplay.hpp:28
DisplayInterface::setCursor
virtual void setCursor(int16_t x, int16_t y)=0
Set the cursor position.
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:9
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition: Settings/NamespaceSettings.hpp:10
BankDisplay::y
int16_t y
Definition: SelectorDisplay.hpp:53
BankDisplay
A class for displaying the setting of a Bank object.
Definition: SelectorDisplay.hpp:37
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:60
SelectorDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition: SelectorDisplay.hpp:20
DisplayElement.hpp
Selector.hpp
SelectorDisplay::color
uint16_t color
Definition: SelectorDisplay.hpp:31
SelectorDisplay::y
int16_t y
Definition: SelectorDisplay.hpp:29
DisplayElement::display
DisplayInterface & display
Definition: DisplayElement.hpp:44
BankDisplay::x
int16_t x
Definition: SelectorDisplay.hpp:53
DisplayInterface::setTextColor
virtual void setTextColor(uint16_t color)=0
Set the text color.
BankDisplay::color
uint16_t color
Definition: SelectorDisplay.hpp:55
SelectorDisplay::size
uint8_t size
Definition: SelectorDisplay.hpp:30
OutputBank::getOffset
uint8_t getOffset() const
Get the offset (number of banks times the index of the selected bank)
Definition: Bank.hpp:61
Bank.hpp
BankDisplay::BankDisplay
BankDisplay(DisplayInterface &display, OutputBank &bank, int16_t offset, PixelLocation loc, uint8_t size, uint16_t color)
Definition: SelectorDisplay.hpp:39
BankDisplay::offset
int16_t offset
Definition: SelectorDisplay.hpp:53
SelectorDisplay::multiplier
int16_t multiplier
Definition: SelectorDisplay.hpp:29
BankDisplay::bank
OutputBank & bank
Definition: SelectorDisplay.hpp:52
SelectorDisplay::offset
int16_t offset
Definition: SelectorDisplay.hpp:29
SelectorDisplay::SelectorDisplay
SelectorDisplay(DisplayInterface &display, SelectorBase &selector, int16_t offset, int16_t multiplier, PixelLocation loc, uint8_t size, uint16_t color)
Definition: SelectorDisplay.hpp:14
SelectorDisplay::x
int16_t x
Definition: SelectorDisplay.hpp:29
DisplayInterface::setTextSize
virtual void setTextSize(uint8_t size)=0
Set the text size.