Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //fields
- public MainApp() {
- this.game = new Game();
- }
- //lots of other methods
- public void showGameView() {
- try {
- System.out.println(game.getPlayer().getCurrentRoom());
- FXMLLoader loader = new FXMLLoader();
- loader.setLocation(MainApp.class.getResource("view/GameView.fxml"));
- AnchorPane GameView = (AnchorPane) loader.load();
- rootLayout.setCenter(GameView);
- GameViewController controller = loader.getController();
- controller.setMainApp(this);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public Game getGame() {
- return game;
- }
- private MainApp mainApp;
- @FXML
- public void initialize() {
- mainApp.getGame(). ... //do something else
- }
- public void setMainApp(MainApp mainApp) {
- this.mainApp = mainApp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement