Project

General

Profile

« Previous | Next » 

Revision c9c71c3f

Added by Leszek Koltunski over 2 years ago

Abstract out the TouchControl stuff in preparation for its new type - TouchControlShapeChanging.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectControl.java
33 33
import org.distorted.objectlib.helpers.BlockController;
34 34
import org.distorted.objectlib.helpers.MovesFinished;
35 35
import org.distorted.objectlib.helpers.ObjectLibInterface;
36
import org.distorted.objectlib.movement.Movement;
36
import org.distorted.objectlib.touchcontrol.TouchControl;
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
......
56 56

  
57 57
    private final ObjectLibInterface mInterface;
58 58
    private final ObjectPreRender mPreRender;
59
    private Movement mMovement;
59
    private TouchControl mTouchControl;
60 60
    private TwistyObjectNode mObjectNode;
61 61
    private boolean mDragging, mBeginningRotation, mContinuingRotation;
62 62
    private int mScreenWidth, mScreenHeight, mScreenMin;
......
169 169
      if( down )
170 170
        {
171 171
        int color = mInterface.getCurrentColor();
172
        float[] point = mMovement.getTouchedPoint3D();
172
        float[] point = mTouchControl.getTouchedPoint3D();
173 173
        mLastCubit = object.getCubit(point);
174 174
        mLastCubitColor = mInterface.cubitIsLocked(mLastCubit);
175 175
        int face;
......
180 180
          }
181 181
        else
182 182
          {
183
          int touchedFace = mMovement.getTouchedFace();
183
          int touchedFace = mTouchControl.getTouchedFace();
184 184
          if( mLastCubit<8 ) face = touchedFace;
185 185
          else
186 186
            {
......
220 220
        Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat);
221 221
        Static4D rotatedCamera= QuatHelper.rotateVectorByInvertedQuat(CAMERA_POINT, mQuat);
222 222

  
223
        if( object!=null && mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera) )
223
        if( object!=null && mTouchControl !=null && mTouchControl.faceTouched(rotatedTouchPoint,rotatedCamera) )
224 224
          {
225 225
          mDragging           = false;
226 226
          mContinuingRotation = false;
......
339 339

  
340 340
      Static4D touchPoint = new Static4D(x, y, 0, 0);
341 341
      Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat);
342
      Static2D res = mMovement.newRotation(rotatedTouchPoint);
342
      Static2D res = mTouchControl.newRotation(rotatedTouchPoint);
343 343

  
344 344
      mCurrentAxis = (int)res.get0();
345 345
      mCurrentRow  = (int)res.get1();
346 346

  
347
      computeCurrentAxis( mMovement.getCastedRotAxis(mCurrentAxis) );
348
      mRotationFactor = mMovement.returnRotationFactor(numLayers,mCurrentRow);
347
      computeCurrentAxis( mTouchControl.getCastedRotAxis(mCurrentAxis) );
348
      mRotationFactor = mTouchControl.returnRotationFactor(numLayers,mCurrentRow);
349 349

  
350 350
      object.beginNewRotation( mCurrentAxis, mCurrentRow );
351 351

  
......
530 530

  
531 531
///////////////////////////////////////////////////////////////////////////////////////////////////
532 532

  
533
    void setMovement(Movement movement)
533
    void setMovement(TouchControl touchControl)
534 534
      {
535
      mMovement = movement;
535
      mTouchControl = touchControl;
536 536
      }
537 537

  
538 538
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff