Project

General

Profile

« Previous | Next » 

Revision fe3c72ce

Added by Leszek Koltunski over 7 years ago

remote unneeded 'static' variables and methods from the 'Dynamic' app

View differences:

src/main/java/org/distorted/examples/dynamic/DynamicActivity.java
73 73
      {
74 74
      super.onResume();
75 75
      
76
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
77
      mView.onResume();
76
      GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
77
      view.onResume();
78 78
      }
79 79

  
80 80
///////////////////////////////////////////////////////////////////
81 81
    @Override
82 82
    protected void onPause() 
83 83
      {
84
      GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
85
      mView.onPause();
84
      GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
85
      view.onPause();
86 86
         
87 87
      super.onPause();
88 88
      }
......
106 106
    
107 107
    public void Loop(View v)
108 108
      {
109
      DynamicSurfaceView.setMode(Dynamic1D.MODE_LOOP);
109
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
110
      view.setMode(Dynamic1D.MODE_LOOP);
110 111
      }     
111 112
    
112 113
///////////////////////////////////////////////////////////////////
113 114

  
114 115
    public void Path(View v)
115 116
      {
116
      DynamicSurfaceView.setMode(Dynamic1D.MODE_PATH);
117
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
118
      view.setMode(Dynamic1D.MODE_PATH);
117 119
      }  
118 120

  
119 121
///////////////////////////////////////////////////////////////////
120 122

  
121 123
    public void Jump(View v)
122 124
      {
123
      DynamicSurfaceView.setMode(Dynamic1D.MODE_JUMP);
125
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
126
      view.setMode(Dynamic1D.MODE_JUMP);
124 127
      }  
125 128
    
126 129
///////////////////////////////////////////////////////////////////
127 130

  
128 131
    public void Dim1D(View v)
129 132
      {
130
      DynamicSurfaceView.setDimension(DynamicSurfaceView.DIM_1D);
133
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
134
      view.setDimension(DynamicSurfaceView.DIM_1D);
131 135
      }  
132 136

  
133 137
///////////////////////////////////////////////////////////////////
134 138

  
135 139
    public void Dim2D(View v)
136 140
      {
137
      DynamicSurfaceView.setDimension(DynamicSurfaceView.DIM_2D);
141
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
142
      view.setDimension(DynamicSurfaceView.DIM_2D);
138 143
      }  
139 144
    
140 145
///////////////////////////////////////////////////////////////////
141 146

  
142 147
    public void Dim3DXY(View v)
143 148
      {
144
      DynamicSurfaceView.setDimension(DynamicSurfaceView.DIM_3DXY);
149
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
150
      view.setDimension(DynamicSurfaceView.DIM_3DXY);
145 151
      }  
146 152

  
147 153
///////////////////////////////////////////////////////////////////
148 154

  
149 155
    public void Dim3DXZ(View v)
150 156
      {
151
      DynamicSurfaceView.setDimension(DynamicSurfaceView.DIM_3DXZ);
157
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
158
      view.setDimension(DynamicSurfaceView.DIM_3DXZ);
152 159
      }  
153 160
    
154 161
///////////////////////////////////////////////////////////////////
155 162
    
156 163
    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
157 164
      {
165
      DynamicSurfaceView view = (DynamicSurfaceView) this.findViewById(R.id.dynamicSurfaceView);
158 166
      int id = bar.getId();
159 167

  
160 168
      if( id == R.id.dynamicSeekDuration )
......
162 170
        float v = progress*200;
163 171
        int i = (int)(v/100);
164 172
        float t = i/10.0f;
165
        DynamicSurfaceView.setDuration((int)v);
173
        view.setDuration((int)v);
166 174
        textD.setText("Duration: "+(int)t+" s");
167 175
        }
168 176
      else
......
174 182
          case R.id.dynamicSeekNoise2  : progress2 = progress; break;
175 183
          }
176 184

  
177
        DynamicSurfaceView.setNoise(progress0/100.0f,progress1/100.0f,progress2/100.0f);
185
        view.setNoise(progress0/100.0f,progress1/100.0f,progress2/100.0f);
178 186
        textN.setText("Noise: "+(progress0/100.f)+" "+(progress1/100.f)+" "+(progress2/100.f));
179 187
        }
180 188
      }
src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java
36 36

  
37 37
class DynamicRenderer implements GLSurfaceView.Renderer
38 38
   {  
39
   private GLSurfaceView mView;
39
   private DynamicSurfaceView mView;
40 40
   private DistortedBitmap mBackground;
41 41
   private Canvas mCanvas;
42 42
   private Bitmap mBitmap;
......
46 46
    
47 47
///////////////////////////////////////////////////////////////////////////////////////////////////
48 48

  
49
   DynamicRenderer(GLSurfaceView v)
49
   DynamicRenderer(DynamicSurfaceView v)
50 50
     {    
51 51
     mPaint = new Paint();
52 52
     mPaint.setAntiAlias(true);
......
83 83
     mCanvas = new Canvas(mBitmap);
84 84

  
85 85
     Distorted.onSurfaceChanged(texW,texH);
86
     DynamicSurfaceView.onSurfaceChanged(texW,texH);
86
     mView.onSurfaceChanged(texW,texH);
87 87
     }
88 88
   
89 89
///////////////////////////////////////////////////////////////////////////////////////////////////
......
95 95
     long time = System.currentTimeMillis();
96 96
      
97 97
     mCanvas.drawRect(0, 0, texW, texH, mPaint);
98
     DynamicSurfaceView.drawCurve(mCanvas,time);
98
     mView.drawCurve(mCanvas,time);
99 99
     mBackground.setBitmap(mBitmap);
100 100
     mBackground.draw(time);
101 101
     }
