From d04324372d4293c9044961eb04140fd5a5cde006 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Sat, 12 Mar 2022 22:11:00 +0100 Subject: [PATCH] improve pollevent --- inc/lzy.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/inc/lzy.h b/inc/lzy.h index 44300a6..66995c7 100644 --- a/inc/lzy.h +++ b/inc/lzy.h @@ -403,7 +403,7 @@ int LZY_PollEvent(LZY_Event *e) { e->u.key.scancode = gk_e.key; return 1; default: - return -1; + break; } } } @@ -895,7 +895,7 @@ int LZY_SoundPlay(LZY_Sound *sound, int loops) { int LZY_PollEvent(LZY_Event *e) { SDL_Event sdl_e; - if (SDL_PollEvent(&sdl_e) != 0) { + while (SDL_PollEvent(&sdl_e) != 0) { switch (sdl_e.type) { case SDL_QUIT: e->type = LZY_QUIT; @@ -923,8 +923,7 @@ int LZY_PollEvent(LZY_Event *e) { !fullscreen); } } - return -1; - } + } break; case SDL_KEYUP: { int i = LZYK_COUNT; while (i-- > 0) { @@ -935,10 +934,9 @@ int LZY_PollEvent(LZY_Event *e) { return 1; } } - return -1; - } + } break; default: - return -1; + break; } }