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{} 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{

View File

@ -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()
} }
} }

View File

@ -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))
} }