| 244 | } |
| 245 | |
| 246 | void |
| 247 | loop() |
| 248 | { |
| 249 | Uint32 now; |
| 250 | int i; |
| 251 | SDL_Event event; |
| 252 | |
| 253 | /* Check for events */ |
| 254 | while (SDL_PollEvent(&event)) { |
| 255 | SDLTest_CommonEvent(state, &event, &done); |
| 256 | } |
| 257 | for (i = 0; i < state->num_windows; ++i) { |
| 258 | if (state->windows[i] == NULL) |
| 259 | continue; |
| 260 | MoveSprites(state->renderers[i], sprites[i]); |
| 261 | } |
| 262 | #ifdef __EMSCRIPTEN__ |
| 263 | if (done) { |
| 264 | emscripten_cancel_main_loop(); |
| 265 | } |
| 266 | #endif |
| 267 | |
| 268 | frames++; |
| 269 | now = SDL_GetTicks(); |
| 270 | if (SDL_TICKS_PASSED(now, next_fps_check)) { |
| 271 | /* Print out some timing information */ |
| 272 | const Uint32 then = next_fps_check - fps_check_delay; |
| 273 | const double fps = ((double) frames * 1000) / (now - then); |
| 274 | SDL_Log("%2.2f frames per second\n", fps); |
| 275 | next_fps_check = now + fps_check_delay; |
| 276 | frames = 0; |
| 277 | } |
| 278 | |
| 279 | } |
| 280 | |
| 281 | int |
| 282 | main(int argc, char *argv[]) |
no test coverage detected