animations: add missing inputblip
This commit is contained in:
parent
f4828b2361
commit
c351621d9d
33
src/animations/InputBlip.cpp
Normal file
33
src/animations/InputBlip.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "InputBlip.h"
|
||||
|
||||
InputBlip::InputBlip()
|
||||
: Figment("InputBlip")
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
InputBlip::handleEvent(const InputEvent& evt)
|
||||
{
|
||||
if (evt.intent != InputEvent::None) {
|
||||
m_time = qadd8(m_time, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InputBlip::loop()
|
||||
{
|
||||
if (m_time > 0) {
|
||||
m_time--;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InputBlip::render(Display* dpy) const
|
||||
{
|
||||
if (m_time > 0) {
|
||||
dpy->pixelAt(0) = CRGB(0, brighten8_video(ease8InOutApprox(m_time)), 0);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_ALLOC(InputBlip);
|
||||
STATIC_TASK(InputBlip);
|
13
src/animations/InputBlip.h
Normal file
13
src/animations/InputBlip.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "../Figments/Figments.h"
|
||||
#include "../Static.h"
|
||||
|
||||
class InputBlip: public Figment {
|
||||
public:
|
||||
InputBlip();
|
||||
void handleEvent(const InputEvent& evt) override;
|
||||
void loop() override;
|
||||
void render(Display* dpy) const override;
|
||||
private:
|
||||
uint8_t m_time = 0;
|
||||
};
|
Loading…
Reference in New Issue
Block a user