ui: Bug fix: 'frames' should be incremanted only when drawing happens

This commit is contained in:
Hajime Hoshi 2016-04-09 02:36:30 +09:00
parent 5fa81ebe78
commit 328900ec80

2
run.go
View File

@ -214,10 +214,10 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
}
ui.CurrentUI().SwapBuffers()
beforeForUpdate += int64(t) * int64(time.Second/FPS)
frames++
}
// Calc the current FPS.
frames++
if time.Second <= time.Duration(now-beforeForFPS) {
currentRunContext.updateFPS(float64(frames) * float64(time.Second) / float64(now-beforeForFPS))
beforeForFPS = now