Revision abc3054d
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/examples/girl/GirlActivity.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class GirlActivity extends Activity implements OnSeekBarChangeListener |
35 | 35 |
{ |
36 |
private SeekBar barSwing, barSize, barHips; |
|
37 | 36 |
private TextView textSwing, textSize, textHips; |
38 | 37 |
|
39 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
49 | 48 |
textSize = (TextView)findViewById(R.id.girlTextSize); |
50 | 49 |
textHips = (TextView)findViewById(R.id.girlTextHips); |
51 | 50 |
|
52 |
barSwing = (SeekBar)findViewById(R.id.girlSeekSwing); |
|
53 |
barSize = (SeekBar)findViewById(R.id.girlSeekSize); |
|
54 |
barHips = (SeekBar)findViewById(R.id.girlSeekHips); |
|
51 |
SeekBar barSwing = (SeekBar)findViewById(R.id.girlSeekSwing);
|
|
52 |
SeekBar barSize = (SeekBar)findViewById(R.id.girlSeekSize);
|
|
53 |
SeekBar barHips = (SeekBar)findViewById(R.id.girlSeekHips);
|
|
55 | 54 |
|
56 | 55 |
barSwing.setOnSeekBarChangeListener(this); |
57 | 56 |
barSize.setOnSeekBarChangeListener(this); |
... | ... | |
71 | 70 |
@Override |
72 | 71 |
protected void onPause() |
73 | 72 |
{ |
74 |
GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.girlSurfaceView);
|
|
75 |
mView.onPause();
|
|
73 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.girlSurfaceView);
|
|
74 |
view.onPause();
|
|
76 | 75 |
|
77 | 76 |
super.onPause(); |
78 | 77 |
} |
... | ... | |
84 | 83 |
{ |
85 | 84 |
super.onResume(); |
86 | 85 |
|
87 |
GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.girlSurfaceView);
|
|
88 |
mView.onResume();
|
|
86 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.girlSurfaceView);
|
|
87 |
view.onResume();
|
|
89 | 88 |
} |
90 | 89 |
|
91 | 90 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
103 | 102 |
{ |
104 | 103 |
int v; |
105 | 104 |
float s; |
106 |
|
|
105 |
GirlSurfaceView view = (GirlSurfaceView) this.findViewById(R.id.girlSurfaceView); |
|
106 |
|
|
107 | 107 |
switch (bar.getId()) |
108 | 108 |
{ |
109 | 109 |
case R.id.girlSeekSwing: v = progress/5; |
110 |
GirlRenderer.setSwing(v);
|
|
110 |
view.getRenderer().setSwing(v);
|
|
111 | 111 |
textSwing.setText("Swing: "+v); |
112 | 112 |
break; |
113 | 113 |
case R.id.girlSeekSize : if( progress> 50) |
... | ... | |
118 | 118 |
{ |
119 | 119 |
s = 0.015f*progress + 0.25f; |
120 | 120 |
} |
121 |
GirlRenderer.setSize(s);
|
|
121 |
view.getRenderer().setSize(s);
|
|
122 | 122 |
textSize.setText("Size: "+(((int)(s*10))/10.0f)); |
123 | 123 |
break; |
124 | 124 |
case R.id.girlSeekHips : v = progress/5; |
125 |
GirlRenderer.setHips(v);
|
|
125 |
view.getRenderer().setHips(v);
|
|
126 | 126 |
textHips.setText("Hips: "+v); |
127 | 127 |
break; |
128 | 128 |
} |
src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
---|---|---|
50 | 50 |
private DistortedBitmap mGirl; |
51 | 51 |
private Static2D pLeft, pRight, pHips; |
52 | 52 |
private Static4D Region, sinkRegion, HipsRegion; |
53 |
private static Dynamic3D diL, diR; |
|
54 |
private static Dynamic1D diHips, diSink; |
|
55 |
private static Static3D v0,v1,v2,v3; |
|
56 |
private static Static1D dBegin, dMiddle, dEnd, s0; |
|
57 |
|
|
53 |
private Dynamic3D diL, diR; |
|
54 |
private Dynamic1D diHips, diSink; |
|
55 |
private Static3D v0,v1,v2,v3; |
|
56 |
private Static1D dBegin, dMiddle, dEnd, s0; |
|
58 | 57 |
private int bmpHeight, bmpWidth; |
59 |
|
|
60 |
private static int boobsSwing; |
|
61 |
private static int hipsSwirl; |
|
62 |
private static float boobsSink; |
|
58 |
private int boobsSwing; |
|
59 |
private int hipsSwirl; |
|
60 |
private float boobsSink; |
|
63 | 61 |
|
64 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 | 63 |
|
66 |
public GirlRenderer(GLSurfaceView v)
|
|
64 |
GirlRenderer(GLSurfaceView v)
|
|
67 | 65 |
{ |
68 | 66 |
mView = v; |
69 | 67 |
|
... | ... | |
122 | 120 |
|
123 | 121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
124 | 122 |
|
125 |
public static void setHips(int s)
|
|
123 |
void setHips(int s) |
|
126 | 124 |
{ |
127 | 125 |
hipsSwirl = s; |
128 | 126 |
dBegin.set(-hipsSwirl); |
... | ... | |
131 | 129 |
|
132 | 130 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
133 | 131 |
|
134 |
public static void setSize(float s)
|
|
132 |
void setSize(float s) |
|
135 | 133 |
{ |
136 | 134 |
boobsSink = s; |
137 | 135 |
s0.set(boobsSink); |
... | ... | |
139 | 137 |
|
140 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
141 | 139 |
|
142 |
public static void setSwing(int s)
|
|
140 |
void setSwing(int s) |
|
143 | 141 |
{ |
144 | 142 |
boobsSwing = s; |
145 | 143 |
|
src/main/java/org/distorted/examples/girl/GirlSurfaceView.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
class GirlSurfaceView extends GLSurfaceView |
30 | 30 |
{ |
31 |
private GirlRenderer mRenderer; |
|
32 |
|
|
31 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 34 |
|
33 | 35 |
public GirlSurfaceView(Context c, AttributeSet attrs) |
... | ... | |
40 | 42 |
{ |
41 | 43 |
setEGLConfigChooser(8, 8, 8, 8, 16, 0); |
42 | 44 |
} |
43 |
|
|
44 |
setRenderer(new GirlRenderer(this)); |
|
45 |
|
|
46 |
mRenderer = new GirlRenderer(this); |
|
47 |
|
|
48 |
setRenderer(mRenderer); |
|
45 | 49 |
} |
50 |
|
|
51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
52 |
|
|
53 |
GirlRenderer getRenderer() |
|
54 |
{ |
|
55 |
return mRenderer; |
|
56 |
} |
|
46 | 57 |
} |
47 | 58 |
|
Also available in: Unified diff
Tidy up 'Girl'