Project

General

Profile

« Previous | Next » 

Revision 967b79dc

Added by Leszek Koltunski almost 3 years ago

Progress with RubikControl.

View differences:

src/main/java/org/distorted/control/RubikControlWhole.java
475 475
    resetDynamics2(9);
476 476
    resetDynamics3(9);
477 477

  
478
    Static3D point1s= new Static3D(-X2  +D,-Y1  +D, 0);
479
    Static3D point2s= new Static3D( X2  +D, Y1  +D, 0);
480
    Static3D point1f= new Static3D((-X2  +D)*F,(-Y1  +D)*F, 0);
481
    Static3D point2f= new Static3D(( X2  +D)*F,( Y1  +D)*F, 0);
478
    Static3D point1s = new Static3D(-X2+D,-Y1+D, 0);
479
    Static3D point2s = new Static3D( X2+D, Y1+D, 0);
480
    Static3D point1f = new Static3D(-Y1*F,-Y1*F, 0);
481
    Static3D point2f = new Static3D( Y1*F, Y1*F, 0);
482 482
    Static3D scale1F = new Static3D( s014,s014,s014);
483 483
    Static3D point1H = new Static3D( s033,s033,s033);
484 484
    Static3D scale2F = new Static3D(-s014,s014,s014);
......
528 528
    Static3D scale2F = new Static3D(-s014,s014,s014);
529 529
    Static3D point2H = new Static3D(-s033,s033,s033);
530 530

  
531
    Static3D point0= new Static3D((-X2+D)*F,(-Y1+D)*F, 0);
532
    Static3D point1= new Static3D((-X2+D)*F,( Y1+D)*F, 0);
533
    Static3D point2= new Static3D(( X2+D)*F,( Y1+D)*F, 0);
534
    Static3D point3= new Static3D(( X2+D)*F,(-Y1+D)*F, 0);
531
    Static3D point0= new Static3D(-Y1*F,-Y1*F, 0);
532
    Static3D point1= new Static3D(-Y1*F, Y1*F, 0);
533
    Static3D point2= new Static3D( Y1*F, Y1*F, 0);
534
    Static3D point3= new Static3D( Y1*F,-Y1*F, 0);
535 535

  
536 536
    mDynScaleHand1.add(point1H);
537 537
    mDynScaleShad1.add(scale1F);
......
574 574
    resetDynamics2(11);
575 575
    resetDynamics3(11);
576 576

  
577
    Static3D point1s= new Static3D( -X2+D   , -Y1+D   , 0);
578
    Static3D point2s= new Static3D(  X2+D   ,  Y1+D   , 0);
579
    Static3D point1f= new Static3D((-X2+D)*F,(-Y1+D)*F, 0);
580
    Static3D point2f= new Static3D(( X2+D)*F,( Y1+D)*F, 0);
577
    Static3D point1s= new Static3D(-X2+D,-Y1+D, 0);
578
    Static3D point2s= new Static3D( X2+D, Y1+D, 0);
579
    Static3D point1f= new Static3D(-Y1*F,-Y1*F, 0);
580
    Static3D point2f= new Static3D( Y1*F, Y1*F, 0);
581 581
    Static3D scale1F= new Static3D( s014,s014,s014);
582 582
    Static3D point1H= new Static3D( s033,s033,s033);
583 583
    Static3D scale2F= new Static3D(-s014,s014,s014);
......
804 804
    s001 = mWidth*0.0001f;
805 805
    s014 = mWidth*0.14f;
806 806
    s033 = mWidth*0.33f;
807
    F    = 0.70f;
807
    F    = 0.50f;
808 808
    }
809 809

  
810 810
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/helpers/BlockController.java
47 47

  
48 48
  private static final long THRESHHOLD_0 =  3000;
49 49
  private static final long THRESHHOLD_1 = 25000;
50
  private static final long THRESHHOLD_2 = 45000;
50 51

  
51 52
  private static long mPauseTime, mResumeTime;
52 53

  
......
96 97

  
97 98
///////////////////////////////////////////////////////////////////////////////////////////////////
98 99
// RUBIK_PLACE_3 and TUTORIAL_PLACE_3 are scrambles, those can take up to 20 seconds.
100
// CONTROL_PLACE_* are the visual tutorials, could take up to 45 seconds.
101

  
102
  private long getThreshhold(int last)
