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