Project

General

Profile

« Previous | Next » 

Revision d12bb11b

Added by Leszek Koltunski about 4 years ago

Bugfixes - do more stuff 'post render'

View differences:

src/main/java/org/distorted/magic/RubikPostRender.java
42 42
    }
43 43

  
44 44
  private RubikSurfaceView mView;
45
  private boolean mFinishRotation, mRemoveRotation, mAddRotation, mSetQuatCurrent, mSetQuatAccumulated;
45
  private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation,
46
                  mSetQuatCurrent, mSetQuatAccumulated;
46 47
  private boolean mChangeObject, mSolveObject, mScrambleObject;
47 48
  private boolean mCanRotate, mCanDrag, mCanUI;
48 49
  private boolean mIsSolved;
......
60 61
  private int mAddRotationAxis, mAddRotationRowBitmap, mAddRotationAngle;
61 62
  private long mAddRotationDuration;
62 63
  private ActionFinishedListener mAddActionListener;
63
  private long mAddRotationID;
64
  private long mAddRotationID, mRemoveRotationID;
65
  private boolean mInitializeObject;
64 66

  
65 67
///////////////////////////////////////////////////////////////////////////////////////////////////
66 68

  
......
68 70
    {
69 71
    mView = view;
70 72

  
71
    mFinishRotation     = false;
72
    mRemoveRotation     = false;
73
    mAddRotation        = false;
74
    mSetQuatCurrent     = false;
75
    mSetQuatAccumulated = false;
76
    mChangeObject       = false;
77
    mSolveObject        = false;
78
    mScrambleObject     = false;
73
    mFinishRotation       = false;
74
    mRemoveRotation       = false;
75
    mRemovePatternRotation= false;
76
    mAddRotation          = false;
77
    mSetQuatCurrent       = false;
78
    mSetQuatAccumulated   = false;
79
    mChangeObject         = false;
80
    mSolveObject          = false;
81
    mScrambleObject       = false;
79 82

  
80 83
    mCanRotate   = true;
81 84
    mCanDrag     = true;
......
182 185
    mRemoveRotation = true;
183 186
    }
184 187

  
188
///////////////////////////////////////////////////////////////////////////////////////////////////
189

  
190
  private void removePatternRotation()
191
    {
192
    mRemovePatternRotation = true;
193
    }
194

  
195
///////////////////////////////////////////////////////////////////////////////////////////////////
196

  
197
  private void removePatternRotationNow()
198
    {
199
    mRemovePatternRotation=false;
200
    mNewObject.removeRotationNow();
201
    mAddActionListener.onActionFinished(mRemoveRotationID);
202
    }
203

  
185 204
///////////////////////////////////////////////////////////////////////////////////////////////////
186 205

  
187 206
  private void addRotationNow()
188 207
    {
189 208
    mAddRotation = false;
190

  
191 209
    mAddRotationID = mNewObject.addNewRotation( mAddRotationAxis, mAddRotationRowBitmap,
192 210
                                                mAddRotationAngle, mAddRotationDuration, this);
193 211
    }
......
252 270
    doEffectNow( BaseEffect.Type.SOLVE );
253 271
    }
254 272

  
273
///////////////////////////////////////////////////////////////////////////////////////////////////
274

  
275
  private void initializeObjectNow()
276
    {
277
    mInitializeObject = false;
278
    mNewObject.initializeObject(mNextMoves);
279
    }
280

  
255 281
///////////////////////////////////////////////////////////////////////////////////////////////////
256 282

  
257 283
  private void setQuatCurrentNow()
......
374 400

  
375 401
  void postRender()
376 402
    {
377
    if( mSetQuatCurrent     ) setQuatCurrentNow();
378
    if( mSetQuatAccumulated ) setQuatAccumulatedNow();
379
    if( mFinishRotation     ) finishRotationNow();
380
    if( mRemoveRotation     ) removeRotationNow();
381
    if( mChangeObject       ) changeObjectNow();
382
    if( mSolveObject        ) solveObjectNow();
383
    if( mScrambleObject     ) scrambleObjectNow();
384
    if( mAddRotation        ) addRotationNow();
403
    if( mSetQuatCurrent        ) setQuatCurrentNow();
404
    if( mSetQuatAccumulated    ) setQuatAccumulatedNow();
405
    if( mFinishRotation        ) finishRotationNow();
406
    if( mRemoveRotation        ) removeRotationNow();
407
    if( mRemovePatternRotation ) removePatternRotationNow();
408
    if( mChangeObject          ) changeObjectNow();
409
    if( mSolveObject           ) solveObjectNow();
410
    if( mScrambleObject        ) scrambleObjectNow();
411
    if( mAddRotation           ) addRotationNow();
412
    if( mInitializeObject      ) initializeObjectNow();
385 413
    }
386 414

  
387 415
///////////////////////////////////////////////////////////////////////////////////////////////////
......
399 427
    mAddRotationDuration  = duration;
400 428
    }
401 429

  
430
///////////////////////////////////////////////////////////////////////////////////////////////////
431

  
432
  public void initializeObject(int[][] moves)
433
    {
434
    mInitializeObject = true;
435
    mNextMoves = moves;
436
    }
437

  
402 438
///////////////////////////////////////////////////////////////////////////////////////////////////
403 439

  
404 440
  public RubikObject getObject()
......
432 468
    else if( effectID == mAddRotationID )
433 469
      {
434 470
      mAddRotationID = 0;
435
      mAddActionListener.onActionFinished(effectID);
471
      mRemoveRotationID = effectID;
472
      removePatternRotation();
436 473
      }
437 474
    else
438 475
      {

Also available in: Unified diff