From 78f29467972da8f6d50ee95c3795eaebeed47493 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 2 Oct 2018 02:53:17 +0900 Subject: [PATCH] ui: Bug fix: timer condition was wrong --- internal/ui/ui_glfw.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index f14a5462f..31b8988e4 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -546,7 +546,10 @@ func (u *userInterface) getScale() float64 { func (u *userInterface) actualScreenScale() float64 { n := time.Now().UnixNano() // As devicescale.DeviceScale accesses OS API, not call this too often. - if u.deviceScale == 0 || n-u.deviceScaleUpdated < int64(time.Second/2) { + // + // TODO: This function might return different values in one frame. Instead of using time, can we use frames + // or tick? + if u.deviceScale == 0 || n-u.deviceScaleUpdated > int64(time.Second/4) { u.deviceScale = devicescale.DeviceScale() u.deviceScaleUpdated = n }