mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
uidriver/js: Update touch APIs for go2cpp
This commit is contained in:
parent
e9d0b2e179
commit
a6ade8f5cd
@ -402,14 +402,12 @@ func (i *Input) updateForGo2Cpp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i.touches = map[driver.TouchID]pos{}
|
i.touches = map[driver.TouchID]pos{}
|
||||||
maxID := go2cpp.Get("maxTouchId").Int()
|
maxID := go2cpp.Get("touchCount").Int()
|
||||||
for id := 0; id < maxID; id++ {
|
for idx := 0; idx < maxID; idx++ {
|
||||||
x := go2cpp.Call("getTouchPositionX", id)
|
id := go2cpp.Call("getTouchPositionId", idx)
|
||||||
y := go2cpp.Call("getTouchPositionY", id)
|
x := go2cpp.Call("getTouchPositionX", idx)
|
||||||
if x.Type() != js.TypeNumber || y.Type() != js.TypeNumber {
|
y := go2cpp.Call("getTouchPositionY", idx)
|
||||||
continue
|
i.touches[driver.TouchID(id.Int())] = pos{
|
||||||
}
|
|
||||||
i.touches[driver.TouchID(id)] = pos{
|
|
||||||
X: x.Int(),
|
X: x.Int(),
|
||||||
Y: y.Int(),
|
Y: y.Int(),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user