Project

General

Profile

« Previous | Next » 

Revision 0e5ad27c

Added by Leszek Koltunski about 4 years ago

Add a 'withdraw move' button to the Solving UI state.

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
74 74
    private float mAxisX, mAxisY;
75 75
    private float mRotationFactor;
76 76
    private int mLastCubitColor, mLastCubitFace, mLastCubit;
77
    private int mCurrentAxis, mCurrentRow;
78
    private float mCurrentAngle;
77 79

  
78 80
    private static Static4D mQuatCurrent    = new Static4D(0,0,0,1);
79 81
    private static Static4D mQuatAccumulated= new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);
......
363 365
                                           Static2D res = mMovement.newRotation(rotatedTouchPoint2);
364 366
                                           RubikObject object = mPostRender.getObject();
365 367

  
366
                                           int axis = (int)res.get0();
368
                                           mCurrentAxis = (int)res.get0();
367 369
                                           float offset = res.get1();
368
                                           computeCurrentAxis( object.getRotationAxis()[axis] );
370
                                           mCurrentRow = (int)(object.returnMultiplier()*offset);
371
                                           computeCurrentAxis( object.getRotationAxis()[mCurrentAxis] );
369 372
                                           mRotationFactor = object.returnRotationFactor(offset);
370 373

  
371
                                           object.beginNewRotation( axis, (int)(object.returnMultiplier()*offset) );
374
                                           object.beginNewRotation( mCurrentAxis, mCurrentRow );
372 375

  
373 376
                                           if( RubikState.getCurrentState()==RubikState.SOLV )
374 377
                                             {
......
383 386
                                       else if( mContinuingRotation )
384 387
                                         {
385 388
                                         float angle = continueRotation(x-mStartRotX,y-mStartRotY);
386
                                         mPostRender.getObject().continueRotation(SWIPING_SENSITIVITY*angle);
389
                                         mCurrentAngle = SWIPING_SENSITIVITY*angle;
390
                                         mPostRender.getObject().continueRotation(mCurrentAngle);
387 391
                                         }
388 392
                                       else if( mDragging )
389 393
                                         {
......
416 420
                                       if( mContinuingRotation )
417 421
                                         {
418 422
                                         mPostRender.finishRotation();
423

  
424
                                         if( RubikState.getCurrentState()==RubikState.SOLV )
425
                                           {
426
                                           RubikStateSolving solving = (RubikStateSolving)RubikState.SOLV.getStateClass();
427

  
428
                                           int angle = mPostRender.getObject().computeNearestAngle(mCurrentAngle);
429

  
430
                                           if( angle!=0 )
431
                                             solving.addMove(mCurrentAxis, mCurrentRow, angle);
432
                                           }
419 433
                                         }
420 434
                                       if( mLastCubitColor>=0 )
421 435
                                         {

Also available in: Unified diff