ui: Fix comment

This commit is contained in:
Hajime Hoshi 2016-04-10 23:03:50 +09:00
parent e0a091194e
commit b9752ce97c

5
run.go
View File

@ -199,12 +199,11 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
currentRunContext.setRunningSlowly(false) currentRunContext.setRunningSlowly(false)
beforeForUpdate = now beforeForUpdate = now
} else { } else {
// Note that generally t is a little more than 1/60[sec]. // Note that generally t is a little different from 1/60[sec].
t := now - beforeForUpdate t := now - beforeForUpdate
currentRunContext.setRunningSlowly(t*FPS >= int64(time.Second*5/2)) currentRunContext.setRunningSlowly(t*FPS >= int64(time.Second*5/2))
tt := int(t * FPS / int64(time.Second)) tt := int(t * FPS / int64(time.Second))
// As t is not accurate 1/60[sec], errors are accumulated // 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]. // 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(5*time.Millisecond)) < t { if tt == 0 && (int64(time.Second)/FPS-int64(5*time.Millisecond)) < t {
tt = 1 tt = 1