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);
SDL_Event event;
while (SDL_WaitEvent(&event))
bool exit = false;
for (;;)
{
if (event.type == SDL_QUIT)
break;
else if (event.type == SDL_KEYDOWN)
while (SDL_PollEvent(&event))
{
if (event.key.keysym.sym == SDLK_ESCAPE)
break;
if (event.key.keysym.sym == SDLK_RETURN)
display(window);
if (event.type == SDL_QUIT)
exit = true;
else if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_ESCAPE)
exit = true;
}
}
if (exit)
break;
display(window);
}
return 0;
}