2022-02-28 14:13:31 +01:00
|
|
|
#include "event.h"
|
2022-03-01 15:06:59 +01:00
|
|
|
|
2022-02-28 19:52:43 +01:00
|
|
|
#include <queue>
|
2022-02-28 14:13:31 +01:00
|
|
|
|
2022-02-28 19:52:43 +01:00
|
|
|
std::queue<EventInfo> EVENT_QUEUE = {};
|
|
|
|
|
|
|
|
void triggerEvent(Event event, uint32_t p1, uint32_t p2) {
|
|
|
|
EventInfo info = {};
|
|
|
|
info.event = event;
|
|
|
|
info.p1 = p1;
|
|
|
|
info.p2 = p2;
|
|
|
|
EVENT_QUEUE.push(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
void eventWasCalled(EventInfo& eventInfo, uint32_t& numEvents) {
|
|
|
|
numEvents = EVENT_QUEUE.size();
|
2022-03-01 15:06:59 +01:00
|
|
|
if (not EVENT_QUEUE.empty()) {
|
2022-02-28 19:52:43 +01:00
|
|
|
eventInfo = std::move(EVENT_QUEUE.back());
|
|
|
|
EVENT_QUEUE.pop();
|
|
|
|
}
|
|
|
|
}
|