Refactor RenderBoard class and add a proper visualisation with Swing
This commit is contained in:
@@ -50,7 +50,7 @@ class RenderCanvas extends JPanel {
|
||||
public RenderCanvas() {
|
||||
setBorder(BorderFactory.createLineBorder(Color.black));
|
||||
setBackground(Color.white);
|
||||
board = new RenderBoard(8, 8); // Example board size
|
||||
board = new RenderBoard(15, 15, 600, 600);
|
||||
}
|
||||
|
||||
public Dimension getPreferredSize() {
|
||||
@@ -62,11 +62,9 @@ class RenderCanvas extends JPanel {
|
||||
|
||||
int midX = getWidth() / 2;
|
||||
int midY = getHeight() / 2;
|
||||
int boardWidth = 400; // Example board width
|
||||
int boardHeight = 400; // Example board height
|
||||
int x = midX - (boardWidth / 2);
|
||||
int y = midY - (boardHeight / 2);
|
||||
board.drawBoard(g, x, y, boardWidth, boardHeight);
|
||||
int x = midX - (this.board.renderWidth / 2);
|
||||
int y = midY - (this.board.renderHeight / 2);
|
||||
board.drawBoard(g, x, y);
|
||||
}
|
||||
|
||||
public void draw(GomokuGame game) {
|
||||
|
||||
Reference in New Issue
Block a user