From f1e48fffe3c224ee81cdc1f85dbd0179b202d457 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 8 Sep 2017 19:38:59 +0300 Subject: Split SDL_WaitEventTimeout/SDL_PollEvent into lower level SDL function calls. --- src/utils/sdl2helper.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/utils/sdl2helper.cpp') diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 7648ccc2b..da5b15e41 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -30,6 +30,7 @@ PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") +#include #include PRAGMA48(GCC diagnostic pop) @@ -194,4 +195,14 @@ void SDL::WaitThread(SDL_Thread *const thread) SDL_WaitThread(thread, nullptr); } +bool SDL::PollEvent(SDL_Event *event) +{ + SDL_PumpEvents(); + return SDL_PeepEvents(event, + 1, + SDL_GETEVENT, + SDL_FIRSTEVENT, + SDL_LASTEVENT) > 0; +} + #endif // USE_SDL2 -- cgit v1.2.3-60-g2f50