ensure dt is never zero

This commit is contained in:
bloeys
2022-02-24 14:34:21 +04:00
parent 99f5548ce2
commit 660c41bc06

View File

@ -1,6 +1,8 @@
package timing
import "time"
import (
"time"
)
var (
dt float32 = 0.01
@ -17,7 +19,11 @@ func FrameStarted() {
}
func FrameEnded() {
dt = float32(time.Since(frameStart).Seconds())
if dt == 0 {
dt = float32(time.Microsecond)
}
}
//DT is frame deltatime in seconds