Fixed handling only one event per frame in testshape program.

This commit is contained in:
Philipp Wiesemann 2017-06-24 23:45:19 +02:00
parent d96419c93f
commit 705efc3532
1 changed files with 4 additions and 2 deletions

View File

@ -154,7 +154,7 @@ int main(int argc,char** argv)
SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h); SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode); SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
while(should_exit == 0) { while(should_exit == 0) {
if (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
if(event.type == SDL_KEYDOWN) { if(event.type == SDL_KEYDOWN) {
button_down = 1; button_down = 1;
if(event.key.keysym.sym == SDLK_ESCAPE) { if(event.key.keysym.sym == SDLK_ESCAPE) {
@ -172,8 +172,10 @@ int main(int argc,char** argv)
SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h); SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode); SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
} }
if(event.type == SDL_QUIT) if (event.type == SDL_QUIT) {
should_exit = 1; should_exit = 1;
break;
}
} }
render(renderer,pictures[current_picture].texture,texture_dimensions); render(renderer,pictures[current_picture].texture,texture_dimensions);
SDL_Delay(10); SDL_Delay(10);