Fix ui.go to use defer and call glfw.SwapInterval

This commit is contained in:
Hajime Hoshi 2014-12-25 18:42:39 +09:00
parent f603859b01
commit 5780e9020c

3
ui.go
View File

@ -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
} }