redraw as fast as possible

This commit is contained in:
Josh Holtrop 2018-01-15 21:11:01 -05:00
parent dca7d5a8b8
commit c2c36d4be4

View File

@ -120,16 +120,23 @@ int main(int argc, char *argv[])
display(window); display(window);
SDL_Event event; SDL_Event event;
while (SDL_WaitEvent(&event)) bool exit = false;
for (;;)
{ {
if (event.type == SDL_QUIT) while (SDL_PollEvent(&event))
break;
else if (event.type == SDL_KEYDOWN)
{ {
if (event.key.keysym.sym == SDLK_ESCAPE) if (event.type == SDL_QUIT)
break; exit = true;
if (event.key.keysym.sym == SDLK_RETURN) else if (event.type == SDL_KEYDOWN)
display(window); {
if (event.key.keysym.sym == SDLK_ESCAPE)
exit = true;
}
} }
if (exit)
break;
display(window);
} }
return 0;
} }