renderbug-cpp/lib/Figments/Renderer.h

37 lines
993 B
C++

#include "./Figment.h"
#include "./Animation.h"
#include "./Input.h"
#include <vector>
class Display;
struct Renderer: public Task {
public:
Renderer(std::vector<Display*>&& displays, const std::vector<Figment*> &figments) : Task("Renderer"), m_figments(figments), m_displays(std::move(displays)) {}
void loop() override;
void onStart() override;
void handleEvent(const InputEvent& evt) override;
static const char* lastFigmentName();
const std::vector<Command>& commands() const override;
private:
const std::vector<Figment*> m_figments;
const std::vector<Display*> m_displays;
AnimatedNumber m_powerState = 255;
AnimatedNumber m_brightness = 255;
bool m_powerManaged = true;
uint16_t m_voltage = 5;
uint16_t m_milliamps = 500;
uint8_t powerScale(uint8_t target, uint32_t totalPower) const;
void doBrightness(Args& args, Print& print);
void doOn(Args& args, Print& print);
void doOff(Args& args, Print& print);
};