Project

General

Profile

« Previous | Next » 

Revision 08f92d82

Added by Leszek Koltunski almost 8 years ago

Skeleton of the new App: Vertex3D. So far just a copy of Matrix3D.

View differences:

src/main/java/org/distorted/examples/matrix3d/Matrix3DActivity.java
21 21

  
22 22
import org.distorted.library.Distorted;
23 23
import org.distorted.examples.R;
24
import org.distorted.library.EffectNames;
24 25

  
25 26
import android.app.Activity;
26 27
import android.os.Bundle;
......
35 36

  
36 37
public class Matrix3DActivity extends Activity implements OnSeekBarChangeListener
37 38
{
38
    public static final int MOVE   =0;
39
    public static final int SCALE  =1;
40
    public static final int ROTATE =2;
41
    public static final int SHEAR  =3;
42
	
43 39
    private SeekBar bar;
44 40
    private TextView textMove, textScale, textRotate, textShear;
45 41
    private int moveX, moveY, moveZ;
......
54 50
    private float frotateX, frotateY, frotateZ, frotateA;
55 51
    private float fshearX, fshearY, fshearZ;
56 52
    
57
    private int[] effects = new int[4];
53
    private EffectNames[] effects = new EffectNames[4];
58 54
    
59 55
///////////////////////////////////////////////////////////////////////////////////////////////////
60 56
    
......
70 66

  
71 67
    public void Default(View view)
72 68
      {
73
      effects[0] = MOVE;
74
      effects[1] = SCALE;
75
      effects[2] = ROTATE;
76
      effects[3] = SHEAR;
69
      effects[0] = EffectNames.MOVE;
70
      effects[1] = EffectNames.SCALE;
71
      effects[2] = EffectNames.ROTATE;
72
      effects[3] = EffectNames.SHEAR;
77 73
    
78 74
      moveX = 50;
79 75
      moveY = 50;
......
151 147

  
152 148
///////////////////////////////////////////////////////////////////////////////////////////////////
153 149

  
154
    private void moveUp(int effect)
150
    private void moveUp(EffectNames name)
155 151
      {
156 152
      int len = effects.length-1;	
157 153
      int index = -1;
158 154
      
159 155
      for(int i=0; i<=len; i++)	
160 156
        {
161
        if( effects[i]==effect ) 
157
        if( effects[i]==name )
162 158
          {
163 159
          index=i;
164 160
          break;
......
170 166
        for(int i=0; i<len; i++)
171 167
          effects[i] = effects[i+1];
172 168
    	
173
        effects[len] = effect;
169
        effects[len] = name;
174 170
        }
175 171
      else if( index>0 )
176 172
        {
177 173
        effects[index]   = effects[index-1];
178
        effects[index-1] = effect;
174
        effects[index-1] = name;
179 175
        }
180 176
      
181 177
      addViews();
......
185 181

  
186 182
    public void ButtonMove(View v)
187 183
      {
188
      moveUp(MOVE); 	
184
      moveUp(EffectNames.MOVE);
189 185
      }
190 186

  
191 187
///////////////////////////////////////////////////////////////////////////////////////////////////
192 188

  
193 189
    public void ButtonScale(View v)
194 190
      {
195
      moveUp(SCALE); 	
191
      moveUp(EffectNames.SCALE);
196 192
      }
197 193
    
198 194
///////////////////////////////////////////////////////////////////////////////////////////////////
199 195

  
200 196
    public void ButtonRotate(View v)
201 197
      {
202
      moveUp(ROTATE); 	
198
      moveUp(EffectNames.ROTATE);
203 199
      }
204 200

  
205 201
///////////////////////////////////////////////////////////////////////////////////////////////////
206 202

  
207 203
    public void ButtonShear(View v)
208 204
      {
209
      moveUp(SHEAR); 	
205
      moveUp(EffectNames.SHEAR);
210 206
      }
211 207
 
212 208
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff