Project

General

Profile

« Previous | Next » 

Revision 473611ee

Added by Leszek Koltunski about 4 years ago

Progress with the 3x3x3 Solver.

View differences:

src/main/java/org/distorted/main/RubikSurfaceView.java
32 32
import org.distorted.objects.RubikObject;
33 33
import org.distorted.objects.RubikObjectMovement;
34 34
import org.distorted.states.RubikState;
35
import org.distorted.states.RubikStateSolver;
35 36
import org.distorted.states.RubikStateSolving;
36 37

  
37 38
///////////////////////////////////////////////////////////////////////////////////////////////////
38 39

  
39 40
public class RubikSurfaceView extends GLSurfaceView
40 41
{
42
    public static final int MODE_ROTATE  = 0;
43
    public static final int MODE_DRAG    = 1;
44
    public static final int MODE_REPLACE = 2;
45

  
41 46
    // Moving the finger from the middle of the vertical screen to the right edge will rotate a
42 47
    // given face by SWIPING_SENSITIVITY/2 degrees.
43 48
    private final static int SWIPING_SENSITIVITY  = 240;
......
170 175

  
171 176
    private void setUpDragOrRotate(float x, float y)
172 177
      {
173
      if( !RubikState.canRotate() )
178
      int mode = RubikState.getMode();
179

  
180
      if( mode==MODE_DRAG )
174 181
        {
175 182
        mDragging           = true;
176 183
        mBeginningRotation  = false;
......
185 192
        if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint1,rotatedCamera) )
186 193
          {
187 194
          mDragging           = false;
188
          mBeginningRotation  = mPostRender.canRotate();
189 195
          mContinuingRotation = false;
196

  
197
          if( mode==MODE_ROTATE )
198
            {
199
            mBeginningRotation= mPostRender.canRotate();
200
            }
201
          else if( mode==MODE_REPLACE )
202
            {
203
            mBeginningRotation= false;
204
            RubikStateSolver solver = (RubikStateSolver) RubikState.SVER.getStateClass();
205
            int cubit = mMovement.getTouchedCubit();
206
            int face  = mMovement.getTouchedFace();
207
            int color = solver.getCurrentColor();
208
            mPostRender.setTextureMap( cubit, face, color );
209
            }
190 210
          }
191 211
        else
192 212
          {

Also available in: Unified diff