diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-09-07 21:48:11 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-09-07 21:48:11 -0400 |
commit | 35fbb7daa975d643ba98a32c5466a9dc93864527 (patch) | |
tree | 6248722503eefeeeff4714a415a2f0b0bf12f16c /main.cpp | |
parent | c3e164c6845b9b32f132aa37cc9707acba0d9eff (diff) |
event order fixes
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -130,10 +130,10 @@ int main(int argc, char *argv[]) game::time::tick(); } - while (!eventQueue.empty()) { - game::events.emit<MainSDLEvent>(eventQueue.back()); - eventQueue.pop_back(); - } + auto clone = eventQueue; + eventQueue.clear(); + for (auto& e : clone) + game::events.emit<MainSDLEvent>(e); game::engine.update(game::time::getDeltaTime()); std::this_thread::sleep_for(1ms); @@ -160,10 +160,8 @@ int main(int argc, char *argv[]) Render::render(fps); SDL_Event e; - while (SDL_PollEvent(&e)) { - ui::handleGLEvent(e); + while (SDL_PollEvent(&e)) eventQueue.push_back(e); - } } // on game end, get back together |