comparison game/Piece.java @ 138:9eb791e2fa17

Optimize board updating logic, so that the old placed tiles need not to be redrawn from scratch on each screen update, as they do not change usually.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 25 Nov 2011 11:04:09 +0200
parents 4c0dec72e2f0
children 35374be74fdc
comparison
equal deleted inserted replaced
137:d90f4eaef8e9 138:9eb791e2fa17
22 boolean[] states; 22 boolean[] states;
23 PieceType type, prevType; 23 PieceType type, prevType;
24 24
25 boolean rotationChanged, rotationActive, 25 boolean rotationChanged, rotationActive,
26 typeChanged, typeActive, 26 typeChanged, typeActive,
27 stateChanged, stateActive; 27 stateChanged, stateActive,
28 active;
28 29
29 float currAngle, rotationTime, rotationSpeed, 30 float currAngle, rotationTime, rotationSpeed,
30 typeTime, typeValue, throbTime; 31 typeTime, typeValue, throbTime;
31 32
32 Interpolate lerpRotation, 33 Interpolate lerpRotation,
206 return type; 207 return type;
207 } 208 }
208 209
209 public void animate(float time) 210 public void animate(float time)
210 { 211 {
212 active = false;
213
211 if (rotationChanged) 214 if (rotationChanged)
212 { 215 {
213 rotationTime = time; 216 rotationTime = time;
214 rotationActive = true; 217 rotationActive = true;
215 rotationChanged = false; 218 rotationChanged = false;
230 else 233 else
231 { 234 {
232 currAngle = lerpRotation.start; 235 currAngle = lerpRotation.start;
233 rotationActive = false; 236 rotationActive = false;
234 } 237 }
238
239 active = true;
235 } 240 }
236 241
237 if (typeChanged) 242 if (typeChanged)
238 { 243 {
239 typeTime = time; 244 typeTime = time;
250 else 255 else
251 { 256 {
252 typeValue = lerpType.start; 257 typeValue = lerpType.start;
253 typeActive = false; 258 typeActive = false;
254 } 259 }
260
261
262 active = true;
255 } 263 }
256 264
257 if (stateChanged) 265 if (stateChanged)
258 { 266 {
259 } 267 }