src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java
44 44
    public static final int DIM_3DXY = 2; 
45 45
    public static final int DIM_3DXZ = 3; 
46 46

  
47
    private static final int NUM_POINTS = 500;
47
    private static final int NUM_POINTS = 250;
48 48
    private static final int MAX_POINTS =   6;
49 49

  
50 50
    private static final Object lock = new Object();
51 51

  
52
    private static Dynamic1D di1D;
53
    private static Dynamic2D di2D;
54
    private static Dynamic3D di3D;
52
    private Dynamic1D di1D;
53
    private Dynamic2D di2D;
54
    private Dynamic3D di3D;
55 55
    
56
    private static Paint mPaint;
57
    private static int moving;
58
    private static int mDuration;
59
    private static int mPosition;
60
    private static float mNoise0, mNoise1, mNoise2;
56
    private Paint mPaint;
57
    private int moving;
58
    private int mDuration;
59
    private int mPosition;
60
    private float mNoise0, mNoise1, mNoise2;
61 61

  
62
    private static int mSize1, mSize2, mSizeT, mAvg;
62
    private int mSize1, mSize2, mSizeT, mAvg;
63 63

  
64
    private static int currentDim= DIM_2D;
64
    private int currentDim= DIM_2D;
65 65
    
66
    private static Static1D p1D;
67
    private static Static2D p2D;
68
    private static Static3D p3D;
66
    private Static1D p1D;
67
    private Static2D p2D;
68
    private Static3D p3D;
69 69

  
70
    private static Static1D p1N;
71
    private static Static2D p2N;
72
    private static Static3D p3N;
70
    private Static1D p1N;
71
    private Static2D p2N;
72
    private Static3D p3N;
73 73

  
74
    private static float[] mPoints = new float[3*NUM_POINTS];
74
    private float[] mPoints = new float[3*NUM_POINTS];
75 75
      
76 76
///////////////////////////////////////////////////////////////////
77 77
    
......
116 116

  
117 117
///////////////////////////////////////////////////////////////////////////////////////////////////
118 118

  
119
    public static void onSurfaceChanged(int width,int height)
119
    public void onSurfaceChanged(int width,int height)
120 120
      {
121 121
      mAvg = (width+height)/2;
122 122

  
......
131 131

  
132 132
///////////////////////////////////////////////////////////////////
133 133

  
134
    public static void setMode(int mode)
134
    public void setMode(int mode)
135 135
      {
136 136
      di1D.setMode(mode);  
137 137
      di2D.setMode(mode);
......
140 140

  
141 141
///////////////////////////////////////////////////////////////////
142 142

  
143
    public static void setDuration(int duration)
143
    public void setDuration(int duration)
144 144
      {
145 145
      mDuration = duration;
146 146
      
......
151 151

  
152 152
///////////////////////////////////////////////////////////////////
153 153

  
154
    public static void setNoise(float noise0, float noise1, float noise2)
154
    public void setNoise(float noise0, float noise1, float noise2)
155 155
      {
156 156
      mNoise0 = noise0;
157 157
      mNoise1 = noise1;
......
168 168
    
169 169
///////////////////////////////////////////////////////////////////
170 170

  
171
    public static void setDimension(int dim)
171
    public void setDimension(int dim)
172 172
      {
173 173
      if( currentDim != dim )
174 174
        {
......
190 190
    
191 191
///////////////////////////////////////////////////////////////////
192 192
    
193
    public static void drawCurve(Canvas c, long time)
193
    public void drawCurve(Canvas c, long time)
194 194
      {
195 195
      if ( ++mPosition >= NUM_POINTS ) mPosition=0;
196 196
         
......
207 207

  
208 208
///////////////////////////////////////////////////////////////////
209 209

  
210
    private static void clearPoints()
210
    private void clearPoints()
211 211
      {
212 212
      for(int i=0; i<3*NUM_POINTS; i++)
213 213
         {
......
217 217

  
218 218
///////////////////////////////////////////////////////////////////
219 219

  
220
    private static void drawCurve1D(Canvas c, long time)
220
    private void drawCurve1D(Canvas c, long time)
221 221
      {
222 222
      int len = di1D.getNumPoints();   
223 223
      mPaint.setColor(0xff000000);
......
250 250
    
251 251
///////////////////////////////////////////////////////////////////
252 252
      
253
    private static void drawCurve2D(Canvas c, long time)
253
    private void drawCurve2D(Canvas c, long time)
254 254
      {
255 255
      int len = di2D.getNumPoints();   
256 256
      mPaint.setColor(0xff000000);
......
286 286

  
287 287
///////////////////////////////////////////////////////////////////
288 288
      
289
    private static void drawCurve3D(Canvas c, long time)
289
    private void drawCurve3D(Canvas c, long time)
290 290
      {
291 291
      int len = di3D.getNumPoints();   
292 292
      mPaint.setColor(0xff000000);

Also available in: Unified diff