More Renderer stuff

This commit is contained in:
Dorian HAMDANI
2025-03-31 10:50:51 +02:00
parent 4d1481d634
commit 6e5e60cd36
4 changed files with 47 additions and 40 deletions

33
src/RenderBoard.java Normal file
View File

@@ -0,0 +1,33 @@
import java.awt.Color;
import java.awt.Graphics;
class RenderBoard {
private int width;
private int height;
private int[][] boardState; // Example representation of the board state
public RenderBoard(int width, int height) {
this.width = width;
this.height = height;
}
public void update(GomokuGame game) {
// Update the board state based on the game
// This method should be called whenever the game state changes
}
public void drawBoard(Graphics g, int x, int y, int w, int h) {
// Draw the board here
g.setColor(Color.LIGHT_GRAY);
int cellSize = w / this.width;
for (int i = 0; i < this.width; i++) {
for (int j = 0; j < this.height; j++) {
g.drawRect(x + i * cellSize, y + j * cellSize, cellSize, cellSize);
// Draw the tokens here
g.fillOval(x + i * cellSize, y + j * cellSize, cellSize, cellSize);
}
}
}
}