mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 22:44:28 +01:00
mobile/ebitenmobileview: Refactoring: touches
This commit is contained in:
parent
5973833274
commit
d488fd7fcb
@ -76,11 +76,3 @@ func Update() error {
|
|||||||
|
|
||||||
return update()
|
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)
|
|
||||||
}
|
|
||||||
|
@ -21,11 +21,8 @@ func update() error {
|
|||||||
return nil
|
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 UpdateTouchesOnIOS(phase int, ptr int64, x, y int) {
|
||||||
}
|
|
||||||
|
|
||||||
func setUIView(uiview uintptr) {
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
package ebitenmobileview
|
package ebitenmobileview
|
||||||
|
|
||||||
func updateTouchesOnAndroid(action int, id int, x, y int) {
|
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}
|
||||||
@ -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")
|
panic("ebitenmobileview: updateTouchesOnIOSImpl must not be called on Android")
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,11 @@ func getIDFromPtr(ptr int64) int {
|
|||||||
return id
|
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")
|
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 {
|
switch phase {
|
||||||
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
|
case C.UITouchPhaseBegan, C.UITouchPhaseMoved, C.UITouchPhaseStationary:
|
||||||
id := getIDFromPtr(ptr)
|
id := getIDFromPtr(ptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user