mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 15:04:28 +01:00
uidriver/glfw: Reduce (*thread).Call at (*UserInterface).update
This commit is contained in:
parent
7762f5dcec
commit
495b2b722a
@ -804,34 +804,30 @@ func (u *UserInterface) updateSize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) update() error {
|
func (u *UserInterface) update() error {
|
||||||
shouldClose := false
|
if err := u.t.Call(func() error {
|
||||||
_ = u.t.Call(func() error {
|
shouldClose := u.window.ShouldClose()
|
||||||
shouldClose = u.window.ShouldClose()
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if shouldClose {
|
if shouldClose {
|
||||||
return driver.RegularTermination
|
return driver.RegularTermination
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.isInitFullscreen() {
|
if u.isInitFullscreen() {
|
||||||
_ = u.t.Call(func() error {
|
|
||||||
w, h := u.window.GetSize()
|
w, h := u.window.GetSize()
|
||||||
u.setWindowSize(w, h, true)
|
u.setWindowSize(w, h, true)
|
||||||
return nil
|
|
||||||
})
|
|
||||||
u.setInitFullscreen(false)
|
u.setInitFullscreen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
|
// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
|
||||||
// Calling this inside setWindowSize didn't work (#1363).
|
// Calling this inside setWindowSize didn't work (#1363).
|
||||||
_ = u.t.Call(func() error {
|
|
||||||
if !u.vsyncInited {
|
if !u.vsyncInited {
|
||||||
u.vsync = u.isInitVsyncEnabled()
|
u.vsync = u.isInitVsyncEnabled()
|
||||||
u.updateVsync()
|
u.updateVsync()
|
||||||
u.vsyncInited = true
|
u.vsyncInited = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// This call is needed for initialization.
|
// This call is needed for initialization.
|
||||||
u.updateSize()
|
u.updateSize()
|
||||||
@ -861,10 +857,6 @@ func (u *UserInterface) update() error {
|
|||||||
if w, h := u.reqWidth, u.reqHeight; w != 0 || h != 0 {
|
if w, h := u.reqWidth, u.reqHeight; w != 0 || h != 0 {
|
||||||
u.setWindowSize(w, h, u.isFullscreen())
|
u.setWindowSize(w, h, u.isFullscreen())
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
_ = u.t.Call(func() error {
|
|
||||||
u.reqWidth = 0
|
u.reqWidth = 0
|
||||||
u.reqHeight = 0
|
u.reqHeight = 0
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user