From f4f784a7d3f9e11c833939ffbd9eb7d8e5abee42 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Fri, 21 Jan 2022 12:55:02 +0800 Subject: [PATCH] igwrap: fix DeltaTime less than 0 on Windows --- internal/igwrap/glfw.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/igwrap/glfw.go b/internal/igwrap/glfw.go index 9f6ee11..e843d86 100644 --- a/internal/igwrap/glfw.go +++ b/internal/igwrap/glfw.go @@ -38,7 +38,11 @@ func NewFrame() { io.SetDisplaySize(imgui.Vec2{X: float32(dsx), Y: float32(dsy)}) now := time.Now() - io.SetDeltaTime(float32(time.Since(lastframe).Seconds())) + deltaTime := float32(time.Since(lastframe).Seconds()) + if deltaTime <= 0.0 { + deltaTime = 1e-6 + } + io.SetDeltaTime(deltaTime) lastframe = now if win.GetAttrib(glfw.Focused) != 0 {