igwrap: fix DeltaTime less than 0 on Windows

This commit is contained in:
Edgaru089 2022-01-21 12:55:02 +08:00
parent b44d41ec66
commit f4f784a7d3

View File

@ -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 {