mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 21:00:11 +01:00
Fixa till streams
This commit is contained in:
parent
6afee98235
commit
debb4ce35f
@ -61,27 +61,22 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
Graphics2D g2 = (Graphics2D) g;
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
drawSquares(g2);
|
drawSquares(g2);
|
||||||
|
|
||||||
|
|
||||||
validDebugMovesToDraw.stream().filter(point -> point != null).forEach(point -> {
|
validDebugMovesToDraw.stream().filter(point -> point != null).forEach(point -> {
|
||||||
g2.setColor(Color.CYAN);
|
g2.setColor(Color.CYAN);
|
||||||
g2.fillRect(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE, SIZE_OF_TILE);
|
g2.fillRect(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE, SIZE_OF_TILE);
|
||||||
});
|
});
|
||||||
|
|
||||||
// måla alla ställen man kan gå¨till
|
// måla alla ställen man kan gå¨till
|
||||||
validMovesToDraw.forEach(point -> {
|
validMovesToDraw.stream().filter(point -> point != null)
|
||||||
if (point != null) {
|
.forEach(point -> {
|
||||||
g2.setColor(moveableColor);
|
g2.setColor(moveableColor);
|
||||||
g2.fillOval(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE, SIZE_OF_TILE);
|
g2.fillOval(point.x * SIZE_OF_TILE, point.y * SIZE_OF_TILE, SIZE_OF_TILE, SIZE_OF_TILE);
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Draw piece
|
// Draw piece
|
||||||
Arrays.stream(pieces).forEach(pieceArr -> Arrays.stream(pieceArr).forEach(piece -> {
|
Arrays.stream(pieces).forEach(pieceArr -> Arrays.stream(pieceArr)
|
||||||
if (piece != null) {
|
.filter(piece -> piece != null)
|
||||||
piece.draw(g2);
|
.forEach(piece -> piece.draw(g2)));
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user