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
|
||||
framebufferSizeCallbackCh chan struct{}
|
||||
|
||||
glContextSetOnce sync.Once
|
||||
darwinInitOnce sync.Once
|
||||
bufferOnceSwappedOnce sync.Once
|
||||
|
||||
@ -1046,6 +1045,13 @@ func (u *userInterfaceImpl) loopGame() error {
|
||||
defer u.mainThread.Call(func() {
|
||||
glfw.Terminate()
|
||||
})
|
||||
|
||||
u.renderThread.Call(func() {
|
||||
if u.graphicsDriver.IsGL() {
|
||||
u.window.MakeContextCurrent()
|
||||
}
|
||||
})
|
||||
|
||||
for {
|
||||
if err := u.updateGame(); err != nil {
|
||||
return err
|
||||
@ -1079,14 +1085,6 @@ func (u *userInterfaceImpl) updateGame() error {
|
||||
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() {
|
||||
// Call updateVsync even though fpsMode is not updated.
|
||||
// When toggling to fullscreen, vsync state might be reset unexpectedly (#1787).
|
||||
|
Loading…
Reference in New Issue
Block a user