mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
ui: Bug fix: timer condition was wrong
This commit is contained in:
parent
bf850e12a4
commit
78f2946797
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user