working main screen

master
Cemal Odabasioglu 2022-05-18 10:24:18 +02:00
parent b568c967c6
commit 2e34cb91b4
2 changed files with 17 additions and 6 deletions

View File

@ -58,6 +58,7 @@ public class LaticeApplicationWindow extends Application {
ArrayList<Image> listTileImage = Rack.getRackTileImage(); ArrayList<Image> listTileImage = Rack.getRackTileImage();
ArrayList<Tile> listOfTile = new ArrayList<Tile>(); ArrayList<Tile> listOfTile = new ArrayList<Tile>();
Map<Rectangle, Tile> assocRectangleTile = new HashMap<Rectangle, Tile>(); Map<Rectangle, Tile> assocRectangleTile = new HashMap<Rectangle, Tile>();
static BorderPane rootLayout;
public static int indexTileClicked; public static int indexTileClicked;
@ -261,8 +262,7 @@ public class LaticeApplicationWindow extends Application {
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
setRootLayout(root);
Scene scene = new Scene(root, 1280, 720);
primaryStage.setResizable(false); primaryStage.setResizable(false);
primaryStage.setTitle("Latice"); primaryStage.setTitle("Latice");
@ -270,8 +270,12 @@ public class LaticeApplicationWindow extends Application {
primaryStage.show(); primaryStage.show();
} }
public static void setRootLayout(BorderPane root) {
rootLayout = root;
}
public static BorderPane getRootLayout() {
return rootLayout;
}
@ -288,5 +292,7 @@ public class LaticeApplicationWindow extends Application {
public static void setIndexTileClicked(int indexTileClicked) { public static void setIndexTileClicked(int indexTileClicked) {
LaticeApplicationWindow.indexTileClicked = indexTileClicked; LaticeApplicationWindow.indexTileClicked = indexTileClicked;
} }
} }

View File

@ -2,10 +2,12 @@ package latice.controller;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import latice.application.LaticeApplicationWindow; import latice.application.LaticeApplicationWindow;
public class MainScreenController extends LaticeApplicationWindow{ public class MainScreenController extends LaticeApplicationWindow{
@ -20,7 +22,10 @@ public class MainScreenController extends LaticeApplicationWindow{
@FXML @FXML
public void playButtonClicked(MouseEvent event) { public void playButtonClicked(MouseEvent event) {
System.out.println("playButtonClicked"); System.out.println("playButtonClicked");
Stage stage = (Stage) ((Node) event.getTarget()).getScene().getWindow();
BorderPane root = getRootLayout();
Scene scene = new Scene(root, 1280, 720);
stage.setScene(scene);
} }
// Event Listener on Rectangle[#rulesButton].onMouseClicked // Event Listener on Rectangle[#rulesButton].onMouseClicked
@FXML @FXML