Mercurial > hg > ristipolku
comparison game/Piece.java @ 27:26adc2827983
More work on the internals.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 01 Feb 2011 20:38:19 +0200 |
parents | 3d4cc47df31a |
children | 60a4579a79df |
comparison
equal
deleted
inserted
replaced
26:3d4cc47df31a | 27:26adc2827983 |
---|---|
120 public void setActiveConnection(int index) | 120 public void setActiveConnection(int index) |
121 { | 121 { |
122 active[index] = true; | 122 active[index] = true; |
123 activeChanged = true; | 123 activeChanged = true; |
124 } | 124 } |
125 | |
126 public PieceType getType() | |
127 { | |
128 return type; | |
129 } | |
125 | 130 |
126 public void animate(float time) | 131 public void animate(float time) |
127 { | 132 { |
128 if (rotationChanged) | 133 if (rotationChanged) |
129 { | 134 { |
190 g.setPaint(new Color(0.0f, 0.0f, 0.0f, (float) (1.0f - throb) )); | 195 g.setPaint(new Color(0.0f, 0.0f, 0.0f, (float) (1.0f - throb) )); |
191 g.setStroke(new BasicStroke(2.0f + throb * 2.0f)); | 196 g.setStroke(new BasicStroke(2.0f + throb * 2.0f)); |
192 g.draw(new RoundRectangle2D.Float(x - offs1, y - offs1, dim + offs2, dim + offs2, dim / 10, dim / 10)); | 197 g.draw(new RoundRectangle2D.Float(x - offs1, y - offs1, dim + offs2, dim + offs2, dim / 10, dim / 10)); |
193 } | 198 } |
194 | 199 |
195 g.setPaint(Color.black); | |
196 g.setStroke(new BasicStroke(6.0f)); | 200 g.setStroke(new BasicStroke(6.0f)); |
197 // CubicCurve2D c = new CubicCurve2D.Float(); | 201 // CubicCurve2D c = new CubicCurve2D.Float(); |
198 QuadCurve2D c = new QuadCurve2D.Float(); | 202 QuadCurve2D c = new QuadCurve2D.Float(); |
199 boolean[] drawn = new boolean[numConnections]; | 203 boolean[] drawn = new boolean[numConnections]; |
200 for (int i = 0; i < numConnections; i++) | 204 for (int i = 0; i < numConnections; i++) |
201 if (!drawn[i]) | 205 if (!drawn[i]) |
202 { | 206 { |
203 Point2D start, cp1, cp2, end; | 207 Point2D start, cp1, cp2, end; |
208 | |
209 boolean act = active[i] || active[connections[i]]; | |
210 g.setPaint(act ? Color.white : Color.black); | |
204 | 211 |
205 start = getPointCoords(x, y, dim, i); | 212 start = getPointCoords(x, y, dim, i); |
206 end = getPointCoords(x, y, dim, connections[i]); | 213 end = getPointCoords(x, y, dim, connections[i]); |
207 cp1 = getPointCoords(x, y, dim, -1); | 214 cp1 = getPointCoords(x, y, dim, -1); |
208 | 215 |