Project

General

Profile

« Previous | Next » 

Revision 63ebcf3a

Added by Leszek Koltunski 23 days ago

progress

View differences:

src/main/java/org/distorted/helpers/MovesController.java
17 17
import android.widget.LinearLayout;
18 18

  
19 19
import org.distorted.objectlib.helpers.MovesFinished;
20
import org.distorted.objectlib.helpers.ObjectMove;
20 21
import org.distorted.objectlib.main.ObjectControl;
21 22

  
22 23
import org.distorted.main.R;
......
28 29
  private static final int MOVES_PLACE_0 = 100;
29 30
  private static final int MILLIS_PER_DEGREE = 6;
30 31

  
31
  private static class Move
32
    {
33
    private final int mAxis, mRow, mAngle;
34

  
35
    Move(int axis, int row, int angle)
36
      {
37
      mAxis = axis;
38
      mRow  = row;
39
      mAngle= angle;
40
      }
41
    }
42

  
43
  private final ArrayList<Move> mMoves;
32
  private final ArrayList<ObjectMove> mMoves;
44 33
  private boolean mCanPrevMove;
45 34
  private ObjectControl mControl;
46 35
  private TransparentImageButton mPrevButton;
......
71 60

  
72 61
      if( numMoves>0 )
73 62
        {
74
        Move move = mMoves.remove(numMoves-1);
75
        int axis  = move.mAxis;
76
        int angle = move.mAngle;
63
        ObjectMove move = mMoves.remove(numMoves-1);
64
        int angle = move.getAngle();
77 65

  
78 66
        if( angle!=0 )
79 67
          {
80 68
          mCanPrevMove = false;
81 69
          mControl = control;
82 70
          mControl.blockTouch(MOVES_PLACE_0);
83
          mControl.addRotation(this, axis, (1<<move.mRow), -angle, MILLIS_PER_DEGREE);
71
          mControl.addBackwardRotation(this, move, MILLIS_PER_DEGREE);
84 72
          }
85 73
        else
86 74
          {
......
112 100
  public void addMove(Activity act, int axis, int row, int angle)
113 101
    {
114 102
    if( mMoves.isEmpty() ) changeBackMove(act,true);
115
    mMoves.add(new Move(axis,row,angle));
103
    mMoves.add(new ObjectMove(axis,1<<row,angle));
116 104
    }
117 105

  
118 106
///////////////////////////////////////////////////////////////////////////////////////////////////
......
165 153

  
166 154
      for(int m=0; m<numMoves; m++)
167 155
        {
168
        Move move = mMoves.get(m);
156
        ObjectMove move = mMoves.get(m);
169 157

  
170 158
        if( m>0 ) moves.append(' ');
171
        moves.append(move.mAxis);
159
        moves.append(move.getAxis());
172 160
        moves.append(' ');
173
        moves.append(move.mRow);
161
        moves.append(move.getRow());
174 162
        moves.append(' ');
175
        moves.append(move.mAngle);
163
        moves.append(move.getAngle());
176 164
        }
177 165

  
178 166
      editor.putString( key, moves.toString() );
src/main/java/org/distorted/solvers/ScreenSolutionMultiphased.java
445 445
        ObjectMove move = mMoves[mCurrPhase][--mCurrMove];
446 446
        ObjectControl control = act.getControl();
447 447
        control.blockTouch(MOVES_PLACE_0);
448
        control.addRotation(this, move.getAxis(), move.getRowBitmap(), -move.getAngle(), MILLIS_PER_DEGREE);
448
        control.addBackwardRotation(this, move, MILLIS_PER_DEGREE);
449 449
        }
450 450
      else if( mCurrPhase>0 )
451 451
        {
......
483 483
        ObjectMove move = mMoves[mCurrPhase][mCurrMove++];
484 484
        ObjectControl control = act.getControl();
485 485
        control.blockTouch(MOVES_PLACE_1);
486
        control.addRotation(this, move.getAxis(), move.getRowBitmap(), move.getAngle(), MILLIS_PER_DEGREE);
486
        control.addForwardRotation(this, move, MILLIS_PER_DEGREE);
487 487
        if( mCurrMove==mNumMoves && mCurrPhase==mNumPhases-1 ) glowCubits(mCubitsNotInvolved[mCurrPhase]);
488 488
        }
489 489
      else if( mCurrPhase<mNumPhases-1 )
src/main/java/org/distorted/solvers/ScreenSolutionSinglephased.java
191 191
        }
192 192
      else
193 193
        {
194
        int axis      = mMoves[mCurrMove-1].getAxis();
195
		int rowBitmap = mMoves[mCurrMove-1].getRowBitmap();
196
		int bareAngle = mMoves[mCurrMove-1].getAngle();
194
        int bareAngle = mMoves[mCurrMove-1].getAngle();
197 195

  
198 196
        if( bareAngle!=0 )
199 197
          {
200 198
          mCanRotate = false;
201
          control.addRotation(this, axis, rowBitmap, bareAngle, MILLIS_PER_DEGREE);
199
          control.addForwardRotation(this, mMoves[mCurrMove-1], MILLIS_PER_DEGREE);
202 200
          }
203 201
        else
204 202
          {
......
227 225
        }
228 226
      else
229 227
        {
230
        int axis      = mMoves[mCurrMove].getAxis();
231
	    int rowBitmap = mMoves[mCurrMove].getRowBitmap();
232
	    int bareAngle = mMoves[mCurrMove].getAngle();
228
        int bareAngle = mMoves[mCurrMove].getAngle();
233 229

  
234 230
        if( bareAngle!=0 )
235 231
          {
236 232
          mCanRotate = false;
237
          control.addRotation(this, axis, rowBitmap, -bareAngle, MILLIS_PER_DEGREE);
233
          control.addBackwardRotation(this, mMoves[mCurrMove], MILLIS_PER_DEGREE);
238 234
          }
239 235
        else
240 236
          {

Also available in: Unified diff