1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2016 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// Distorted is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Distorted is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.examples.effects3d;
|
21
|
|
22
|
import android.app.Activity;
|
23
|
import android.graphics.Bitmap;
|
24
|
import android.graphics.BitmapFactory;
|
25
|
import android.graphics.Canvas;
|
26
|
import android.graphics.Paint;
|
27
|
import android.opengl.GLSurfaceView;
|
28
|
import android.os.Bundle;
|
29
|
import android.view.Gravity;
|
30
|
import android.view.View;
|
31
|
import android.widget.AdapterView;
|
32
|
import android.widget.ArrayAdapter;
|
33
|
import android.widget.Button;
|
34
|
import android.widget.LinearLayout;
|
35
|
import android.widget.NumberPicker;
|
36
|
import android.widget.Spinner;
|
37
|
import android.widget.TableRow;
|
38
|
|
39
|
import org.distorted.examples.R;
|
40
|
import org.distorted.library.Distorted;
|
41
|
import org.distorted.library.DistortedBitmap;
|
42
|
import org.distorted.library.DistortedCubes;
|
43
|
import org.distorted.library.DistortedObject;
|
44
|
import org.distorted.library.EffectNames;
|
45
|
import org.distorted.library.EffectTypes;
|
46
|
|
47
|
import java.io.IOException;
|
48
|
import java.io.InputStream;
|
49
|
import java.util.ArrayList;
|
50
|
|
51
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
52
|
|
53
|
public class Effects3DActivity extends Activity
|
54
|
implements View.OnClickListener,
|
55
|
AdapterView.OnItemSelectedListener
|
56
|
{
|
57
|
private static final int COLOR_OFF = 0xffffe81f;
|
58
|
private static final int COLOR_ON = 0xff0000ff;
|
59
|
|
60
|
private boolean firstScreen;
|
61
|
|
62
|
// fields needed for the first 'pick-a-shape' screen
|
63
|
//
|
64
|
private int mNumCols = 10;
|
65
|
private int mNumRows = 10;
|
66
|
private NumberPicker mColsPicker, mRowsPicker;
|
67
|
private boolean[] mShape;
|
68
|
private DistortedObject mObject;
|
69
|
private int mObjectType;
|
70
|
private int mBitmapID;
|
71
|
private Bitmap mBitmap;
|
72
|
|
73
|
private ArrayList<Effects3DEffect> mEffects;
|
74
|
private int mEffectAdd;
|
75
|
private float mCenterX, mCenterY, mCenterZ;
|
76
|
private float mRegionX, mRegionY, mRegionR;
|
77
|
|
78
|
private EffectNames[] mEffectNames;
|
79
|
|
80
|
private static boolean mSupportsRegion;
|
81
|
private static boolean mSupportsCenter;
|
82
|
|
83
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
84
|
|
85
|
@Override
|
86
|
protected void onCreate(Bundle savedState)
|
87
|
{
|
88
|
super.onCreate(savedState);
|
89
|
|
90
|
mEffects = new ArrayList<>();
|
91
|
|
92
|
createEffectNames();
|
93
|
|
94
|
setContentView(R.layout.objectpickerlayout);
|
95
|
|
96
|
mColsPicker = (NumberPicker)findViewById(R.id.objectpicker_cols);
|
97
|
mRowsPicker = (NumberPicker)findViewById(R.id.objectpicker_rows);
|
98
|
|
99
|
mColsPicker.setMaxValue(40);
|
100
|
mColsPicker.setMinValue( 0);
|
101
|
mRowsPicker.setMaxValue(40);
|
102
|
mRowsPicker.setMinValue( 0);
|
103
|
|
104
|
mColsPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener()
|
105
|
{
|
106
|
@Override
|
107
|
public void onValueChange(NumberPicker picker, int oldVal, int newVal)
|
108
|
{
|
109
|
mNumCols = mColsPicker.getValue();
|
110
|
}
|
111
|
});
|
112
|
|
113
|
mRowsPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener()
|
114
|
{
|
115
|
@Override
|
116
|
public void onValueChange(NumberPicker picker, int oldVal, int newVal)
|
117
|
{
|
118
|
mNumRows = mRowsPicker.getValue();
|
119
|
}
|
120
|
});
|
121
|
|
122
|
firstScreen = true;
|
123
|
|
124
|
mObjectType = 0;
|
125
|
|
126
|
Spinner typeSpinner = (Spinner)findViewById(R.id.objectpicker_spinnerType);
|
127
|
typeSpinner.setOnItemSelectedListener(this);
|
128
|
|
129
|
String[] objectType = new String[] {"DistortedCubes", "DistortedBitmap"};
|
130
|
|
131
|
ArrayAdapter<String> adapterType = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType);
|
132
|
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
133
|
typeSpinner.setAdapter(adapterType);
|
134
|
|
135
|
Spinner bitmapSpinner = (Spinner)findViewById(R.id.objectpicker_spinnerBitmap);
|
136
|
bitmapSpinner.setOnItemSelectedListener(this);
|
137
|
|
138
|
String[] objectBitmap = new String[] { "Grid", "Girl", "Dog", "Cat", "Squares", "Bean", "Lisa"};
|
139
|
|
140
|
ArrayAdapter<String> adapterBitmap = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectBitmap);
|
141
|
adapterBitmap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
142
|
bitmapSpinner.setAdapter(adapterBitmap);
|
143
|
}
|
144
|
|
145
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
146
|
|
147
|
private void createEffectNames()
|
148
|
{
|
149
|
EffectTypes type1 = EffectTypes.FRAGMENT;
|
150
|
EffectTypes type2 = EffectTypes.VERTEX;
|
151
|
|
152
|
EffectNames[] names = EffectNames.values();
|
153
|
|
154
|
int numEffects=0;
|
155
|
|
156
|
for(int i=0; i<names.length; i++)
|
157
|
if( names[i].getType() == type1 || names[i].getType() == type2 ) numEffects++;
|
158
|
|
159
|
mEffectNames = new EffectNames[numEffects];
|
160
|
|
161
|
numEffects=0;
|
162
|
|
163
|
for(int i=0; i<names.length; i++)
|
164
|
if( names[i].getType() == type1 || names[i].getType() == type2 )
|
165
|
{
|
166
|
mEffectNames[numEffects++] = names[i];
|
167
|
}
|
168
|
}
|
169
|
|
170
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
171
|
|
172
|
private void setGrid()
|
173
|
{
|
174
|
LinearLayout lay = (LinearLayout)findViewById(R.id.objectpicker_buttongrid);
|
175
|
|
176
|
int width = lay.getWidth();
|
177
|
int height= lay.getHeight();
|
178
|
int w = mNumCols>0 ? (int)( 0.9f*width / mNumCols) : 0;
|
179
|
int h = mNumRows>0 ? (int)( 0.9f*height/ mNumRows) : 0;
|
180
|
int size= w<h ? w:h;
|
181
|
int pad = size<20 ? 1 : size/20;
|
182
|
|
183
|
lay.removeAllViews();
|
184
|
|
185
|
mShape = new boolean[mNumRows*mNumCols];
|
186
|
|
187
|
TableRow.LayoutParams p = new TableRow.LayoutParams();
|
188
|
|
189
|
p.rightMargin = pad;
|
190
|
p.leftMargin = pad;
|
191
|
p.topMargin = pad;
|
192
|
p.bottomMargin = pad;
|
193
|
p.height = size;
|
194
|
p.width = size;
|
195
|
|
196
|
for (int rows=0; rows<mNumRows; rows++)
|
197
|
{
|
198
|
TableRow tr = new TableRow(this);
|
199
|
tr.setGravity(Gravity.CENTER);
|
200
|
|
201
|
for(int cols=0; cols<mNumCols; cols++)
|
202
|
{
|
203
|
Button b = new Button(this);
|
204
|
b.setOnClickListener(this);
|
205
|
b.setId(rows*mNumCols+cols);
|
206
|
b.setLayoutParams(p);
|
207
|
b.setBackgroundColor(COLOR_ON);
|
208
|
tr.addView(b, p);
|
209
|
mShape[rows*mNumCols+cols] = true;
|
210
|
}
|
211
|
|
212
|
lay.addView(tr);
|
213
|
}
|
214
|
}
|
215
|
|
216
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
217
|
|
218
|
public DistortedObject getObject()
|
219
|
{
|
220
|
return mObject;
|
221
|
}
|
222
|
|
223
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
224
|
|
225
|
public static void setSupportsRegion(boolean supports)
|
226
|
{
|
227
|
mSupportsRegion = supports;
|
228
|
}
|
229
|
|
230
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
231
|
|
232
|
public static boolean supportsRegion()
|
233
|
{
|
234
|
return mSupportsRegion;
|
235
|
}
|
236
|
|
237
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
238
|
|
239
|
public static void setSupportsCenter(boolean supports)
|
240
|
{
|
241
|
mSupportsCenter = supports;
|
242
|
}
|
243
|
|
244
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
245
|
|
246
|
public static boolean supportsCenter()
|
247
|
{
|
248
|
return mSupportsCenter;
|
249
|
}
|
250
|
|
251
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
252
|
|
253
|
public Bitmap getBitmap()
|
254
|
{
|
255
|
if( mBitmap==null )
|
256
|
{
|
257
|
if( mBitmapID!=-1)
|
258
|
{
|
259
|
InputStream is = getResources().openRawResource(mBitmapID);
|
260
|
|
261
|
try
|
262
|
{
|
263
|
mBitmap = BitmapFactory.decodeStream(is);
|
264
|
}
|
265
|
finally
|
266
|
{
|
267
|
try
|
268
|
{
|
269
|
is.close();
|
270
|
}
|
271
|
catch(IOException e) { }
|
272
|
}
|
273
|
}
|
274
|
else
|
275
|
{
|
276
|
final int W = 640;
|
277
|
final int H = 640;
|
278
|
|
279
|
Paint paint = new Paint();
|
280
|
mBitmap = Bitmap.createBitmap(W,H, Bitmap.Config.ARGB_8888);
|
281
|
Canvas canvas = new Canvas(mBitmap);
|
282
|
|
283
|
paint.setAntiAlias(true);
|
284
|
paint.setTextAlign(Paint.Align.CENTER);
|
285
|
paint.setColor(0xff008800);
|
286
|
paint.setStyle(Paint.Style.FILL);
|
287
|
canvas.drawRect(0, 0, W, H, paint);
|
288
|
paint.setColor(0xffffffff);
|
289
|
|
290
|
for(int i=0; i<=mNumCols ; i++ )
|
291
|
{
|
292
|
canvas.drawRect(W*i/mNumCols - 1, 0, W*i/mNumCols + 1, H , paint);
|
293
|
canvas.drawRect( 0, H *i/mNumCols -1, W , H*i/mNumCols + 1, paint);
|
294
|
}
|
295
|
}
|
296
|
}
|
297
|
|
298
|
return mBitmap;
|
299
|
}
|
300
|
|
301
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
302
|
|
303
|
public void onClick(View view)
|
304
|
{
|
305
|
Button tmp = (Button)view;
|
306
|
int id = tmp.getId();
|
307
|
mShape[id] = !mShape[id];
|
308
|
tmp.setBackgroundColor(mShape[id] ? COLOR_ON:COLOR_OFF);
|
309
|
}
|
310
|
|
311
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
312
|
|
313
|
public void setRegion(float x, float y, float r)
|
314
|
{
|
315
|
mRegionX = x;
|
316
|
mRegionY =-y;
|
317
|
mRegionR = r;
|
318
|
|
319
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
320
|
|
321
|
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionR);
|
322
|
}
|
323
|
|
324
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
325
|
|
326
|
public void setCenter(float x, float y, float z)
|
327
|
{
|
328
|
mCenterX = x;
|
329
|
mCenterY = y;
|
330
|
mCenterZ = z;
|
331
|
|
332
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
333
|
|
334
|
view.getRenderer().setCenter( mCenterX, mCenterY, mCenterZ );
|
335
|
}
|
336
|
|
337
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
338
|
|
339
|
public float getCenterX()
|
340
|
{
|
341
|
return mCenterX;
|
342
|
}
|
343
|
|
344
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
345
|
|
346
|
public float getCenterY()
|
347
|
{
|
348
|
return mCenterY;
|
349
|
}
|
350
|
|
351
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
352
|
|
353
|
public float getCenterZ()
|
354
|
{
|
355
|
return mCenterZ;
|
356
|
}
|
357
|
|
358
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
359
|
|
360
|
public float getRegionX()
|
361
|
{
|
362
|
return mRegionX;
|
363
|
}
|
364
|
|
365
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
366
|
|
367
|
public float getRegionY()
|
368
|
{
|
369
|
return mRegionY;
|
370
|
}
|
371
|
|
372
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
373
|
|
374
|
public float getRegionR()
|
375
|
{
|
376
|
return mRegionR;
|
377
|
}
|
378
|
|
379
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
380
|
|
381
|
public void Continue(View v)
|
382
|
{
|
383
|
firstScreen = false;
|
384
|
|
385
|
Distorted.setMaxVertex(20); // those have to be called before
|
386
|
Distorted.setMaxFragment(3); // any DistortedObject gets created!
|
387
|
|
388
|
if( mObjectType==1 )
|
389
|
{
|
390
|
getBitmap();
|
391
|
mObject = new DistortedBitmap(mBitmap.getWidth(),mBitmap.getHeight(),mNumCols);
|
392
|
setEffectView();
|
393
|
}
|
394
|
else
|
395
|
{
|
396
|
View view = getLayoutInflater().inflate(R.layout.objectpicker2layout, null);
|
397
|
|
398
|
setContentView(view);
|
399
|
|
400
|
view.post(new Runnable() {
|
401
|
@Override
|
402
|
public void run() {
|
403
|
setGrid();
|
404
|
}
|
405
|
});
|
406
|
}
|
407
|
}
|
408
|
|
409
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
410
|
|
411
|
public void Create(View v)
|
412
|
{
|
413
|
firstScreen = false;
|
414
|
|
415
|
String str = "";
|
416
|
|
417
|
for(int i=0; i<mNumRows*mNumCols; i++)
|
418
|
str += mShape[i] ? "1" : "0";
|
419
|
|
420
|
mObject = new DistortedCubes(mNumCols, str, 10);
|
421
|
|
422
|
setEffectView();
|
423
|
}
|
424
|
|
425
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
426
|
|
427
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)
|
428
|
{
|
429
|
switch(parent.getId())
|
430
|
{
|
431
|
case R.id.objectpicker_spinnerType : mObjectType = pos;
|
432
|
break;
|
433
|
case R.id.objectpicker_spinnerBitmap: switch(pos)
|
434
|
{
|
435
|
case 0: mBitmapID = -1 ; break;
|
436
|
case 1: mBitmapID = R.raw.face; break;
|
437
|
case 2: mBitmapID = R.raw.dog ; break;
|
438
|
case 3: mBitmapID = R.raw.cat ; break;
|
439
|
case 4: mBitmapID = R.raw.grid; break;
|
440
|
case 5: mBitmapID = R.raw.bean; break;
|
441
|
case 6: mBitmapID = R.raw.monalisa; break;
|
442
|
}
|
443
|
break;
|
444
|
case R.id.effects3dspinner : mEffectAdd = pos;
|
445
|
break;
|
446
|
}
|
447
|
}
|
448
|
|
449
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
450
|
|
451
|
public void onNothingSelected(AdapterView<?> parent)
|
452
|
{
|
453
|
}
|
454
|
|
455
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
456
|
|
457
|
public int getWidth()
|
458
|
{
|
459
|
return mObject==null ? 0: mObject.getWidth();
|
460
|
}
|
461
|
|
462
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
463
|
|
464
|
public int getHeight()
|
465
|
{
|
466
|
return mObject==null ? 0: mObject.getHeight();
|
467
|
}
|
468
|
|
469
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
470
|
|
471
|
public int getDepth()
|
472
|
{
|
473
|
return mObject==null ? 0: mObject.getDepth();
|
474
|
}
|
475
|
|
476
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
477
|
|
478
|
public int getScreenWidth()
|
479
|
{
|
480
|
return 0;
|
481
|
}
|
482
|
|
483
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
484
|
|
485
|
public int getScreenHeight()
|
486
|
{
|
487
|
return 0;
|
488
|
}
|
489
|
|
490
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
491
|
|
492
|
private void resetData()
|
493
|
{
|
494
|
mCenterX = 0.5f*getWidth();
|
495
|
mCenterY = 0.5f*getHeight();
|
496
|
mRegionX = 0;
|
497
|
mRegionY = 0;
|
498
|
mRegionR = getWidth()/2;
|
499
|
|
500
|
mSupportsRegion = true;
|
501
|
mSupportsCenter =false;
|
502
|
}
|
503
|
|
504
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
505
|
// 'second screen' methods
|
506
|
|
507
|
private void setEffectView()
|
508
|
{
|
509
|
resetData();
|
510
|
|
511
|
final View view = getLayoutInflater().inflate(R.layout.effects3dlayout, null);
|
512
|
|
513
|
setContentView(view);
|
514
|
|
515
|
String[] effects = new String[mEffectNames.length];
|
516
|
|
517
|
for(int i=0; i<mEffectNames.length; i++) effects[i] = mEffectNames[i].name();
|
518
|
|
519
|
Spinner effectSpinner = (Spinner)findViewById(R.id.effects3dspinner );
|
520
|
effectSpinner.setOnItemSelectedListener(this);
|
521
|
|
522
|
ArrayAdapter<String> adapterEffect = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, effects);
|
523
|
adapterEffect.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
524
|
effectSpinner.setAdapter(adapterEffect);
|
525
|
|
526
|
mEffectAdd = 0;
|
527
|
}
|
528
|
|
529
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
530
|
|
531
|
public void newEffect(View v)
|
532
|
{
|
533
|
Effects3DEffect eff = new Effects3DEffect(mEffectNames[mEffectAdd], this);
|
534
|
mEffects.add(eff);
|
535
|
|
536
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
537
|
View view = eff.createView();
|
538
|
layout.addView(view);
|
539
|
|
540
|
if( mSupportsCenter )
|
541
|
{
|
542
|
View center = eff.createCenter();
|
543
|
layout.addView(center);
|
544
|
}
|
545
|
|
546
|
if( mSupportsRegion )
|
547
|
{
|
548
|
View region = eff.createRegion();
|
549
|
layout.addView(region);
|
550
|
}
|
551
|
|
552
|
eff.apply(mObject);
|
553
|
}
|
554
|
|
555
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
556
|
|
557
|
public void removeAll(View v)
|
558
|
{
|
559
|
mEffects.clear();
|
560
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
561
|
layout.removeAllViews();
|
562
|
mObject.abortEffects(EffectTypes.VERTEX);
|
563
|
mObject.abortEffects(EffectTypes.FRAGMENT);
|
564
|
|
565
|
resetData();
|
566
|
|
567
|
Effects3DSurfaceView view = (Effects3DSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
568
|
Effects3DRenderer renderer= view.getRenderer();
|
569
|
|
570
|
renderer.setCenter( mCenterX, mCenterY, mCenterZ );
|
571
|
renderer.setRegion( mRegionX, mRegionY, mRegionR );
|
572
|
renderer.mQuat1.set(0,0,0,1);
|
573
|
renderer.mQuat2.set(0,0,0,1);
|
574
|
}
|
575
|
|
576
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
577
|
|
578
|
public void remove(View v)
|
579
|
{
|
580
|
for(Effects3DEffect effect: mEffects)
|
581
|
{
|
582
|
if( effect.thisView(v) )
|
583
|
{
|
584
|
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout);
|
585
|
View view;
|
586
|
|
587
|
view = effect.getEffect();
|
588
|
if( view!=null ) layout.removeView(view);
|
589
|
view = effect.getCenter();
|
590
|
if( view!=null ) layout.removeView(view);
|
591
|
view = effect.getRegion();
|
592
|
if( view!=null ) layout.removeView(view);
|
593
|
|
594
|
long id = effect.getId();
|
595
|
mObject.abortEffect(id);
|
596
|
mEffects.remove(effect);
|
597
|
|
598
|
resetData();
|
599
|
|
600
|
break;
|
601
|
}
|
602
|
}
|
603
|
}
|
604
|
|
605
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
606
|
// Overrides
|
607
|
|
608
|
@Override
|
609
|
protected void onPause()
|
610
|
{
|
611
|
GLSurfaceView mView = (GLSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
612
|
if( mView!=null ) mView.onPause();
|
613
|
super.onPause();
|
614
|
}
|
615
|
|
616
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
617
|
|
618
|
@Override
|
619
|
protected void onResume()
|
620
|
{
|
621
|
super.onResume();
|
622
|
GLSurfaceView mView = (GLSurfaceView)findViewById(R.id.effects3dSurfaceView);
|
623
|
if( mView!=null ) mView.onResume();
|
624
|
}
|
625
|
|
626
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
627
|
|
628
|
@Override
|
629
|
public void onWindowFocusChanged(boolean hasFocus)
|
630
|
{
|
631
|
super.onWindowFocusChanged(hasFocus);
|
632
|
|
633
|
if( firstScreen )
|
634
|
{
|
635
|
mColsPicker.setValue(mNumCols);
|
636
|
mRowsPicker.setValue(mNumRows);
|
637
|
}
|
638
|
}
|
639
|
|
640
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
641
|
|
642
|
@Override
|
643
|
protected void onDestroy()
|
644
|
{
|
645
|
Distorted.onDestroy();
|
646
|
super.onDestroy();
|
647
|
}
|
648
|
|
649
|
}
|