From c409f45ddd12bbd399dcda4a33043ce261da4dc4 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 24 Feb 2021 14:45:10 +0100 Subject: Codechange: [Video] make the prototype of PollEvent() the same for all drivers Additionally, call it from the draw-tick. --- src/video/sdl2_v.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/video/sdl2_v.cpp') diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 818389b80..724689725 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -370,11 +370,11 @@ static uint ConvertSdlKeycodeIntoMy(SDL_Keycode kc) return key; } -int VideoDriver_SDL_Base::PollEvent() +bool VideoDriver_SDL_Base::PollEvent() { SDL_Event ev; - if (!SDL_PollEvent(&ev)) return -2; + if (!SDL_PollEvent(&ev)) return false; switch (ev.type) { case SDL_MOUSEMOTION: @@ -516,7 +516,8 @@ int VideoDriver_SDL_Base::PollEvent() break; } } - return -1; + + return true; } static const char *InitializeSDL() @@ -629,7 +630,6 @@ void VideoDriver_SDL_Base::LoopOnce() { InteractiveRandom(); // randomness - while (PollEvent() == -1) {} if (_exit_game) { #ifdef __EMSCRIPTEN__ /* Emscripten is event-driven, and as such the main loop is inside -- cgit v1.2.3-54-g00ecf