Control Surface 2.1.2
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 {
22 display.setTextColor(color);
23 display.setTextSize(size);
24 display.setCursor(x, y);
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 {
51 display.setTextColor(color);
52 display.setTextSize(size);
53 display.setCursor(x, y);
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
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.
DisplayElement(DisplayInterface &display)
Create a new DisplayElement.
DisplayInterface & display
An interface for displays.
A class for changing the address of BankableMIDIOutputs.
Definition Bank.hpp:16
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition Selector.hpp:39
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