mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
mobile/ebitenmobile: Rename functions
This is a preparation for other input devices. Updates #237
This commit is contained in:
parent
e20cbac8d8
commit
db2c4dc260
@ -29,7 +29,7 @@ var (
|
|||||||
touches = map[int]position{}
|
touches = map[int]position{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func updateTouches() {
|
func updateInput() {
|
||||||
ts := []*mobile.Touch{}
|
ts := []*mobile.Touch{}
|
||||||
for id, position := range touches {
|
for id, position := range touches {
|
||||||
ts = append(ts, &mobile.Touch{
|
ts = append(ts, &mobile.Touch{
|
||||||
|
@ -18,10 +18,10 @@ func UpdateTouchesOnAndroid(action int, id int, x, y int) {
|
|||||||
switch action {
|
switch action {
|
||||||
case 0x00, 0x05, 0x02: // ACTION_DOWN, ACTION_POINTER_DOWN, ACTION_MOVE
|
case 0x00, 0x05, 0x02: // ACTION_DOWN, ACTION_POINTER_DOWN, ACTION_MOVE
|
||||||
touches[id] = position{x, y}
|
touches[id] = position{x, y}
|
||||||
updateTouches()
|
updateInput()
|
||||||
case 0x01, 0x06: // ACTION_UP, ACTION_POINTER_UP
|
case 0x01, 0x06: // ACTION_UP, ACTION_POINTER_UP
|
||||||
delete(touches, id)
|
delete(touches, id)
|
||||||
updateTouches()
|
updateInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
|
|||||||
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
|
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
|
||||||
id := getIDFromPtr(ptr)
|
id := getIDFromPtr(ptr)
|
||||||
touches[id] = position{x, y}
|
touches[id] = position{x, y}
|
||||||
updateTouches()
|
updateInput()
|
||||||
case C.UITouchPhaseEnded, C.UITouchPhaseCancelled:
|
case C.UITouchPhaseEnded, C.UITouchPhaseCancelled:
|
||||||
id := getIDFromPtr(ptr)
|
id := getIDFromPtr(ptr)
|
||||||
delete(ptrToID, ptr)
|
delete(ptrToID, ptr)
|
||||||
delete(touches, id)
|
delete(touches, id)
|
||||||
updateTouches()
|
updateInput()
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("ebitenmobileview: invalid phase: %d", phase))
|
panic(fmt.Sprintf("ebitenmobileview: invalid phase: %d", phase))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user