From c2d1f99e7eebcc61f97ba06e40f5fb534169223b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 9 Apr 2016 19:08:19 +0900 Subject: [PATCH] ui: less error adjustment is better --- run.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run.go b/run.go index 80511832d..b6ed5ae37 100644 --- a/run.go +++ b/run.go @@ -206,7 +206,7 @@ func Run(f func(*Image) error, width, height, scale int, title string) error { // As t is not accurate 1/60[sec], errors are accumulated // (generally, errors are positive values). // To make the FPS stable, set tt 1 if t is a little less than 1/60[sec]. - if tt == 0 && (int64(time.Second)/FPS-int64(10*time.Millisecond)) < t { + if tt == 0 && (int64(time.Second)/FPS-int64(5*time.Millisecond)) < t { tt = 1 } for i := 0; i < tt; i++ { @@ -221,8 +221,7 @@ func Run(f func(*Image) error, width, height, scale int, title string) error { } } ui.CurrentUI().SwapBuffers() - d := int64(tt) * int64(time.Second) / FPS - beforeForUpdate += d + beforeForUpdate += int64(tt) * int64(time.Second) / FPS frames++ }