Game loop tweaks
@@ -245,7 +245,15 @@ int main(int argc, char* args[])
result = EXIT_FAILURE;
goto cleanup;
}
+ }
+ // updateAudio()
+ wrenSetSlotHandle(vm, 0, audioEngineClass);
+ interpreterResult = wrenCall(vm, updateMethod);
+ if (interpreterResult != WREN_RESULT_SUCCESS) {
+ result = EXIT_FAILURE;
+ goto cleanup;
+ }
// render();
wrenSetSlotHandle(vm, 0, gameClass);
wrenSetSlotDouble(vm, 1, (double)lag / MS_PER_FRAME);
@@ -262,18 +270,9 @@ int main(int argc, char* args[])
SDL_RenderCopy(engine.renderer, engine.texture, NULL, NULL);
SDL_RenderPresent(engine.renderer);
char buffer[20];
- snprintf(buffer, sizeof(buffer), "DOME - %.02f fps", 1000.0 / (elapsed+1)); // here 2 means binary
- SDL_SetWindowTitle(engine.window, buffer);
+ // 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;
}
