Switch to SDL_WaitEvent
Now that no work is done outside the main loop we can switch to
SDL_WaitEvent instead of SDL_PollEvent. This blocks until an event
is available instead of returning immediately when there are no
events. This means the main loop will not always use 100% CPU.
@@ -305,7 +305,7 @@ int main(int argc, char *argv[]) {
while (running) {
SDL_Event event;
- while (SDL_PollEvent(&event)) {
+ while (SDL_WaitEvent(&event)) {
if (event.type == SDL_QUIT) {
running = false;
break;
