Stop drawing every millisecond
@@ -238,16 +238,6 @@ int main(int argc, char* args[])
result = EXIT_FAILURE;
goto cleanup;
}
- lag -= MS_PER_FRAME;
- }
-
- // updateAudio()
- wrenSetSlotHandle(vm, 0, audioEngineClass);
- interpreterResult = wrenCall(vm, updateMethod);
- if (interpreterResult != WREN_RESULT_SUCCESS) {
- result = EXIT_FAILURE;
- goto cleanup;
- }
// render();
wrenSetSlotHandle(vm, 0, gameClass);
@@ -264,10 +254,21 @@ int main(int argc, char* args[])
SDL_RenderClear(engine.renderer);
SDL_RenderCopy(engine.renderer, engine.texture, NULL, NULL);
SDL_RenderPresent(engine.renderer);
- elapsed = SDL_GetTicks() - currentTime;
char buffer[20];
snprintf(buffer, sizeof(buffer), "DOME - %.02f fps", 1000.0 / (elapsed+1)); // here 2 means binary
SDL_SetWindowTitle(engine.window, buffer);
+ lag -= MS_PER_FRAME;
+ }
+
+ // updateAudio()
+ wrenSetSlotHandle(vm, 0, audioEngineClass);
+ interpreterResult = wrenCall(vm, updateMethod);
+ if (interpreterResult != WREN_RESULT_SUCCESS) {
+ result = EXIT_FAILURE;
+ goto cleanup;
+ }
+
+ elapsed = SDL_GetTicks() - currentTime;
}
if (makeGif) {
jo_gif_end(&gif);
