From 1bad5933b05c8803e7a442469f7d67bd2160efaa Mon Sep 17 00:00:00 2001 From: lov3b Date: Wed, 2 Mar 2022 19:40:53 +0100 Subject: [PATCH] small changes --- src/schack/King.java | 7 +++++++ src/schack/Piece.java | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/schack/King.java b/src/schack/King.java index 4f4fd07..edafa8a 100644 --- a/src/schack/King.java +++ b/src/schack/King.java @@ -20,6 +20,13 @@ public final class King extends Piece { icon = ImageIO.read(new File(fileName)); } + public King(boolean white) throws IOException { +// Point p = new Point(); +// p.x = 5; +// p.y = white ? 0 : 7; + super(white, white ? new Point(5, 0) : new Point(5, 7)); + } + @Override public void draw(Graphics2D g2) { super.draw(g2); diff --git a/src/schack/Piece.java b/src/schack/Piece.java index 33f9f1a..13433f5 100644 --- a/src/schack/Piece.java +++ b/src/schack/Piece.java @@ -24,8 +24,12 @@ public abstract class Piece extends Component { public void draw(Graphics2D g2) { - g2.drawImage(icon, position.x * Board.SIZE_OF_TILE, position.y * Board.SIZE_OF_TILE, (ImageObserver) this); -// g2.drawImage(icon, 4 * Board.SCALE, 6* Board.SCALE, (ImageObserver) this); + g2.drawImage( + icon, + position.x * Board.SIZE_OF_TILE, + position.y * Board.SIZE_OF_TILE, + (ImageObserver) this + ); } }