Mercurial > repos > simple16
diff src/system_sdl.c @ 16:ae58e7c3c328
Poll events regularly to avoid unresponsive app warnings. Handle quit event
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 27 Mar 2016 21:42:10 -0700 |
parents | c8a0dbd7752c |
children | 41ec033ef8c3 |
line wrap: on
line diff
--- a/src/system_sdl.c Sun Mar 27 21:31:34 2016 -0700 +++ b/src/system_sdl.c Sun Mar 27 21:42:10 2016 -0700 @@ -1,5 +1,6 @@ #include <SDL.h> #include <stdint.h> +#include <stdlib.h> SDL_Window *window; @@ -49,3 +50,17 @@ SDL_RenderPresent(renderer); } +void system_poll_events() +{ + SDL_Event event; + while(SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: + exit(0); + break; + } + } +} +