3 #include <SDL_events.h>
4 #include <condition_variable>
17 std::vector<SDL_Event> events;
19 void reset() { events.clear(); }
24 std::mutex inputMutex;
25 std::condition_variable conditionVariable;
27 bool transferNotReceived =
false;
39 std::unique_lock<std::mutex> lock(inputsManager.inputMutex);
40 inputsManager.inputs.reset();
44 inputsManager.transferNotReceived =
true;
45 inputsManager.conditionVariable.notify_all();
50 inputsManager.inputs.mouseState = mouseState;
53 void PushEvent(SDL_Event event) { inputsManager.inputs.events.push_back(event); }
56 Inputs receiveAndProcessEvents()
58 std::unique_lock<std::mutex> lock(inputMutex);
59 conditionVariable.wait(lock, [
this]() {
return transferNotReceived; });
60 transferNotReceived =
false;