mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 21:00:11 +01:00
Flytta till mousePressed
This commit is contained in:
parent
9b1c9ab046
commit
45d4f0e80c
@ -30,7 +30,7 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
private Piece[][] initPieces() throws IOException {
|
private Piece[][] initPieces() throws IOException {
|
||||||
|
|
||||||
Piece[][] piecesRet = {
|
Piece[][] piecesRet = {
|
||||||
{new Rook(false, new Point(0, 0)), null, null, new Pawn(false, new Point(0,4)), null, null, null, new Rook(true, new Point(0, 7))},
|
{new Rook(false, new Point(0, 0)), null, null, new Pawn(false, new Point(0, 4)), null, null, null, new Rook(true, new Point(0, 7))},
|
||||||
{new Horse(false, true, new Point(1, 0)), null, null, null, null, null, null, new Horse(true, true, new Point(1, 7))},
|
{new Horse(false, true, new Point(1, 0)), null, null, null, null, null, null, new Horse(true, true, new Point(1, 7))},
|
||||||
{new Bishop(false, new Point(2, 0)), null, null, null, null, null, null, new Bishop(true, new Point(2, 7))},
|
{new Bishop(false, new Point(2, 0)), null, null, null, null, null, null, new Bishop(true, new Point(2, 7))},
|
||||||
{new Queen(false, new Point(3, 0)), null, null, null, new Pawn(false, new Point(3, 4)), null, null, new Queen(true, new Point(3, 7))},
|
{new Queen(false, new Point(3, 0)), null, null, null, new Pawn(false, new Point(3, 4)), null, null, new Queen(true, new Point(3, 7))},
|
||||||
@ -165,6 +165,10 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent mouseEvent) {
|
public void mouseClicked(MouseEvent mouseEvent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent mouseEvent) {
|
||||||
int mouseCoordinateX = (int) (mouseEvent.getX() / SIZE_OF_TILE);
|
int mouseCoordinateX = (int) (mouseEvent.getX() / SIZE_OF_TILE);
|
||||||
int mouseCoordinateY = (int) (mouseEvent.getY() / SIZE_OF_TILE);
|
int mouseCoordinateY = (int) (mouseEvent.getY() / SIZE_OF_TILE);
|
||||||
|
|
||||||
@ -197,11 +201,7 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
} else {
|
} else {
|
||||||
validMovesToDraw.clear();
|
validMovesToDraw.clear();
|
||||||
}
|
}
|
||||||
getParent().repaint();
|
getParent().repaint();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mousePressed(MouseEvent e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user