Revision c4f5a8db
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java | ||
---|---|---|
110 | 110 |
private Random mRnd = new Random(0); |
111 | 111 |
private DistortedObjectTree mRoot, mBackground; |
112 | 112 |
private GridFlat mQuad; |
113 |
private int mWidth, mHeight; |
|
113 | 114 |
|
114 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
115 | 116 |
|
... | ... | |
133 | 134 |
Distorted.setProjection(60.0f, 0.0f, 0.0f); |
134 | 135 |
} |
135 | 136 |
|
137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
138 |
|
|
139 |
public void onPause() |
|
140 |
{ |
|
141 |
mWidth = 0; |
|
142 |
mHeight= 0; |
|
143 |
} |
|
144 |
|
|
136 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
137 | 146 |
|
138 | 147 |
public void onDrawFrame(GL10 glUnused) |
... | ... | |
145 | 154 |
|
146 | 155 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
147 | 156 |
{ |
148 |
mScreenQueue.abortAllEffects(); |
|
149 |
mGFFAQueue.abortAllEffects(); |
|
150 |
mLogoQueue.abortAllEffects(); |
|
151 |
mCrawlQueue.abortAllEffects(); |
|
152 |
mCrawlBackgroundQueue.abortAllEffects(); |
|
157 |
if( mWidth!=width || mHeight!=height ) // after onPause() we get 2 calls here |
|
158 |
{ |
|
159 |
mWidth = width; |
|
160 |
mHeight= height; |
|
153 | 161 |
|
154 |
for(int i=0; i<NUM_STARS; i++) mStarQueue[i].abortAllEffects(); |
|
162 |
mScreenQueue.abortAllEffects(); |
|
163 |
mGFFAQueue.abortAllEffects(); |
|
164 |
mLogoQueue.abortAllEffects(); |
|
165 |
mCrawlQueue.abortAllEffects(); |
|
166 |
mCrawlBackgroundQueue.abortAllEffects(); |
|
155 | 167 |
|
156 |
setupScreen(width,height);
|
|
168 |
for(int i=0; i<NUM_STARS; i++) mStarQueue[i].abortAllEffects();
|
|
157 | 169 |
|
158 |
Distorted.onSurfaceChanged(width, height); |
|
170 |
setupScreen(width,height); |
|
171 |
|
|
172 |
Distorted.onSurfaceChanged(width, height); |
|
173 |
} |
|
159 | 174 |
} |
160 | 175 |
|
161 | 176 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
228 | 243 |
mGFFAQueue.alpha(di); |
229 | 244 |
|
230 | 245 |
mRoot.attach(mGFFATexture, mGFFAQueue, mQuad); |
231 |
mGFFAQueue.addEventListener(this);
|
|
246 |
mGFFAQueue.registerForMessages(this);
|
|
232 | 247 |
} |
233 | 248 |
|
234 | 249 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
377 | 392 |
mLogoQueue.move( new Static3D(-logoW/2,-logoH/2,0) ); |
378 | 393 |
|
379 | 394 |
mRoot.attach(mLogoTexture,mLogoQueue,mQuad); |
380 |
mLogoQueue.addEventListener(this);
|
|
395 |
mLogoQueue.registerForMessages(this);
|
|
381 | 396 |
} |
382 | 397 |
else if( objectID==logoID ) |
383 | 398 |
{ |
... | ... | |
409 | 424 |
|
410 | 425 |
mBackground = mRoot.attach(mCrawlBackgroundTexture,mCrawlBackgroundQueue,mQuad); |
411 | 426 |
mBackground.attach(mCrawlTexture,mCrawlQueue,mQuad); |
412 |
mCrawlQueue.addEventListener(this);
|
|
427 |
mCrawlQueue.registerForMessages(this);
|
|
413 | 428 |
} |
414 | 429 |
else if( objectID==crawlID ) |
415 | 430 |
{ |
Also available in: Unified diff
onPause(): fix StarWars