Improve testgles2 exit behavior (useful on Android)
authorGabriel Jacobo <gabomdq@gmail.com>
Thu, 20 Feb 2014 16:12:11 -0300
changeset 8226778fd6b223a6
parent 8225 14846e56e099
child 8227 bd491250c87d
Improve testgles2 exit behavior (useful on Android)
test/testgles2.c
     1.1 --- a/test/testgles2.c	Wed Feb 19 11:03:03 2014 -0300
     1.2 +++ b/test/testgles2.c	Thu Feb 20 16:12:11 2014 -0300
     1.3 @@ -629,7 +629,7 @@
     1.4      while (!done) {
     1.5          /* Check for events */
     1.6          ++frames;
     1.7 -        while (SDL_PollEvent(&event)) {
     1.8 +        while (SDL_PollEvent(&event) && !done) {
     1.9              switch (event.type) {
    1.10              case SDL_WINDOWEVENT:
    1.11                  switch (event.window.event) {
    1.12 @@ -654,16 +654,18 @@
    1.13              }
    1.14              SDLTest_CommonEvent(state, &event, &done);
    1.15          }
    1.16 -        for (i = 0; i < state->num_windows; ++i) {
    1.17 -            status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
    1.18 -            if (status) {
    1.19 -                SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
    1.20 +        if (!done) {
    1.21 +          for (i = 0; i < state->num_windows; ++i) {
    1.22 +              status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
    1.23 +              if (status) {
    1.24 +                  SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
    1.25  
    1.26 -                /* Continue for next window */
    1.27 -                continue;
    1.28 -            }
    1.29 -            Render(state->window_w, state->window_h, &datas[i]);
    1.30 -            SDL_GL_SwapWindow(state->windows[i]);
    1.31 +                  /* Continue for next window */
    1.32 +                  continue;
    1.33 +              }
    1.34 +              Render(state->window_w, state->window_h, &datas[i]);
    1.35 +              SDL_GL_SwapWindow(state->windows[i]);
    1.36 +          }
    1.37          }
    1.38      }
    1.39