dev #12
@@ -39,12 +39,19 @@ public class DDDView extends GameAdaptator {
|
||||
|
||||
// Invoked when a cell is hovered
|
||||
private void onCellEnter(Coordinate coordinate) {
|
||||
System.out.println("Enter : " + coordinate);
|
||||
// small test turning a piece red when hovered
|
||||
Piece p = pieceAt(coordinate);
|
||||
if (p == null)
|
||||
return;
|
||||
this.world.getEntity(p).setColor(new Vector3f(1, 0, 0));
|
||||
}
|
||||
|
||||
// Invoked when a cell is not hovered anymore
|
||||
private void onCellExit(Coordinate coordinate) {
|
||||
System.out.println("Exit : " + coordinate);
|
||||
Piece p = pieceAt(coordinate);
|
||||
if (p == null)
|
||||
return;
|
||||
this.world.getEntity(p).setColor(p.getColor() == Color.White ? WHITE : BLACK);
|
||||
}
|
||||
|
||||
private Piece pieceAt(Coordinate pos) {
|
||||
@@ -79,11 +86,11 @@ public class DDDView extends GameAdaptator {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
this.window.addRegularTask((delta) -> {
|
||||
final float angle = 1f;
|
||||
final Camera cam = this.world.getCamera();
|
||||
cam.setRotateAngle(cam.getRotateAngle() + angle * delta);
|
||||
});
|
||||
// this.window.addRegularTask((delta) -> {
|
||||
// final float angle = 1f;
|
||||
// final Camera cam = this.world.getCamera();
|
||||
// cam.setRotateAngle(cam.getRotateAngle() + angle * delta);
|
||||
// });
|
||||
this.window.run();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user