Project

General

Profile

« Previous | Next » 

Revision e2c784bd

Added by Leszek Koltunski about 8 years ago

Tidy up 'Flag'

View differences:

src/main/java/org/distorted/examples/flag/FlagActivity.java
33 33

  
34 34
public class FlagActivity extends Activity implements SeekBar.OnSeekBarChangeListener
35 35
{
36
    private SeekBar barAmplitude, barLength, barAngleA, barAngleB;
37 36
    private TextView textAmplitude, textLength, textAngleA, textAngleB;
38
    private SeekBar barNoiseAmplitude, barNoiseLength, barNoiseAngleA, barNoiseAngleB;
39 37
    private TextView textNoiseAmplitude, textNoiseLength, textNoiseAngleA, textNoiseAngleB;
40

  
41
    private Static5D noise;
38
    private Static5D mNoise;
42 39
    private String mStr;
40

  
43 41
///////////////////////////////////////////////////////////////////////////////////////////////////
44 42
    
45 43
    @Override
......
48 46
      super.onCreate(savedState);
49 47
      setContentView(R.layout.flaglayout);
50 48

  
51
      noise = new Static5D(0,0,0,0,0);
52
      mStr = new String();
49
      mNoise = new Static5D(0,0,0,0,0);
53 50

  
54 51
      textAmplitude = (TextView)findViewById(R.id.flagAmplitude);
55 52
      textLength    = (TextView)findViewById(R.id.flagLength);
56 53
      textAngleA    = (TextView)findViewById(R.id.flagAngleA);
57 54
      textAngleB    = (TextView)findViewById(R.id.flagAngleB);
58 55

  
59
      barAmplitude  = (SeekBar)findViewById(R.id.flagSeekAmplitude);
60
      barLength     = (SeekBar)findViewById(R.id.flagSeekLength);
61
      barAngleA     = (SeekBar)findViewById(R.id.flagSeekAngleA);
62
      barAngleB     = (SeekBar)findViewById(R.id.flagSeekAngleB);
56
      SeekBar barAmplitude  = (SeekBar)findViewById(R.id.flagSeekAmplitude);
57
      SeekBar barLength     = (SeekBar)findViewById(R.id.flagSeekLength);
58
      SeekBar barAngleA     = (SeekBar)findViewById(R.id.flagSeekAngleA);
59
      SeekBar barAngleB     = (SeekBar)findViewById(R.id.flagSeekAngleB);
63 60

  
64 61
      barAmplitude.setOnSeekBarChangeListener(this);
65 62
      barLength.setOnSeekBarChangeListener(this);
......
76 73
      textNoiseAngleA    = (TextView)findViewById(R.id.flagNoiseAngleA);
77 74
      textNoiseAngleB    = (TextView)findViewById(R.id.flagNoiseAngleB);
78 75

  
79
      barNoiseAmplitude  = (SeekBar)findViewById(R.id.flagSeekNoiseAmplitude);
80
      barNoiseLength     = (SeekBar)findViewById(R.id.flagSeekNoiseLength);
81
      barNoiseAngleA     = (SeekBar)findViewById(R.id.flagSeekNoiseAngleA);
82
      barNoiseAngleB     = (SeekBar)findViewById(R.id.flagSeekNoiseAngleB);
76
      SeekBar barNoiseAmplitude  = (SeekBar)findViewById(R.id.flagSeekNoiseAmplitude);
77
      SeekBar barNoiseLength     = (SeekBar)findViewById(R.id.flagSeekNoiseLength);
78
      SeekBar barNoiseAngleA     = (SeekBar)findViewById(R.id.flagSeekNoiseAngleA);
79
      SeekBar barNoiseAngleB     = (SeekBar)findViewById(R.id.flagSeekNoiseAngleB);
83 80

  
84 81
      barNoiseAmplitude.setOnSeekBarChangeListener(this);
85 82
      barNoiseLength.setOnSeekBarChangeListener(this);
86 83
      barNoiseAngleA.setOnSeekBarChangeListener(this);
87 84
      barNoiseAngleB.setOnSeekBarChangeListener(this);
88 85

  
89
      barNoiseAmplitude.setProgress( (int)noise.getX() );
90
      barNoiseLength.setProgress   ( (int)noise.getY() );
91
      barNoiseAngleA.setProgress   ( (int)noise.getW() );
92
      barNoiseAngleB.setProgress   ( (int)noise.getV() );
86
      barNoiseAmplitude.setProgress( (int)mNoise.getX() );
87
      barNoiseLength.setProgress   ( (int)mNoise.getY() );
88
      barNoiseAngleA.setProgress   ( (int)mNoise.getW() );
89
      barNoiseAngleB.setProgress   ( (int)mNoise.getV() );
93 90

  
94 91
      textNoiseAmplitude.setText("Noise 0.00");
95 92
      textNoiseLength.setText("Noise 0.00");
......
150 147
        case R.id.flagSeekAmplitude     : renderer.setAmplitude(progress);
151 148
                                          textAmplitude.setText("Amplitude "+progress);
152 149
                                          break;
153
        case R.id.flagSeekNoiseAmplitude: noise.set1((float)progress/100);
154
                                          renderer.setNoise(noise);
150
        case R.id.flagSeekNoiseAmplitude: mNoise.set1((float)progress/100);
151
                                          renderer.setNoise(mNoise);
155 152
                                          convert(progress);
156 153
                                          textNoiseAmplitude.setText("Noise "+mStr );
157 154
                                          break;
......
159 156
                                          renderer.setLength(progress);
160 157
                                          textLength.setText("Length "+progress);
161 158
                                          break;
162
        case R.id.flagSeekNoiseLength   : noise.set2((float)progress/100);
163
                                          renderer.setNoise(noise);
159
        case R.id.flagSeekNoiseLength   : mNoise.set2((float)progress/100);
160
                                          renderer.setNoise(mNoise);
164 161
                                          convert(progress);
165 162
                                          textNoiseLength.setText("Noise "+mStr );
166 163
                                          break;
......
168 165
                                          renderer.setAngleA(progress);
169 166
                                          textAngleA.setText("Alpha "+progress);
170 167
                                          break;
171
        case R.id.flagSeekNoiseAngleA   : noise.set4((float)progress/100);
172
                                          renderer.setNoise(noise);
168
        case R.id.flagSeekNoiseAngleA   : mNoise.set4((float)progress/100);
169
                                          renderer.setNoise(mNoise);
173 170
                                          convert(progress);
174 171
                                          textNoiseAngleA.setText("Noise "+mStr );
175 172
                                          break;
......
177 174
                                          renderer.setAngleB(progress);
178 175
                                          textAngleB.setText("Beta "+progress);
179 176
                                          break;
180
        case R.id.flagSeekNoiseAngleB   : noise.set5((float)progress/100);
181
                                          renderer.setNoise(noise);
177
        case R.id.flagSeekNoiseAngleB   : mNoise.set5((float)progress/100);
178
                                          renderer.setNoise(mNoise);
182 179
                                          convert(progress);
183 180
                                          textNoiseAngleB.setText("Noise "+mStr );
184 181
                                          break;
src/main/java/org/distorted/examples/flag/FlagRenderer.java
55 55
    private Static5D mWaveSta1, mWaveSta2;
56 56

  
57 57
    Static4D mQuat1, mQuat2;
58

  
59 58
    int mScreenMin;
60 59
    
61 60
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff