mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38: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{}
|
||||
)
|
||||
|
||||
func updateTouches() {
|
||||
func updateInput() {
|
||||
ts := []*mobile.Touch{}
|
||||
for id, position := range touches {
|
||||
ts = append(ts, &mobile.Touch{
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user