changeset 153:71205451ef57

Remove scaling.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 11 Apr 2013 20:17:13 +0300
parents 64b04c0eccce
children 48b91eabc029
files game/Piece.java
diffstat 1 files changed, 5 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/game/Piece.java	Wed Feb 06 10:24:47 2013 +0200
+++ b/game/Piece.java	Thu Apr 11 20:17:13 2013 +0300
@@ -28,7 +28,7 @@
             active;
 
     float   currAngle, rotationTime, rotationSpeed,
-            typeTime, typeValue, throbTime, currScale;
+            typeTime, typeValue, throbTime;
 
     Interpolate lerpRotation,
                 lerpScale,
@@ -46,7 +46,6 @@
         rotationActive = false;
         currRotation = 4 * 5000;
         currAngle = getAngle(currRotation);
-        currScale = 1;
 
         typeChanged = false;
         typeActive = false;
@@ -234,12 +233,10 @@
             if (t < maxTime)
             {
                 currAngle = lerpRotation.getValue(t);
-                currScale = (float) (1.0 + Math.sin(lerpScale.getValue(t)) * 0.25);
             }
             else
             {
                 currAngle = lerpRotation.start;
-                currScale = 1;
                 rotationActive = false;
             }
 
@@ -260,14 +257,10 @@
             if (t < maxTime)
             {
                 typeValue = lerpType.getValue(t);
-                if (!rotationActive)
-                    currScale = (float) (1.0 + Math.sin(lerpScale.getValue(t)) * 0.1);
             }
             else
             {
                 typeValue = lerpType.start;
-                if (!rotationActive)
-                    currScale = 1;
                 typeActive = false;
             }
 
@@ -299,9 +292,6 @@
         // Transform drawing by current angle
         g.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f);
 
-        // Scale dimensions
-        dim = dim * currScale;
-
         // Color piece by type
         switch (type) {
             case LOCKED:  g.setPaint(new Color(0.3f, 0.8f, 0.3f, 0.35f)); break;
@@ -309,7 +299,8 @@
             case START:   g.setPaint(new Color(1.0f, 0.6f, 0.0f, 0.95f)); break;
         }
 
-        g.fill(new RoundRectangle2D.Float(x, y, dim, dim, dim / 10, dim / 10));
+        float corner = dim / 10.0f;
+        g.fill(new RoundRectangle2D.Float(x, y, dim, dim, corner, corner));
 
         // Start pieces (center piece) have a different kind of border
         // and no connections drawn inside
@@ -318,7 +309,7 @@
             // Draw piece border
             g.setPaint(Color.black);
             g.setStroke(new BasicStroke(2.0f));
-            g.draw(new RoundRectangle2D.Float(x, y, dim, dim, dim / 10, dim / 10));
+            g.draw(new RoundRectangle2D.Float(x, y, dim, dim, corner, corner));
         }
         else
         {
@@ -333,7 +324,7 @@
                 g.draw(new RoundRectangle2D.Float(
                     x - offs1, y - offs1,
                     dim + offs2, dim + offs2,
-                    dim / 10, dim / 10));
+                    corner, corner));
             }
 
             // Draw piece border