38 virtual void onBeginFrame() {}
39 virtual void onEndShowLeds() {}
40 virtual void onEndFrame() {}
41 virtual void onStripAdded(
CLEDController *strip, uint32_t num_leds) {
50 virtual void onPlatformPreLoop() {}
51 virtual void onPlatformPreLoop2() {}
55 static void addListener(
Listener *listener,
int priority = 0) {
56 #if FASTLED_HAS_ENGINE_EVENTS
57 EngineEvents::getInstance()->_addListener(listener, priority);
64 static void removeListener(Listener *listener) {
65 #if FASTLED_HAS_ENGINE_EVENTS
66 EngineEvents::getInstance()->_removeListener(listener);
72 static bool hasListener(Listener *listener) {
73 #if FASTLED_HAS_ENGINE_EVENTS
74 return EngineEvents::getInstance()->_hasListener(listener);
81 static void onBeginFrame() {
82 #if FASTLED_HAS_ENGINE_EVENTS
83 EngineEvents::getInstance()->_onBeginFrame();
87 static void onEndShowLeds() {
88 #if FASTLED_HAS_ENGINE_EVENTS
89 EngineEvents::getInstance()->_onEndShowLeds();
93 static void onEndFrame() {
94 #if FASTLED_HAS_ENGINE_EVENTS
95 EngineEvents::getInstance()->_onEndFrame();
99 static void onStripAdded(
CLEDController *strip, uint32_t num_leds) {
100 #if FASTLED_HAS_ENGINE_EVENTS
101 EngineEvents::getInstance()->_onStripAdded(strip, num_leds);
109 static void onCanvasUiSet(
CLEDController *strip,
const ScreenMap& xymap) {
110 #if FASTLED_HAS_ENGINE_EVENTS
111 EngineEvents::getInstance()->_onCanvasUiSet(strip, xymap);
118 static void onPlatformPreLoop() {
119 #if FASTLED_HAS_ENGINE_EVENTS
120 EngineEvents::getInstance()->_onPlatformPreLoop();
126 void _addListener(Listener *listener,
int priority);
128 void _removeListener(Listener *listener);
129 void _onBeginFrame();
130 void _onEndShowLeds();
133 void _onCanvasUiSet(
CLEDController *strip,
const ScreenMap& xymap);
134 void _onPlatformPreLoop();
135 bool _hasListener(Listener *listener);
136#if FASTLED_HAS_ENGINE_EVENTS
138 Listener *listener =
nullptr;
140 Pair(Listener *listener,
int priority) : listener(listener), priority(priority) {}
144 ListenerList mListeners;
147 static EngineEvents *getInstance();
149 EngineEvents() =
default;