mobile/ebitenmobile: Rename functions

This is a preparation for other input devices.

Updates #237
This commit is contained in:
Hajime Hoshi 2020-02-19 01:51:03 +09:00
parent e20cbac8d8
commit db2c4dc260
3 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ var (
touches = map[int]position{}
)
func updateTouches() {
func updateInput() {
ts := []*mobile.Touch{}
for id, position := range touches {
ts = append(ts, &mobile.Touch{

View File

@ -18,10 +18,10 @@ func UpdateTouchesOnAndroid(action int, id int, x, y int) {
switch action {
case 0x00, 0x05, 0x02: // ACTION_DOWN, ACTION_POINTER_DOWN, ACTION_MOVE
touches[id] = position{x, y}
updateTouches()
updateInput()
case 0x01, 0x06: // ACTION_UP, ACTION_POINTER_UP
delete(touches, id)
updateTouches()
updateInput()
}
}

View File

@ -54,12 +54,12 @@ func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
id := getIDFromPtr(ptr)
touches[id] = position{x, y}
updateTouches()
updateInput()
case C.UITouchPhaseEnded, C.UITouchPhaseCancelled:
id := getIDFromPtr(ptr)
delete(ptrToID, ptr)
delete(touches, id)
updateTouches()
updateInput()
default:
panic(fmt.Sprintf("ebitenmobileview: invalid phase: %d", phase))
}