diff 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
line wrap: on
line diff
--- a/game/Piece.java	Thu Nov 24 22:58:05 2011 +0200
+++ b/game/Piece.java	Fri Nov 25 11:04:09 2011 +0200
@@ -24,7 +24,8 @@
 
     boolean rotationChanged, rotationActive,
             typeChanged, typeActive,
-            stateChanged, stateActive;
+            stateChanged, stateActive,
+            active;
 
     float   currAngle, rotationTime, rotationSpeed,
             typeTime, typeValue, throbTime;
@@ -208,6 +209,8 @@
 
     public void animate(float time)
     {
+        active = false;
+
         if (rotationChanged)
         {
             rotationTime = time;
@@ -232,6 +235,8 @@
                 currAngle = lerpRotation.start;
                 rotationActive = false;
             }
+
+            active = true;
         }
 
         if (typeChanged)
@@ -252,6 +257,9 @@
                 typeValue = lerpType.start;
                 typeActive = false;
             }
+
+
+            active = true;
         }
 
         if (stateChanged)