Fixed handling only one event per frame in testshape program.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 24 Jun 2017 23:45:19 +0200
changeset 111110841489fa4df
parent 11110 db5c09aa4fd4
child 11112 fb6e35c88b5a
Fixed handling only one event per frame in testshape program.
test/testshape.c
     1.1 --- a/test/testshape.c	Wed Jun 21 01:22:00 2017 -0400
     1.2 +++ b/test/testshape.c	Sat Jun 24 23:45:19 2017 +0200
     1.3 @@ -154,7 +154,7 @@
     1.4      SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
     1.5      SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
     1.6      while(should_exit == 0) {
     1.7 -        if (SDL_PollEvent(&event)) {
     1.8 +        while (SDL_PollEvent(&event)) {
     1.9              if(event.type == SDL_KEYDOWN) {
    1.10                  button_down = 1;
    1.11                  if(event.key.keysym.sym == SDLK_ESCAPE) {
    1.12 @@ -172,8 +172,10 @@
    1.13                  SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
    1.14                  SDL_SetWindowShape(window,pictures[current_picture].surface,&pictures[current_picture].mode);
    1.15              }
    1.16 -            if(event.type == SDL_QUIT)
    1.17 +            if (event.type == SDL_QUIT) {
    1.18                  should_exit = 1;
    1.19 +                break;
    1.20 +            }
    1.21          }
    1.22          render(renderer,pictures[current_picture].texture,texture_dimensions);
    1.23          SDL_Delay(10);