isSelected finished, working on usertouch
This commit is contained in:
parent
a4250943d4
commit
c87dfd94b5
|
|
@ -8,6 +8,8 @@ public class Board {
|
||||||
private ArrayList<Piece> pieces; // list of all pieces on the board
|
private ArrayList<Piece> pieces; // list of all pieces on the board
|
||||||
private Piece newPiece; // to add a piece to the board
|
private Piece newPiece; // to add a piece to the board
|
||||||
private int turnNb = 0;
|
private int turnNb = 0;
|
||||||
|
private int selectX = -1;
|
||||||
|
private int selectY = -1;
|
||||||
|
|
||||||
//initiation of the board, creating an 8 * 8 grid
|
//initiation of the board, creating an 8 * 8 grid
|
||||||
public Board(int colNum, int lineNum) {
|
public Board(int colNum, int lineNum) {
|
||||||
|
|
@ -117,12 +119,19 @@ public class Board {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void userTouch(int x, int y) {
|
public void userTouch(int x, int y) {
|
||||||
//TODO
|
if(selectX == x && selectY == y) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSelected(int x, int y) {
|
public boolean isSelected(int x, int y) {
|
||||||
//TODO
|
for(Piece piece : pieces) {
|
||||||
|
if(piece.getX() == x && piece.getY() == y) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue