mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Simplify vsync
This commit is contained in:
parent
6c3af3a9dc
commit
cddaae55dd
@ -48,19 +48,11 @@ func shown() bool {
|
||||
|
||||
func vsync() {
|
||||
ch := make(chan struct{})
|
||||
n := 1
|
||||
var l func()
|
||||
l = func() {
|
||||
if 0 < n {
|
||||
n--
|
||||
// TODO: In iOS8, this is called at every 1/30[sec] frame.
|
||||
// Can we use DOMHighResTimeStamp?
|
||||
js.Global.Get("window").Call("requestAnimationFrame", l)
|
||||
return
|
||||
}
|
||||
js.Global.Get("window").Call("requestAnimationFrame", func() {
|
||||
// TODO: In iOS8, this is called at every 1/30[sec] frame.
|
||||
// Can we use DOMHighResTimeStamp?
|
||||
close(ch)
|
||||
}
|
||||
l()
|
||||
})
|
||||
<-ch
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user