103
    {
104
    switch(last)
105
      {
106
      case RUBIK_PLACE_3   :
107
      case TUTORIAL_PLACE_3: return THRESHHOLD_1;
108
      case CONTROL_PLACE_0 :
109
      case CONTROL_PLACE_1 : return THRESHHOLD_2;
110
      default              : return THRESHHOLD_0;
111
      }
112
    }
113

  
114
///////////////////////////////////////////////////////////////////////////////////////////////////
99 115

  
100 116
  private void checkingThread()
101 117
    {
102 118
    long now = System.currentTimeMillis();
103 119

  
104
    long touchThreshhold = (mLastTouchPlace==RUBIK_PLACE_3 || mLastTouchPlace==TUTORIAL_PLACE_3) ? THRESHHOLD_1 : THRESHHOLD_0;
120
    long touchThreshhold = getThreshhold(mLastTouchPlace);
105 121

  
106 122
    if( mTouchBlockTime>mPauseTime && now-mTouchBlockTime>touchThreshhold )
107 123
      {
......
116 132
      reportTouchProblem(touchThreshhold);
117 133
      }
118 134

  
119
    long uiThreshhold = (mLastUIPlace==RUBIK_PLACE_3 || mLastUIPlace==TUTORIAL_PLACE_3) ? THRESHHOLD_1 : THRESHHOLD_0;
135
    long uiThreshhold = getThreshhold(mLastUIPlace);
120 136

  
121 137
    if( mUIBlockTime>mPauseTime && now-mUIBlockTime>uiThreshhold )
122 138
      {
src/main/java/org/distorted/main/RubikSurfaceView.java
347 347
          mDragging           = (!locked || mIsAutomatic);
348 348
          mBeginningRotation  = false;
349 349
          mContinuingRotation = false;
350
          if( locked ) reddenLockIcon(act);
350
          if( !mDragging ) reddenLockIcon(act);
351 351
          }
352 352
        }
353 353
      }
src/main/java/org/distorted/screens/RubikScreenPlay.java
33 33
import android.widget.LinearLayout;
34 34
import android.widget.PopupWindow;
35 35

  
36
import org.distorted.control.RubikControl;
36 37
import org.distorted.dialogs.RubikDialogAbout;
37 38
import org.distorted.dialogs.RubikDialogPattern;
38 39
import org.distorted.dialogs.RubikDialogScores;
......
55 56

  
56 57
  private static final int[] BUTTON_LABELS = { R.string.scores,
57 58
                                               R.string.patterns,
58
                                           //    R.string.control,
59
                                               R.string.control,
59 60
                                               R.string.solver,
60 61
                                               R.string.tutorials,
61 62
                                               R.string.about };
......
395 396
              pDiag.setArguments(pBundle);
396 397
              pDiag.show( act.getSupportFragmentManager(), RubikDialogPattern.getDialogTag() );
397 398
              break;
398
/*
399 399
      case 2: RubikControl control = RubikControl.getInstance();
400 400
              control.animateAll(act);
401 401
              break;
402
 */
403
      case 2: ScreenList.switchScreen(act, ScreenList.SVER);
402
      case 3: ScreenList.switchScreen(act, ScreenList.SVER);
404 403
              break;
405
      case 3: RubikDialogTutorial tDiag = new RubikDialogTutorial();
404
      case 4: RubikDialogTutorial tDiag = new RubikDialogTutorial();
406 405
              Bundle tBundle = new Bundle();
407 406
              int tOrd = getTutorialOrdinal();
408 407
              tBundle.putInt("tab", tOrd );
409 408
              tDiag.setArguments(tBundle);
410 409
              tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() );
411 410
              break;
412
      case 4: RubikDialogAbout aDiag = new RubikDialogAbout();
411
      case 5: RubikDialogAbout aDiag = new RubikDialogAbout();
413 412
              aDiag.show(act.getSupportFragmentManager(), null);
414 413
              break;
415 414
      }
src/main/java/org/distorted/tutorials/TutorialSurfaceView.java
303 303
          mContinuingRotation = false;
304 304
          mBeginningRotation  = false;
305 305

  
306
          if( locked )
306
          if( !mDragging )
307 307
            {
308 308
            TutorialState state = act.getState();
309 309
            state.reddenLock(act);

Also available in: Unified diff