Project

General

Profile

« Previous | Next » 

Revision a4472437

Added by Leszek Koltunski over 4 years ago

Progress with dragging.

View differences:

src/main/java/org/distorted/effects/objectchange/ObjectChangeEffectRound.java
36 36
    {
37 37
    float X = NODE_FBO_SIZE /3;
38 38

  
39
    mCubeEffectPosition[0] = new int[] {3,4};
39
    mCubeEffectPosition[0] = new int[] {2,3};
40 40
    mCubeEffects[0]        = new Effect[mCubeEffectPosition[0].length];
41 41

  
42 42
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
......
60 60
    {
61 61
    float X = NODE_FBO_SIZE /3;
62 62

  
63
    mCubeEffectPosition[1] = new int[] {3,4};
63
    mCubeEffectPosition[1] = new int[] {2,3};
64 64
    mCubeEffects[1]        = new Effect[mCubeEffectPosition[1].length];
65 65

  
66 66
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
src/main/java/org/distorted/effects/objectchange/ObjectChangeEffectScale.java
30 30
  {
31 31
  public int createEffectsPhase0(int duration)
32 32
    {
33
    mCubeEffectPosition[0] = new int[] {3};
33
    mCubeEffectPosition[0] = new int[] {2};
34 34
    mCubeEffects[0]        = new Effect[mCubeEffectPosition[0].length];
35 35

  
36 36
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
......
45 45

  
46 46
  public int createEffectsPhase1(int duration)
47 47
    {
48
    mCubeEffectPosition[1] = new int[] {3};
48
    mCubeEffectPosition[1] = new int[] {2};
49 49
    mCubeEffects[1]        = new Effect[mCubeEffectPosition[1].length];
50 50

  
51 51
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
src/main/java/org/distorted/effects/scramble/ScrambleEffectRotations.java
58 58
    {
59 59
    mCubeEffectNumber   = 2;
60 60
    mNodeEffectNumber   = 0;
61
    mCubeEffectPosition = new int[] {3,4};
61
    mCubeEffectPosition = new int[] {2,3};
62 62
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
63 63

  
64 64
    mRnd.setSeed(System.currentTimeMillis());
src/main/java/org/distorted/main/RubikSurfaceView.java
42 42
public class RubikSurfaceView extends GLSurfaceView
43 43
{
44 44
    private static final int NUM_SPEED_PROBES = 10;
45
    private static final int INVALID_POINTER_ID = -1;
45 46

  
46 47
    public static final int MODE_ROTATE  = 0;
47 48
    public static final int MODE_DRAG    = 1;
......
70 71
    private boolean mDragging, mBeginningRotation, mContinuingRotation;
71 72
    private int mScreenWidth, mScreenHeight, mScreenMin;
72 73

  
74
    private int mPtrID1, mPtrID2;
73 75
    private int mNumFingersDown;
74 76
    private float mX, mY;
75 77
    private float mStartRotX, mStartRotY;
......
457 459

  
458 460
    private void actionMove(MotionEvent event)
459 461
      {
460
      float x = (event.getX() - mScreenWidth*0.5f)/mScreenMin;
461
      float y = (mScreenHeight*0.5f -event.getY())/mScreenMin;
462
      int pointer = event.findPointerIndex(mPtrID1 != INVALID_POINTER_ID ? mPtrID1:mPtrID2);
462 463

  
463
      //android.util.Log.e("view", "num fingers: "+mNumFingersDown+" x="+event.getX()+" y="+event.getY());
464
      float pX = event.getX(pointer);
465
      float pY = event.getY(pointer);
466

  
467
      float x = (pX - mScreenWidth*0.5f)/mScreenMin;
468
      float y = (mScreenHeight*0.5f -pY)/mScreenMin;
464 469

  
465 470
      if( mBeginningRotation )
466 471
        {
......
488 493
    private void actionDown(MotionEvent event)
489 494
      {
490 495
      mNumFingersDown++;
496
      mPtrID1 = event.getPointerId(0);
491 497

  
492
      int index = event.getActionIndex();
493 498
      float x = event.getX();
494 499
      float y = event.getY();
495 500

  
496
      android.util.Log.e("view", "down1 num fingers: "+mNumFingersDown+" index="+index+" x="+x+" y="+y);
497

  
498 501
      mX = (x - mScreenWidth*0.5f)/mScreenMin;
499 502
      mY = (mScreenHeight*0.5f -y)/mScreenMin;
500 503

  
......
507 510
      {
508 511
      mNumFingersDown--;
509 512

  
510
      int index = event.getActionIndex();
511
      float x = event.getX();
512
      float y = event.getY();
513

  
514
      android.util.Log.e("view", "up1 num fingers: "+mNumFingersDown+" index="+index+" x="+x+" y="+y);
513
      mPtrID1 = INVALID_POINTER_ID;
514
      mPtrID2 = INVALID_POINTER_ID;
515 515

  
516 516
      if( mContinuingRotation )
517 517
        {
......
530 530
      {
531 531
      mNumFingersDown++;
532 532

  
533
      int index = event.getActionIndex();
534

  
535
      if( mPtrID1==INVALID_POINTER_ID )
536
        {
537
        mPtrID1 = event.getPointerId(index);
538
        float x = event.getX(index);
539
        float y = event.getY(index);
540

  
541
        mX = (x - mScreenWidth*0.5f)/mScreenMin;
542
        mY = (mScreenHeight*0.5f -y)/mScreenMin;
543
        }
544
      else if( mPtrID2==INVALID_POINTER_ID )
545
        {
546
        mPtrID2 = event.getPointerId(index);
547

  
548
        if( mBeginningRotation || mContinuingRotation )
549
          {
550
          float x = event.getX();
551
          float y = event.getY();
552

  
553
          mX = (x - mScreenWidth*0.5f)/mScreenMin;
554
          mY = (mScreenHeight*0.5f -y)/mScreenMin;
555
          }
556
        }
557

  
533 558
      if( mBeginningRotation )
534 559
        {
535 560
        mContinuingRotation = false;
......
540 565
        {
541 566
        finishRotation();
542 567
        }
543

  
544
      int index = event.getActionIndex();
545
      float x = event.getX();
546
      float y = event.getY();
547

  
548
      android.util.Log.e("view", "down2 num fingers: "+mNumFingersDown+" index="+index+" x="+x+" y="+y);
549 568
      }
550 569

  
551 570
///////////////////////////////////////////////////////////////////////////////////////////////////
......
555 574
      mNumFingersDown--;
556 575

  
557 576
      int index = event.getActionIndex();
558
      float x = event.getX();
559
      float y = event.getY();
560 577

  
561
      android.util.Log.e("view", "up2 num fingers: "+mNumFingersDown+" index="+index+" x="+x+" y="+y);
578
      if( index==0 )
579
        {
580
        mPtrID1 = INVALID_POINTER_ID;
581
        int pointer = event.findPointerIndex(mPtrID2);
582
        float x1 = event.getX(pointer);
583
        float y1 = event.getY(pointer);
584

  
585
        mX = (x1 - mScreenWidth*0.5f)/mScreenMin;
586
        mY = (mScreenHeight*0.5f -y1)/mScreenMin;
587
        }
588
      else
589
        {
590
        mPtrID2 = INVALID_POINTER_ID;
591
        }
562 592
      }
563 593

  
564 594
///////////////////////////////////////////////////////////////////////////////////////////////////
......
580 610
        mFirstIndex =0;
581 611
        mLastIndex  =0;
582 612

  
613
        mPtrID1 = INVALID_POINTER_ID;
614
        mPtrID2 = INVALID_POINTER_ID;
615

  
583 616
        mNumFingersDown = 0;
584 617

  
585 618
        mRenderer  = new RubikRenderer(this);
src/main/java/org/distorted/objects/RubikObject.java
622 622

  
623 623
    if( tmp!=0 ) return NEAREST*tmp;
624 624

  
625
    return speed> 1.5f ? NEAREST*(angle>0 ? 1:-1) : 0;
625
    return speed> 1.3f ? NEAREST*(angle>0 ? 1:-1) : 0;
626 626
    }
627 627

  
628 628
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff