Esempio n. 1
0
 @Override
 public void onSensorChanged(SensorEvent event) {
   if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
     float x, y;
     switch (mDisplay.getRotation()) {
       case Surface.ROTATION_90:
         x = -event.values[1];
         y = event.values[0];
         break;
       case Surface.ROTATION_270:
         x = event.values[1];
         y = -event.values[0];
         break;
       case Surface.ROTATION_180:
         x = -event.values[1];
         y = -event.values[0];
         break;
       default:
         x = event.values[0];
         y = event.values[1];
         break;
     }
     SDLActivity.onNativeAccel(
         -x / SensorManager.GRAVITY_EARTH,
         y / SensorManager.GRAVITY_EARTH,
         event.values[2] / SensorManager.GRAVITY_EARTH - 1);
   }
 }
Esempio n. 2
0
 @Override
 public void onSensorChanged(SensorEvent event) {
   if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
     SDLActivity.onNativeAccel(
         event.values[0] / SensorManager.GRAVITY_EARTH,
         event.values[1] / SensorManager.GRAVITY_EARTH,
         event.values[2] / SensorManager.GRAVITY_EARTH);
   }
 }
Esempio n. 3
0
 public void onSensorChanged(SensorEvent event) {
   if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
     SDLActivity.onNativeAccel(event.values[0], event.values[1], event.values[2]);
   }
 }