Project

General

Profile

« Previous | Next » 

Revision 42772cff

Added by Leszek Koltunski over 4 years ago

RubikCube: major progress with a separate RubikSettingsEnum enum - has been introduced into RubikActivity & RubikRenderer.

View differences:

src/main/java/org/distorted/magic/RubikRenderer.java
56 56
    private RubikCube mOldCube, mNewCube;
57 57
    private int mScreenWidth, mScreenHeight;
58 58
    private MeshFlat mMesh;
59
    private SizeChangeEffect.Type mSizeChangeType;
60
    private SolveEffect.Type mSolveType;
61
    private ScrambleEffect.Type mScrambleType;
62
    private int mSizeChangeDuration, mSolveDuration, mScrambleDuration;
59
    private int[] mPos;
60
    private int[] mType;
63 61

  
64 62
///////////////////////////////////////////////////////////////////////////////////////////////////
65 63

  
......
92 90
      mCanScramble = true;
93 91
      mCanSolve    = true;
94 92

  
95
      mSizeChangeType= SizeChangeEffect.Type.TRANSPARENCY;
96
      mSolveType     = SolveEffect.Type.SPIN;
97
      mScrambleType  = ScrambleEffect.Type.NONE;
93
      mPos  = new int[RubikSettingsEnum.LENGTH];
94
      mType = new int[RubikSettingsEnum.LENGTH];
98 95

  
99
      mSizeChangeDuration= 1000;
100
      mSolveDuration     = 1000;
101
      mScrambleDuration  = 1000;
96
      for (int i=0; i<RubikSettingsEnum.LENGTH; i++)
97
        {
98
        mPos[i] = 1000;
99
        }
102 100

  
103 101
      mMesh= new MeshFlat(20,20);
104 102
      mNextCubeSize =RubikActivity.getSize();
......
247 245
     {
248 246
     try
249 247
       {
250
       SizeChangeEffect effect = SizeChangeEffect.create(mSizeChangeType);
251
       mSizeChangeEffectID = effect.start(mSizeChangeDuration,mScreen,mOldCube,mNewCube,this);
248
       SizeChangeEffect effect = SizeChangeEffect.create(mType[0]);
249
       mSizeChangeEffectID = effect.start(mPos[0],mScreen,mOldCube,mNewCube,this);
252 250
       }
253 251
     catch(Exception ex)
254 252
       {
......
279 277

  
280 278
///////////////////////////////////////////////////////////////////////////////////////////////////
281 279

  
282
   void setSizeChangeDuration(int duration)
283
     {
284
     mSizeChangeDuration = duration;
285
     }
286

  
287
///////////////////////////////////////////////////////////////////////////////////////////////////
288

  
289
   void setSolveDuration(int duration)
290
     {
291
     mSolveDuration = duration;
292
     }
293

  
294
///////////////////////////////////////////////////////////////////////////////////////////////////
295

  
296
   void setScrambleDuration(int duration)
297
     {
298
     mScrambleDuration = duration;
299
     }
300

  
301
///////////////////////////////////////////////////////////////////////////////////////////////////
302

  
303
   void setSizeChangeType(SizeChangeEffect.Type type)
304
     {
305
     mSizeChangeType = type;
306
     }
307

  
308
///////////////////////////////////////////////////////////////////////////////////////////////////
309

  
310
   void setSolveType(SolveEffect.Type type)
280
   void setPos(int index, int pos)
311 281
     {
312
     mSolveType = type;
282
     if( index>=0 && index<RubikSettingsEnum.LENGTH )  mPos[index] = pos;
313 283
     }
314 284

  
315 285
///////////////////////////////////////////////////////////////////////////////////////////////////
316 286

  
317
   void setScrambleType(ScrambleEffect.Type type)
287
   void setType(int index, int type)
318 288
     {
319
     mScrambleType = type;
289
     if( index>=0 && index<RubikSettingsEnum.LENGTH )  mType[index] = type;
320 290
     }
321 291

  
322 292
///////////////////////////////////////////////////////////////////////////////////////////////////
......
380 350
     {
381 351
     try
382 352
       {
383
       ScrambleEffect effect = ScrambleEffect.create(mScrambleType);
384
       mScrambleEffectID = effect.start(mScrambleDuration,mNewCube,mScrambleCubeNum,this);
353
       ScrambleEffect effect = ScrambleEffect.create(mType[2]);
354
       mScrambleEffectID = effect.start(mPos[2],mNewCube,mScrambleCubeNum,this);
385 355
       }
386 356
     catch(Exception ex)
387 357
       {
......
408 378
     {
409 379
     try
410 380
       {
411
       SolveEffect effect = SolveEffect.create(mSolveType);
412
       mSolveEffectID = effect.start(mSolveDuration,mScreen,mNewCube,this);
381
       SolveEffect effect = SolveEffect.create(mType[1]);
382
       mSolveEffectID = effect.start(mPos[1],mScreen,mNewCube,this);
413 383
       }
414 384
     catch(Exception ex)
415 385
       {

Also available in: Unified diff