mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Fix ui.go to use defer and call glfw.SwapInterval
This commit is contained in:
parent
f603859b01
commit
5780e9020c
3
ui.go
3
ui.go
@ -48,6 +48,7 @@ func init() {
|
|||||||
currentUI.run()
|
currentUI.run()
|
||||||
currentUI.use(func() {
|
currentUI.use(func() {
|
||||||
opengl.Init()
|
opengl.Init()
|
||||||
|
glfw.SwapInterval(1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +176,8 @@ func (u *ui) run() {
|
|||||||
func (u *ui) use(f func()) {
|
func (u *ui) use(f func()) {
|
||||||
ch := make(chan struct{})
|
ch := make(chan struct{})
|
||||||
u.funcs <- func() {
|
u.funcs <- func() {
|
||||||
|
defer close(ch)
|
||||||
f()
|
f()
|
||||||
close(ch)
|
|
||||||
}
|
}
|
||||||
<-ch
|
<-ch
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user