48 lines
746 B
C++
48 lines
746 B
C++
#include "application.h"
|
|
#include "./Input.h"
|
|
#include "./MainLoop.h"
|
|
|
|
NSFastLED::CRGB
|
|
Variant::asRGB() const
|
|
{
|
|
return NSFastLED::CRGB(m_value.asRGB[0], m_value.asRGB[1], m_value.asRGB[2]);
|
|
}
|
|
|
|
const char*
|
|
Variant::asString() const
|
|
{
|
|
return m_value.asString;
|
|
}
|
|
|
|
int
|
|
Variant::asInt() const
|
|
{
|
|
return m_value.asInt;
|
|
}
|
|
|
|
void
|
|
InputSource::loop()
|
|
{
|
|
MainLoop::instance()->dispatch(read());
|
|
}
|
|
|
|
InputEvent
|
|
BufferedInputSource::read()
|
|
{
|
|
InputEvent ret;
|
|
m_eventQueue.take(ret);
|
|
return ret;
|
|
}
|
|
|
|
void
|
|
BufferedInputSource::setEvent(InputEvent &&evt)
|
|
{
|
|
m_eventQueue.insert(std::move(evt));
|
|
}
|
|
|
|
void
|
|
BufferedInputSource::setEvent(InputEvent::Intent intent, Variant &&v)
|
|
{
|
|
m_eventQueue.insert(InputEvent{intent, std::move(v)});
|
|
}
|