From bcaa791f7abbb032b3ce3e7d09f703ee1eca6e6b Mon Sep 17 00:00:00 2001 From: Allen Ray Date: Thu, 10 Sep 2020 22:52:42 -0400 Subject: [PATCH] Fixed delta time issue --- ui.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui.go b/ui.go index 03c95d7..0f303be 100644 --- a/ui.go +++ b/ui.go @@ -114,6 +114,9 @@ func (ui *UI) Destroy() { // NewFrame Call this at the beginning of the frame to tell the UI that the frame has started func (ui *UI) NewFrame() { + if !ui.timer.IsZero() { + ui.io.SetDeltaTime(float32(time.Since(ui.timer).Seconds())) + } ui.timer = time.Now() // imgui requires that io be set before calling NewFrame @@ -124,7 +127,6 @@ func (ui *UI) NewFrame() { // update Handles general update type things and handle inputs. Called from ui.Draw. func (ui *UI) update() { - ui.io.SetDeltaTime(float32(time.Since(ui.timer).Seconds())) } // Draw Draws the imgui UI to the Pixel Window