mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
loop: Bug fix: the clock needs to be stopped when the window is unfocused
This commit is contained in:
parent
f591ca3d2b
commit
717efd097d
@ -143,7 +143,13 @@ func (c *runContext) updateCount(now int64) int {
|
|||||||
}
|
}
|
||||||
c.lastClockFrame = f
|
c.lastClockFrame = f
|
||||||
} else {
|
} else {
|
||||||
count = int(t * int64(clock.FPS) / int64(time.Second))
|
if t > 5*int64(time.Second)/int64(clock.FPS) {
|
||||||
|
// The previous time is too old. Let's assume that the window was unfocused.
|
||||||
|
count = 0
|
||||||
|
c.lastUpdated = now
|
||||||
|
} else {
|
||||||
|
count = int(t * int64(clock.FPS) / int64(time.Second))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stabilize FPS.
|
// Stabilize FPS.
|
||||||
|
Loading…
Reference in New Issue
Block a user