Пример #1
0
 private int indexOfRightmostVertexOf(final Vector2 vector2) {
   final Vector2[] mVertices = this.mVertices;
   final int mVertexCount = this.mVertexCount;
   int n = 0;
   for (int i = 1; i < mVertexCount; ++i) {
     final Vector2 set = Vector2Pool.obtain().set(mVertices[i]);
     final Vector2 set2 = Vector2Pool.obtain().set(mVertices[n]);
     if (Vector2Util.isLess(set.sub(vector2), set2.sub(vector2))) {
       n = i;
     }
     Vector2Pool.recycle(set);
     Vector2Pool.recycle(set2);
   }
   return n;
 }
Пример #2
0
 @Override
 public void onAccelerometerChanged(final AccelerometerData pAccelerometerData) {
   final Vector2 gravity =
       Vector2Pool.obtain(pAccelerometerData.getX(), pAccelerometerData.getY());
   this.mPhysicsWorld.setGravity(gravity);
   Vector2Pool.recycle(gravity);
 }