mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/ui: refactoring
This commit is contained in:
parent
3869e2e4f6
commit
d13bea29dc
@ -112,7 +112,6 @@ type userInterfaceImpl struct {
|
|||||||
dropCallback glfw.DropCallback
|
dropCallback glfw.DropCallback
|
||||||
framebufferSizeCallbackCh chan struct{}
|
framebufferSizeCallbackCh chan struct{}
|
||||||
|
|
||||||
glContextSetOnce sync.Once
|
|
||||||
darwinInitOnce sync.Once
|
darwinInitOnce sync.Once
|
||||||
bufferOnceSwappedOnce sync.Once
|
bufferOnceSwappedOnce sync.Once
|
||||||
|
|
||||||
@ -1046,6 +1045,13 @@ func (u *userInterfaceImpl) loopGame() error {
|
|||||||
defer u.mainThread.Call(func() {
|
defer u.mainThread.Call(func() {
|
||||||
glfw.Terminate()
|
glfw.Terminate()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
u.renderThread.Call(func() {
|
||||||
|
if u.graphicsDriver.IsGL() {
|
||||||
|
u.window.MakeContextCurrent()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if err := u.updateGame(); err != nil {
|
if err := u.updateGame(); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1079,14 +1085,6 @@ func (u *userInterfaceImpl) updateGame() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
u.glContextSetOnce.Do(func() {
|
|
||||||
u.renderThread.Call(func() {
|
|
||||||
if u.graphicsDriver.IsGL() {
|
|
||||||
u.window.MakeContextCurrent()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
if err := u.context.updateFrame(u.graphicsDriver, outsideWidth, outsideHeight, deviceScaleFactor, u, func() {
|
if err := u.context.updateFrame(u.graphicsDriver, outsideWidth, outsideHeight, deviceScaleFactor, u, func() {
|
||||||
// Call updateVsync even though fpsMode is not updated.
|
// Call updateVsync even though fpsMode is not updated.
|
||||||
// When toggling to fullscreen, vsync state might be reset unexpectedly (#1787).
|
// When toggling to fullscreen, vsync state might be reset unexpectedly (#1787).
|
||||||
|
Loading…
Reference in New Issue
Block a user