From c4728efb1e4406d7f047e6ed23d40d10ad392724 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 17 Dec 2021 18:17:43 -0600 Subject: [PATCH] proper delta time --- src/main.onyx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.onyx b/src/main.onyx index 2e3b932..f6cca9f 100644 --- a/src/main.onyx +++ b/src/main.onyx @@ -303,9 +303,16 @@ draw :: () { } main_loop :: () { + last := glfwGetTime(); + now := last; + while !glfwWindowShouldClose(window) { glfwPollEvents(); - update(1.0f / 60); + + now = glfwGetTime(); + dt := now - last; + last = now; + update(~~dt); draw(); } } -- 2.25.1