mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-13 22:47: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
|
||||||
@ -113,6 +114,7 @@ type userInterfaceImpl 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,9 +1094,13 @@ func (u *userInterfaceImpl) updateGame() error {
|
|||||||
|
|
||||||
// This works only for OpenGL.
|
// This works only for OpenGL.
|
||||||
u.swapBuffersOnRenderThread()
|
u.swapBuffersOnRenderThread()
|
||||||
|
})
|
||||||
|
|
||||||
|
u.bufferOnceSwappedOnce.Do(func() {
|
||||||
|
u.mainThread.Call(func() {
|
||||||
u.bufferOnceSwapped = true
|
u.bufferOnceSwapped = true
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
if unfocused {
|
if unfocused {
|
||||||
t2 = time.Now()
|
t2 = time.Now()
|
||||||
|
Loading…
Reference in New Issue
Block a user