raycast cursor

This commit is contained in:
2025-04-27 20:12:38 +02:00
parent 1b61eca58b
commit cbbce43ede
4 changed files with 74 additions and 5 deletions

View File

@@ -28,11 +28,23 @@ public class DDDView extends GameAdaptator {
this.world = new World(new Camera());
this.window = new Window(this.renderer, this.world);
this.window.OnCellClick.connect(this::onCellClick);
this.window.OnCellEnter.connect(this::onCellEnter);
this.window.OnCellExit.connect(this::onCellExit);
}
// Invoked when a cell is clicked
private void onCellClick(Coordinate coordinate) {
System.out.println("Cell clicked : " + coordinate);
}
// Invoked when a cell is hovered
private void onCellEnter(Coordinate coordinate) {
System.out.println("Enter : " + coordinate);
}
// Invoked when a cell is not hovered anymore
private void onCellExit(Coordinate coordinate) {
System.out.println("Exit : " + coordinate);
}
private Piece pieceAt(Coordinate pos) {