mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ui: Initialize GLFW before Run
This commit is contained in:
parent
6d1342a934
commit
d41f959b96
@ -66,11 +66,13 @@ var (
|
||||
initCursorVisible: true,
|
||||
initWindowDecorated: true,
|
||||
}
|
||||
currentUIInitialized = make(chan struct{})
|
||||
)
|
||||
|
||||
func init() {
|
||||
runtime.LockOSThread()
|
||||
if err := initialize(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func initialize() error {
|
||||
@ -116,11 +118,6 @@ func initialize() error {
|
||||
func RunMainThreadLoop(ch <-chan error) error {
|
||||
// This must be called on the main thread.
|
||||
|
||||
if err := initialize(); err != nil {
|
||||
return err
|
||||
}
|
||||
close(currentUIInitialized)
|
||||
|
||||
// TODO: Check this is done on the main thread.
|
||||
currentUI.setRunning(true)
|
||||
defer func() {
|
||||
@ -445,8 +442,6 @@ func SetWindowDecorated(decorated bool) {
|
||||
}
|
||||
|
||||
func Run(width, height int, scale float64, title string, g GraphicsContext, mainloop bool) error {
|
||||
<-currentUIInitialized
|
||||
|
||||
u := currentUI
|
||||
// GLContext must be created before setting the screen size, which requires
|
||||
// swapping buffers.
|
||||
|
Loading…
Reference in New Issue
Block a user