Created a separate UI package
- Renamed Chess to MainWindow - Moved MainWindow, BoardPanel and TextureUtil into the UI package
This commit is contained in:
parent
9354a83569
commit
612fb5fc9a
@ -128,7 +128,9 @@ public class Board {
|
|||||||
if (get(pos) != null && get(pos).getColor() != color
|
if (get(pos) != null && get(pos).getColor() != color
|
||||||
&& get(pos).isValidMove(new Move(pos, kingPos.get(color))))
|
&& get(pos).isValidMove(new Move(pos, kingPos.get(color))))
|
||||||
return GameEventType.CHECK;
|
return GameEventType.CHECK;
|
||||||
//return getMoves(kingPos.get(color)).isEmpty() ? GameEventType.CHECKMATE : GameEventType.CHECK;
|
// TOOD: Checkmate detection
|
||||||
|
// return getMoves(kingPos.get(color)).isEmpty() ? GameEventType.CHECKMATE :
|
||||||
|
// GameEventType.CHECK;
|
||||||
}
|
}
|
||||||
return GameEventType.NONE;
|
return GameEventType.NONE;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package dev.kske.chess;
|
package dev.kske.chess.ui;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -13,6 +13,9 @@ import java.util.List;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import dev.kske.chess.Board;
|
||||||
|
import dev.kske.chess.Move;
|
||||||
|
import dev.kske.chess.Position;
|
||||||
import dev.kske.chess.event.GameEvent;
|
import dev.kske.chess.event.GameEvent;
|
||||||
import dev.kske.chess.event.GameEventListener;
|
import dev.kske.chess.event.GameEventListener;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package dev.kske.chess;
|
package dev.kske.chess.ui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
@ -7,14 +7,16 @@ import javax.swing.JButton;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import dev.kske.chess.Board;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project: <strong>Chess</strong><br>
|
* Project: <strong>Chess</strong><br>
|
||||||
* File: <strong>Chess.java</strong><br>
|
* File: <strong>MainWindow.java</strong><br>
|
||||||
* Created: <strong>01.07.2019</strong><br>
|
* Created: <strong>01.07.2019</strong><br>
|
||||||
* Author: <strong>Kai S. K. Engelbart</strong>
|
* Author: <strong>Kai S. K. Engelbart</strong>
|
||||||
*/
|
*/
|
||||||
public class Chess {
|
public class MainWindow {
|
||||||
|
|
||||||
private JFrame mframe;
|
private JFrame mframe;
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ public class Chess {
|
|||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Chess window = new Chess();
|
MainWindow window = new MainWindow();
|
||||||
window.mframe.setVisible(true);
|
window.mframe.setVisible(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -38,7 +40,7 @@ public class Chess {
|
|||||||
/**
|
/**
|
||||||
* Create the application.
|
* Create the application.
|
||||||
*/
|
*/
|
||||||
public Chess() {
|
public MainWindow() {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package dev.kske.chess;
|
package dev.kske.chess.ui;
|
||||||
|
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
Reference in New Issue
Block a user