Project

General

Profile

« Previous | Next » 

Revision 3a438b27

Added by Leszek Koltunski over 7 years ago

Progress with any depth MeshCubes.

View differences:

src/main/java/org/distorted/examples/cubes/CubesActivity.java
45 45

  
46 46
    private int mNumCols = 3;
47 47
    private int mNumRows = 3;
48
    private NumberPicker mColsPicker, mRowsPicker;
48
    private int mNumSlic = 1;
49
    private NumberPicker mColsPicker, mRowsPicker, mSlicPicker;
49 50
    private LinearLayout mLay;
50 51
    private boolean[] mShape;
51 52
    private DistortedTexture mTexture;
......
64 65
      
65 66
      mColsPicker = (NumberPicker)findViewById(R.id.cubespicker_cols);
66 67
      mRowsPicker = (NumberPicker)findViewById(R.id.cubespicker_rows);
67
      
68
      mSlicPicker = (NumberPicker)findViewById(R.id.cubespicker_slices);
69

  
68 70
      mColsPicker.setMaxValue(40);
69 71
      mColsPicker.setMinValue( 0);
70 72
      mRowsPicker.setMaxValue(40);
71 73
      mRowsPicker.setMinValue( 0);
72
     
74
      mSlicPicker.setMaxValue(40);
75
      mSlicPicker.setMinValue( 0);
76

  
73 77
      mColsPicker.setOnValueChangedListener(new OnValueChangeListener() 
74 78
         {
75 79
         @Override
......
87 91
           setGrid();
88 92
           }
89 93
         });
94

  
95
      mSlicPicker.setOnValueChangedListener(new OnValueChangeListener()
96
         {
97
         @Override
98
         public void onValueChange(NumberPicker picker, int oldVal, int newVal)
99
           {
100
           mNumSlic = mSlicPicker.getValue();
101
           }
102
         });
90 103
      }
91 104

  
92 105
///////////////////////////////////////////////////////////////////////////////////////////////////
......
155 168

  
156 169
      mColsPicker.setValue(mNumCols);
157 170
      mRowsPicker.setValue(mNumRows);
158
      
171
      mSlicPicker.setValue(mNumSlic);
172

  
159 173
      if( hasFocus ) setGrid();
160 174
      }
161 175
    
......
200 214
      for(int i=0; i<mNumRows*mNumCols; i++)
201 215
        str += mShape[i] ? "1" : "0";
202 216

  
203
      mMesh = new MeshCubes(mNumCols, str, 1);
217
      mMesh = new MeshCubes(mNumCols, str, mNumSlic);
204 218
      mTexture = new DistortedTexture(mNumCols,mNumRows);
205 219

  
206 220
      setContentView(R.layout.cubeslayout);
src/main/res/layout/cubespickerlayout.xml
26 26
               android:descendantFocusability="blocksDescendants"
27 27
           />
28 28

  
29
           <NumberPicker
30
               android:id="@+id/cubespicker_slices"
31
               android:layout_width="wrap_content"
32
               android:layout_height="wrap_content"
33
               android:orientation="vertical"
34
               android:descendantFocusability="blocksDescendants"
35
           />
29 36
           <Button
30 37
               android:id="@+id/cubespicker_create"
31 38
               android:onClick="Create"

Also available in: Unified diff