test/testwm2.c
changeset 10193 75cd0fc3fec2
parent 9998 f67cf37e9cd4
child 10737 3406a0f8b041
equal deleted inserted replaced
10192:3a5779b13f69 10193:75cd0fc3fec2
    48 }
    48 }
    49 
    49 
    50 void
    50 void
    51 loop()
    51 loop()
    52 {
    52 {
       
    53     int i;
    53     SDL_Event event;
    54     SDL_Event event;
    54         /* Check for events */
    55         /* Check for events */
    55         while (SDL_PollEvent(&event)) {
    56         while (SDL_PollEvent(&event)) {
    56             SDLTest_CommonEvent(state, &event, &done);
    57             SDLTest_CommonEvent(state, &event, &done);
    57 
    58 
    98                     cursor = SDL_CreateSystemCursor((SDL_SystemCursor)system_cursor);
    99                     cursor = SDL_CreateSystemCursor((SDL_SystemCursor)system_cursor);
    99                     SDL_SetCursor(cursor);
   100                     SDL_SetCursor(cursor);
   100                 }
   101                 }
   101             }
   102             }
   102         }
   103         }
       
   104 
       
   105         for (i = 0; i < state->num_windows; ++i) {
       
   106             SDL_Renderer *renderer = state->renderers[i];
       
   107             SDL_RenderClear(renderer);
       
   108             SDL_RenderPresent(renderer);
       
   109         }
   103 #ifdef __EMSCRIPTEN__
   110 #ifdef __EMSCRIPTEN__
   104     if (done) {
   111     if (done) {
   105         emscripten_cancel_main_loop();
   112         emscripten_cancel_main_loop();
   106     }
   113     }
   107 #endif
   114 #endif
   120     /* Initialize test framework */
   127     /* Initialize test framework */
   121     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   128     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
   122     if (!state) {
   129     if (!state) {
   123         return 1;
   130         return 1;
   124     }
   131     }
   125     state->skip_renderer = SDL_TRUE;
       
   126     for (i = 1; i < argc;) {
   132     for (i = 1; i < argc;) {
   127         int consumed;
   133         int consumed;
   128 
   134 
   129         consumed = SDLTest_CommonArg(state, i);
   135         consumed = SDLTest_CommonArg(state, i);
   130         if (consumed == 0) {
   136         if (consumed == 0) {
   138     }
   144     }
   139     if (!SDLTest_CommonInit(state)) {
   145     if (!SDLTest_CommonInit(state)) {
   140         quit(2);
   146         quit(2);
   141     }
   147     }
   142 
   148 
       
   149     for (i = 0; i < state->num_windows; ++i) {
       
   150         SDL_Renderer *renderer = state->renderers[i];
       
   151         SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
       
   152         SDL_RenderClear(renderer);
       
   153     }
       
   154  
   143     /* Main render loop */
   155     /* Main render loop */
   144     done = 0;
   156     done = 0;
   145 #ifdef __EMSCRIPTEN__
   157 #ifdef __EMSCRIPTEN__
   146     emscripten_set_main_loop(loop, 0, 1);
   158     emscripten_set_main_loop(loop, 0, 1);
   147 #else
   159 #else