aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKikooDX <kikoodx@paranoici.org>2022-03-12 22:11:00 +0100
committerKikooDX <kikoodx@paranoici.org>2022-03-12 22:11:00 +0100
commitd04324372d4293c9044961eb04140fd5a5cde006 (patch)
tree8ecd9a2a837f30519f87fb4ee2687f6bda142cb2
parentaac891a977028cc4b0bd135933f52f63232ecdef (diff)
downloadlzy-d04324372d4293c9044961eb04140fd5a5cde006.tar.gz
improve pollevent
-rw-r--r--inc/lzy.h12
1 files 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;
}
}