Mercurial > hg > ristipolku
comparison game/Engine.java @ 202:54dd56b9bee6
Some work on board scaling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Apr 2019 15:50:17 +0300 |
parents | ad336d22c3e8 |
children |
comparison
equal
deleted
inserted
replaced
201:bd3cde4bc15c | 202:54dd56b9bee6 |
---|---|
213 public void paintBackPlate(Graphics2D g) | 213 public void paintBackPlate(Graphics2D g) |
214 { | 214 { |
215 g.setPaint(new Color(0.0f, 0.0f, 0.0f, 0.2f)); | 215 g.setPaint(new Color(0.0f, 0.0f, 0.0f, 0.2f)); |
216 g.setStroke(new BasicStroke(5.0f)); | 216 g.setStroke(new BasicStroke(5.0f)); |
217 g.draw(new RoundRectangle2D.Float(getScaledX(), getScaledY(), | 217 g.draw(new RoundRectangle2D.Float(getScaledX(), getScaledY(), |
218 boardSize * pscale, boardSize * pscale, | 218 boardSize * pscale * scale.x, boardSize * pscale * scale.y, |
219 pscale / 5, pscale / 5)); | 219 pscale * scale.x / 5, pscale * scale.y / 5)); |
220 } | 220 } |
221 | 221 |
222 public void paintBoard(Graphics2D g, boolean drawCurrent) | 222 public void paintBoard(Graphics2D g, boolean drawCurrent) |
223 { | 223 { |
224 for (int y = 0; y < boardSize; y++) | 224 for (int y = 0; y < boardSize; y++) |
227 { | 227 { |
228 if ((drawCurrent && board[x][y] == currPiece) || | 228 if ((drawCurrent && board[x][y] == currPiece) || |
229 (!drawCurrent && board[x][y] != currPiece)) | 229 (!drawCurrent && board[x][y] != currPiece)) |
230 { | 230 { |
231 board[x][y].paint(g, | 231 board[x][y].paint(g, |
232 getScaledX() + (x * pscale), | 232 getScaledX() + (x * pscale * scale.x), |
233 getScaledY() + (y * pscale), | 233 getScaledY() + (y * pscale * scale.y), |
234 pscale - pscale / 10); | 234 pscale - pscale / 10); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |