mobile/mobile.go
func UpdateTouchesOnAndroid(action int, id int, x, y int) {
	mobileMutex.Lock()
	defer mobileMutex.Unlock()

	updateTouchesOnAndroid(action, id, x, y)
}
func UpdateTouchesOnAndroid(action int, id int, x, y int) {
	mobileMutex.Lock()
	defer mobileMutex.Unlock()

	updateTouchesOnAndroid(action, id, x, y)
}
func UpdateTouchesOnAndroid ( action int , id int , x , y int ) { mobileMutex . Lock ( ) defer mobileMutex . Unlock ( ) updateTouchesOnAndroid ( action , id , x , y ) }
// UpdateTouchesOnAndroid updates the touch state on Android.
//
// This should be called with onTouchEvent of GLSurfaceView like this:
//
//     private double mDeviceScale = 0.0;
//
//     // pxToDp converts an value in pixels to dp.
//     private double pxToDp(double x) {
//         if (mDeviceScale == 0.0) {
//             mDeviceScale = getResources().getDisplayMetrics().density;
//         }
//         return x / mDeviceScale;
//     }
//
//     @Override
//     public boolean onTouchEvent(MotionEvent e) {
//         for (int i = 0; i < e.getPointerCount(); i++) {
//             int id = e.getPointerId(i);
//             int x = (int)e.getX(i);
//             int y = (int)e.getY(i);
//             // Exported function for UpdateTouchesOnAndroid
//             YourGame.UpdateTouchesOnAndroid(e.getActionMasked(), id, (int)pxToDp(x), (int)pxToDp(y));
//         }
//         return true;
//     }
//
// The coodinate x/y is in dp.
//
// UpdateTouchesOnAndroid can be called even before Start is called.
//
// UpdateTouchesOnAndroid is concurrent-safe.
//
// For more details, see https://github.com/hajimehoshi/ebiten/wiki/Android.
UpdateTouchesOnAndroid updates the touch state on Android . This should be called with onTouchEvent of GLSurfaceView like this : private double mDeviceScale = 0 . 0 ; // pxToDp converts an value in pixels to dp . private double pxToDp ( double x ) { if ( mDeviceScale == 0 . 0 ) { mDeviceScale = getResources () . getDisplayMetrics () . density ; } return x / mDeviceScale ; }