Project

General

Profile

« Previous | Next » 

Revision 771f6dfa

Added by Leszek Koltunski about 3 years ago

Move actual solving the object to PreRender.

(before we had a 'solveObejct()' in preRender already, but that one just starts the Solve Effect!)

View differences:

src/main/java/org/distorted/effects/EffectController.java
21 21

  
22 22
import org.distorted.helpers.MovesFinished;
23 23
import org.distorted.library.message.EffectListener;
24
import org.distorted.main.RubikPreRender;
25 24
import org.distorted.objects.TwistyObject;
26 25

  
27 26
///////////////////////////////////////////////////////////////////////////////////////////////////
......
32 31
  TwistyObject getOldObject();
33 32
  TwistyObject getObject();
34 33
  int getNumScrambles();
34
  void solve();
35 35
  }
src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
25 25
import org.distorted.library.main.DistortedEffects;
26 26
import org.distorted.library.main.DistortedScreen;
27 27
import org.distorted.library.message.EffectListener;
28
import org.distorted.main.RubikPreRender;
29 28
import org.distorted.effects.EffectController;
30 29
import org.distorted.objects.ObjectList;
31 30
import org.distorted.objects.TwistyObject;
......
267 266
    mObject    = cont.getObject();
268 267
    mController= cont;
269 268

  
270
    mObject.solve();
269
    mController.solve();
271 270

  
272 271
    mBasicAngle = mObject.getBasicAngle();
273 272

  
src/main/java/org/distorted/effects/solve/SolveEffect.java
66 66
  private EffectController mController;
67 67
  private int mDuration;
68 68
  private int mEffectReturned;
69
  private int[] mCubeEffectNumber, mNodeEffectNumber;
69
  private final int[] mCubeEffectNumber, mNodeEffectNumber;
70 70
  private int mPhase;
71 71

  
72 72
  TwistyObject mObject;
......
130 130
      {
131 131
      case 0: mEffectReturned = 0;
132 132
              mPhase          = 1;
133
              mObject.solve();
133
              mController.solve();
134 134
              createEffectsPhase1(mDuration);
135 135
              assignEffects(mPhase);
136 136
              break;
src/main/java/org/distorted/main/RubikPreRender.java
56 56
  private final RubikSurfaceView mView;
57 57
  private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation,
58 58
                  mSetQuat, mChangeObject, mSetupObject, mSolveObject, mScrambleObject,
59
                  mInitializeObject, mSetTextureMap, mResetAllTextureMaps;
59
                  mInitializeObject, mSetTextureMap, mResetAllTextureMaps, mSolve;
60 60
  private boolean mUIBlocked, mTouchBlocked;
61 61
  private boolean mIsSolved;
62 62
  private ObjectList mNextObject;
......
94 94
    mChangeObject         = false;
95 95
    mSetupObject          = false;
96 96
    mSolveObject          = false;
97
    mSolve                = false;
97 98
    mScrambleObject       = false;
98 99

  
99 100
    mOldObject = null;
......
299 300
    doEffectNow( BaseEffect.Type.SOLVE );
300 301
    }
301 302

  
303
///////////////////////////////////////////////////////////////////////////////////////////////////
304

  
305
  private void solveNow()
306
    {
307
    mSolve = false;
308
    mNewObject.solve();
309
    }
310

  
302 311
///////////////////////////////////////////////////////////////////////////////////////////////////
303 312

  
304 313
  private void initializeObjectNow()
......
599 608

  
600 609
  void preRender()
601 610
    {
611
    if( mSolve                 ) solveNow();
602 612
    if( mSetQuat               ) setQuatNow();
603 613
    if( mFinishRotation        ) finishRotationNow();
604 614
    if( mRemoveRotation        ) removeRotationNow();
......
655 665
    }
656 666

  
657 667
///////////////////////////////////////////////////////////////////////////////////////////////////
668
// this starts the Solve Effect
658 669

  
659 670
  public void solveObject()
660 671
    {
......
664 675
      }
665 676
    }
666 677

  
678
///////////////////////////////////////////////////////////////////////////////////////////////////
679
// this only sets the cubits state to solved
680

  
681
  public void solve()
682
    {
683
    mSolve = true;
684
    }
685

  
667 686
///////////////////////////////////////////////////////////////////////////////////////////////////
668 687

  
669 688
  public void resetAllTextureMaps()
src/main/java/org/distorted/objects/Cubit.java
123 123
      }
124 124
    }
125 125

  
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

  
128
  float[] getOrigPosition()
129
    {
130
    return mOrigPosition;
131
    }
132

  
133 126
///////////////////////////////////////////////////////////////////////////////////////////////////
134 127

  
135 128
  void modifyCurrentPosition(Static4D quat)
src/main/java/org/distorted/tutorials/TutorialPreRender.java
38 38
  private final TutorialSurfaceView mView;
39 39
  private boolean mFinishRotation, mRemoveRotation, mAddRotation,
40 40
                  mSetQuat, mChangeObject, mSetupObject, mSolveObject, mScrambleObject,
41
                  mInitializeObject, mResetAllTextureMaps, mRemovePatternRotation;
41
                  mInitializeObject, mResetAllTextureMaps, mRemovePatternRotation, mSolve;
42 42
  private boolean mUIBlocked, mTouchBlocked;
43 43
  private boolean mIsSolved;
44 44
  private ObjectList mNextObject;
......
66 66
    mChangeObject   = false;
67 67
    mSetupObject    = false;
68 68
    mSolveObject    = false;
69
    mSolve          = false;
69 70
    mScrambleObject = false;
70 71

  
71 72
    mOldObject      = null;
......
238 239
    doEffectNow( BaseEffect.Type.SOLVE );
239 240
    }
240 241

  
242
///////////////////////////////////////////////////////////////////////////////////////////////////
243

  
244
  private void solveNow()
245
    {
246
    mSolve = false;
247
    mNewObject.solve();
248
    }
249

  
241 250
///////////////////////////////////////////////////////////////////////////////////////////////////
242 251

  
243 252
  private void initializeObjectNow()
......
309 318

  
310 319
  void preRender()
311 320
    {
321
    if( mSolve                 ) solveNow();
312 322
    if( mSetQuat               ) setQuatNow();
313 323
    if( mFinishRotation        ) finishRotationNow();
314 324
    if( mRemoveRotation        ) removeRotationNow();
......
403 413
    }
404 414

  
405 415
///////////////////////////////////////////////////////////////////////////////////////////////////
416
// this starts the SolveEffect
406 417

  
407 418
  public void solveObject()
408 419
    {
......
412 423
      }
413 424
    }
414 425

  
426
///////////////////////////////////////////////////////////////////////////////////////////////////
427
// this only solves the object
428

  
429
  public void solve()
430
    {
431
    mSolve = true;
432
    }
433

  
415 434
///////////////////////////////////////////////////////////////////////////////////////////////////
416 435

  
417 436
  public void scrambleObject(int num)

Also available in: Unified diff