More Renderer stuff
This commit is contained in:
33
src/RenderBoard.java
Normal file
33
src/RenderBoard.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user