mobile/ebitenmobileview: Refactoring: touches

This commit is contained in:
Hajime Hoshi 2019-10-11 22:55:38 +09:00
parent 5973833274
commit d488fd7fcb
4 changed files with 6 additions and 17 deletions

View File

@ -76,11 +76,3 @@ func Update() error {
return update()
}
func UpdateTouchesOnAndroid(action int, id int, x, y int) {
updateTouchesOnAndroid(action, id, x, y)
}
func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
updateTouchesOnIOSImpl(phase, ptr, x, y)
}

View File

@ -21,11 +21,8 @@ func update() error {
return nil
}
func updateTouchesOnAndroid(action int, id int, x, y int) {
func UpdateTouchesOnAndroid(action int, id int, x, y int) {
}
func updateTouchesOnIOSImpl(phase int, ptr int64, x, y int) {
}
func setUIView(uiview uintptr) {
func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
}

View File

@ -14,7 +14,7 @@
package ebitenmobileview
func updateTouchesOnAndroid(action int, id int, x, y int) {
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}
@ -25,6 +25,6 @@ func updateTouchesOnAndroid(action int, id int, x, y int) {
}
}
func updateTouchesOnIOSImpl(phase int, ptr int64, x, y int) {
func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
panic("ebitenmobileview: updateTouchesOnIOSImpl must not be called on Android")
}

View File

@ -43,11 +43,11 @@ func getIDFromPtr(ptr int64) int {
return id
}
func updateTouchesOnAndroid(action int, id int, x, y int) {
func UpdateTouchesOnAndroid(action int, id int, x, y int) {
panic("ebitenmobileview: updateTouchesOnAndroid must not be called on iOS")
}
func updateTouchesOnIOSImpl(phase int, ptr int64, x, y int) {
func UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
switch phase {
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
id := getIDFromPtr(ptr)