internal/ui: refactoring

This commit is contained in:
Hajime Hoshi 2022-12-29 21:09:30 +09:00
parent 4d89b5de07
commit dd853050e9

View File

@ -1071,8 +1071,14 @@ func (u *userInterfaceImpl) loopGame() error {
u.window.Destroy() u.window.Destroy()
glfw.Terminate() glfw.Terminate()
}) })
for { for {
if err := u.updateGame(); err != nil {
return err
}
}
}
func (u *userInterfaceImpl) updateGame() error {
var unfocused bool var unfocused bool
// On Windows, the focusing state might be always false (#987). // On Windows, the focusing state might be always false (#987).
@ -1157,7 +1163,8 @@ func (u *userInterfaceImpl) loopGame() error {
time.Sleep(wait - d) time.Sleep(wait - d)
} }
} }
}
return nil
} }
// swapBuffers must be called from the main thread. // swapBuffers must be called from the main thread.