Skip to content
Snippets Groups Projects
Commit 23c878be authored by koz01's avatar koz01
Browse files

GameListener implemented as innerclass

parent 60476cf3
Branches
No related merge requests found
......@@ -40,7 +40,17 @@ public class GameController {
strengthSlider.valueProperty().addListener(this::strenghtChanged);
world.setCannonStrength(strengthSlider.getValue());
world.setGameListener(new GameListenerImpl());
world.setGameListener(new EmptyGameListener () {
@Override
public void stateChanged(int shoots, int hits) {
GameController.this.shoots.setText("" + shoots);
GameController.this.hits.setText("" + hits);
}
} );
animationTimer.start();
}
......@@ -64,22 +74,4 @@ public class GameController {
, Number oldValue, Number newValue) {
world.setCannonStrength(newValue.doubleValue());
}
private class GameListenerImpl implements GameListener {
@Override
public void stateChanged(int shoots, int hits) {
GameController.this.shoots.setText("" + shoots);
GameController.this.hits.setText("" + hits);
}
@Override
public void gameOver() {
// TODO Auto-generated method stub
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment