Mercurial > hg > ristipolku
comparison game/Piece.java @ 167:7bf508d363bd
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 02 Mar 2017 12:23:57 +0200 |
parents | e8eeac403e5f |
children | 189cd8fe2304 |
comparison
equal
deleted
inserted
replaced
166:bb2ee580bd2e | 167:7bf508d363bd |
---|---|
96 | 96 |
97 public void clearStates() | 97 public void clearStates() |
98 { | 98 { |
99 for (int i = 0; i < numConnections; i++) | 99 for (int i = 0; i < numConnections; i++) |
100 states[i] = false; | 100 states[i] = false; |
101 | |
101 stateChanged = true; | 102 stateChanged = true; |
102 } | 103 } |
103 | 104 |
104 public int getRotation() | 105 public int getRotation() |
105 { | 106 { |
170 public Point2D getPointCoords(float x, float y, float dim, int index) | 171 public Point2D getPointCoords(float x, float y, float dim, int index) |
171 { | 172 { |
172 float ox = 0, oy = 0; | 173 float ox = 0, oy = 0; |
173 float step = dim / 10; | 174 float step = dim / 10; |
174 | 175 |
175 switch (index) { | 176 switch (index) |
177 { | |
176 // Normal line starting and ending points | 178 // Normal line starting and ending points |
177 case 0: ox = 3.0f; oy = 0.4f; break; | 179 case 0: ox = 3.0f; oy = 0.4f; break; |
178 case 1: ox = 7.0f; oy = 0.4f; break; | 180 case 1: ox = 7.0f; oy = 0.4f; break; |
179 | 181 |
180 case 2: ox = 9.6f; oy = 3.0f; break; | 182 case 2: ox = 9.6f; oy = 3.0f; break; |
291 | 293 |
292 // Transform drawing by current angle | 294 // Transform drawing by current angle |
293 g.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); | 295 g.rotate(currAngle, x + dim / 2.0f, y + dim / 2.0f); |
294 | 296 |
295 // Color piece by type | 297 // Color piece by type |
296 switch (type) { | 298 switch (type) |
299 { | |
297 case LOCKED: g.setPaint(new Color(0.3f, 0.8f, 0.3f, 0.35f)); break; | 300 case LOCKED: g.setPaint(new Color(0.3f, 0.8f, 0.3f, 0.35f)); break; |
298 case ACTIVE: g.setPaint(new Color(0.9f, 0.3f, 0.3f, 0.35f)); break; | 301 case ACTIVE: g.setPaint(new Color(0.9f, 0.3f, 0.3f, 0.35f)); break; |
299 case START: g.setPaint(new Color(1.0f, 0.6f, 0.0f, 0.95f)); break; | 302 case START: g.setPaint(new Color(1.0f, 0.6f, 0.0f, 0.95f)); break; |
300 } | 303 } |
301 | 304 |