changeset 34:6f6c551cc14c

Fix piece connections rendering.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 03 Feb 2011 20:37:34 +0200
parents 14f1abf53d8d
children aa15b2c556b4
files game/Piece.java
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/game/Piece.java	Thu Feb 03 18:24:30 2011 +0200
+++ b/game/Piece.java	Thu Feb 03 20:37:34 2011 +0200
@@ -107,6 +107,7 @@
         float step = dim / 10;
       
         switch (index) {
+            // Normal line starting and ending points
             case  0: ox = 3.0f; oy = 0.4f; break;
             case  1: ox = 7.0f; oy = 0.4f; break;
             case  2: ox = 9.6f; oy = 3.0f; break;
@@ -116,12 +117,13 @@
             case  6: ox = 0.4f; oy = 7.0f; break;
             case  7: ox = 0.4f; oy = 3.0f; break;
 
+            // Matching control points for each point above (+8)
             case  8: ox = 3.0f; oy = 3.0f; break;
             case  9: ox = 7.0f; oy = 3.0f; break;
             case 10: ox = 7.0f; oy = 3.0f; break;
             case 11: ox = 7.0f; oy = 7.0f; break;
             case 12: ox = 7.0f; oy = 7.0f; break;
-            case 13: ox = 7.0f; oy = 7.0f; break;
+            case 13: ox = 3.0f; oy = 7.0f; break;
             case 14: ox = 3.0f; oy = 7.0f; break;
             case 15: ox = 3.0f; oy = 3.0f; break;
         }
@@ -202,9 +204,6 @@
 
         g.fill(new RoundRectangle2D.Float(x, y, dim, dim, dim / 10, dim / 10));
 
-        g.setPaint(Color.black);
-        g.setStroke(new BasicStroke(5.0f));
-        g.draw(new RoundRectangle2D.Float(x, y, dim, dim, dim / 10, dim / 10));
 
         if (type == PieceType.START)
             return;
@@ -243,5 +242,9 @@
             drawn[i] = true;
             drawn[connections[i]] = true;
         }
+
+        g.setPaint(Color.black);
+        g.setStroke(new BasicStroke(5.0f));
+        g.draw(new RoundRectangle2D.Float(x, y, dim, dim, dim / 10, dim / 10));
     }
 }