examples/flappy: Bug fix: first touch ID might not be 0 on iPhone Safari (#576)

This commit is contained in:
Hajime Hoshi 2018-04-07 23:36:38 +09:00
parent 35557e845d
commit f2e2f602c5

View File

@ -182,9 +182,11 @@ func jump() bool {
if inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft) {
return true
}
// TODO: Is it correct to use ID '0' here?
if inpututil.IsJustTouched(0) {
return true
if len(ebiten.Touches()) > 0 {
id := ebiten.Touches()[0].ID()
if inpututil.IsJustTouched(id) {
return true
}
}
return false
}