diff --git a/src/animations/TestAnimation.cpp b/src/animations/TestAnimation.cpp index a3b9a00..64d3192 100644 --- a/src/animations/TestAnimation.cpp +++ b/src/animations/TestAnimation.cpp @@ -1,53 +1,32 @@ #include "./TestAnimation.h" +#include "../Static.h" #include -const char* -TestAnimation::name() const -{ - return "Test"; -} - -void -TestAnimation::handleEvent(const InputEvent& evt) -{ - if (evt.intent == InputEvent::Acceleration) { - if (evt.asInt() > 5) { - m_brightness += 15; - } - m_hue += scale8(evt.asInt(), 128); - } - - if (evt.intent == InputEvent::UserInput) { - switch(evt.asInt()) { - case 1: - m_brightness.set(255, 0);break; - case 2: - m_saturation.set(255, 128);break; - default: - m_brightness.set(255, 0); - m_saturation.set(255, 128); - } - } -} - void TestAnimation::loop() { - m_x += 4; - if (m_x % 12 == 0) { - m_y += 28; - } - m_hue.update(); - m_saturation.update(); - m_brightness.update(); + m_x += 1; + m_y += 1; } void TestAnimation::render(Display* dpy) const { - for(uint8_t col = 0; col < 3; col++) { - for (uint8_t i = 0; i < 254; i+=10) { - dpy->pixelAt(VirtualCoordinates{(uint8_t)(m_x + (col * (254 / 3))), (uint8_t)(i + m_y)}) = CHSV(m_hue, m_saturation + 100, scale8(i, m_brightness)); - } - } + for(unsigned int i = 0; i < dpy->pixelCount(); i++) { + dpy->pixelAt(i) = CRGB{255, 255, 255}; + } + return; + // Blank the canvas to white + Surface{dpy, {0, 0}, {255, 255}} = CRGB{255, 255, 255}; + // Draw red line on top row + Surface{dpy, {0, 0}, {255, 0}} = CRGB{255, 0, 0}; + // Green line on first column + Surface{dpy, {0, 0}, {0, 255}} = CRGB{0, 255, 0}; + + //Surface{dpy, {m_x, 0}, {m_x, 255}} = CRGB{255, 0, 0}; + ///Surface{dpy, {0, m_y}, {255, m_y}} = CRGB{255, 0, 0}; + //dpy->pixelAt(VirtualCoordinates{m_x, m_y}) = CRGB{255, 0, 255}; } + +STATIC_ALLOC(TestAnimation); +STATIC_TASK(TestAnimation); diff --git a/src/animations/TestAnimation.h b/src/animations/TestAnimation.h index d3f9473..1bc47eb 100644 --- a/src/animations/TestAnimation.h +++ b/src/animations/TestAnimation.h @@ -2,15 +2,11 @@ class TestAnimation: public Figment { public: - const char* name() const; - void handleEvent(const InputEvent& evt) override; + TestAnimation() : Figment("Test") {} void loop() override; void render(Display* dpy) const override; private: - AnimatedNumber m_hue; - AnimatedNumber m_saturation; - AnimatedNumber m_brightness; uint8_t m_x; uint8_t m_y; };