mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
internal/ui: refactoring
This commit is contained in:
parent
20edb04e5e
commit
0785502be3
@ -92,6 +92,7 @@ type userInterfaceImpl struct {
|
|||||||
initWindowFloating bool
|
initWindowFloating bool
|
||||||
initWindowMaximized bool
|
initWindowMaximized bool
|
||||||
|
|
||||||
|
// bufferOnceSwapped must be accessed from the main thread.
|
||||||
bufferOnceSwapped bool
|
bufferOnceSwapped bool
|
||||||
|
|
||||||
origWindowPosX int
|
origWindowPosX int
|
||||||
@ -111,8 +112,9 @@ type userInterfaceImpl struct {
|
|||||||
dropCallback glfw.DropCallback
|
dropCallback glfw.DropCallback
|
||||||
framebufferSizeCallbackCh chan struct{}
|
framebufferSizeCallbackCh chan struct{}
|
||||||
|
|
||||||
glContextSetOnce sync.Once
|
glContextSetOnce sync.Once
|
||||||
darwinInitOnce sync.Once
|
darwinInitOnce sync.Once
|
||||||
|
bufferOnceSwappedOnce sync.Once
|
||||||
|
|
||||||
mainThread threadInterface
|
mainThread threadInterface
|
||||||
renderThread threadInterface
|
renderThread threadInterface
|
||||||
@ -1092,8 +1094,12 @@ func (u *userInterfaceImpl) updateGame() error {
|
|||||||
|
|
||||||
// This works only for OpenGL.
|
// This works only for OpenGL.
|
||||||
u.swapBuffersOnRenderThread()
|
u.swapBuffersOnRenderThread()
|
||||||
|
})
|
||||||
|
|
||||||
u.bufferOnceSwapped = true
|
u.bufferOnceSwappedOnce.Do(func() {
|
||||||
|
u.mainThread.Call(func() {
|
||||||
|
u.bufferOnceSwapped = true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
if unfocused {
|
if unfocused {
|
||||||
|
Loading…
Reference in New Issue
Block a user