From 3b7d413390179419a6a472f4e2aa9356edbb8b52 Mon Sep 17 00:00:00 2001 From: ktyl Date: Sun, 8 Aug 2021 15:29:13 +0100 Subject: [PATCH] q to quit --- src/input.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/input.c b/src/input.c index b0ac944..6fcea3d 100644 --- a/src/input.c +++ b/src/input.c @@ -2,9 +2,27 @@ int checkQuit() { + int quit = 0; SDL_Event event; - if (SDL_PollEvent(&event) && event.type == SDL_QUIT) return 1; + if (SDL_PollEvent(&event)) + { + switch(event.type) + { + case SDL_QUIT: + quit = 1; + break; - return 0; + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_q) + { + quit = 1; + } + + default: + break; + } + } + + return quit; }