mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 21:00:11 +01:00
developer gone
This commit is contained in:
parent
182c02cbf6
commit
85d12af878
@ -21,7 +21,7 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
private Point selectedPiece = new Point();
|
private Point selectedPiece = new Point();
|
||||||
private Color moveableColor = new Color(255, 191, 0);
|
private Color moveableColor = new Color(255, 191, 0);
|
||||||
public static boolean whiteToMove = true;
|
public static boolean whiteToMove = true;
|
||||||
public boolean developerMode = false;
|
|
||||||
|
|
||||||
public Board() throws IOException {
|
public Board() throws IOException {
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ public class Board extends JPanel implements MouseListener {
|
|||||||
Piece selectedPiece = pieces[mouseCoordinateX][mouseCoordinateY];
|
Piece selectedPiece = pieces[mouseCoordinateX][mouseCoordinateY];
|
||||||
|
|
||||||
// Kolla endast ifall vi kan röra på pjäsen om det är samma färg som den tur vi är på
|
// Kolla endast ifall vi kan röra på pjäsen om det är samma färg som den tur vi är på
|
||||||
if (selectedPiece.isWhite() == whiteToMove || developerMode) {
|
if (selectedPiece.isWhite() == whiteToMove) {
|
||||||
ArrayList<Point> attacks = checkAttacks(whiteToMove);
|
ArrayList<Point> attacks = checkAttacks(whiteToMove);
|
||||||
|
|
||||||
ArrayList<Point> validMoves = selectedPiece.validMoves(pieces, true);
|
ArrayList<Point> validMoves = selectedPiece.validMoves(pieces, true);
|
||||||
|
@ -51,7 +51,7 @@ public class Schack {
|
|||||||
JMenuItem showLocalIP = new JMenuItem("Show IP");
|
JMenuItem showLocalIP = new JMenuItem("Show IP");
|
||||||
JMenuItem askForRemi = new JMenuItem("Ask for remi");
|
JMenuItem askForRemi = new JMenuItem("Ask for remi");
|
||||||
JMenuItem surrender = new JMenuItem("Surrender");
|
JMenuItem surrender = new JMenuItem("Surrender");
|
||||||
JMenuItem developerMode = new JMenuItem("Toggle Developermode");
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
connectToOpponent.addActionListener((ActionEvent ae) -> {
|
connectToOpponent.addActionListener((ActionEvent ae) -> {
|
||||||
@ -71,9 +71,7 @@ public class Schack {
|
|||||||
surrender.addActionListener((ActionEvent ae) -> {
|
surrender.addActionListener((ActionEvent ae) -> {
|
||||||
System.out.println("I'M FRENCH! (TODO)");
|
System.out.println("I'M FRENCH! (TODO)");
|
||||||
});
|
});
|
||||||
developerMode.addActionListener(ae -> {
|
|
||||||
board.developerMode = !board.developerMode;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add the menu stuff
|
// Add the menu stuff
|
||||||
frame.setJMenuBar(menuBar);
|
frame.setJMenuBar(menuBar);
|
||||||
@ -83,7 +81,6 @@ public class Schack {
|
|||||||
connectMenu.add(showLocalIP);
|
connectMenu.add(showLocalIP);
|
||||||
gameMenu.add(askForRemi);
|
gameMenu.add(askForRemi);
|
||||||
gameMenu.add(surrender);
|
gameMenu.add(surrender);
|
||||||
gameMenu.add(developerMode);
|
|
||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user