added rules

master
Cemal Odabasioglu 2022-05-26 22:56:52 +02:00
parent d207ebff19
commit 219cab7311
1 changed files with 28 additions and 2 deletions

View File

@ -8,10 +8,12 @@ import javafx.application.Platform;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.shape.Rectangle; import javafx.scene.shape.Rectangle;
import javafx.stage.Modality;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.util.Duration; import javafx.util.Duration;
import latice.application.LaticeApplicationWindow; import latice.application.LaticeApplicationWindow;
@ -32,9 +34,9 @@ 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(); Stage primaryStage = (Stage) ((Node) event.getTarget()).getScene().getWindow();
StackPane root = getRootLayout(); StackPane root = getRootLayout();
root.translateYProperty().set(stage.getHeight()); root.translateYProperty().set(primaryStage.getHeight());
parentStackPane.getChildren().add(root); parentStackPane.getChildren().add(root);
//parameters of the animation //parameters of the animation
@ -53,6 +55,30 @@ public class MainScreenController extends LaticeApplicationWindow{
@FXML @FXML
public void rulesButtonClicked(MouseEvent event) { public void rulesButtonClicked(MouseEvent event) {
System.out.println("rulesButtonClicked"); System.out.println("rulesButtonClicked");
Stage primaryStage = (Stage) ((Node) event.getTarget()).getScene().getWindow();
Label secondLabel = new Label("Règles");
//TODO règles à saisir
StackPane secondaryLayout = new StackPane();
secondaryLayout.getChildren().add(secondLabel);
Scene secondScene = new Scene(secondaryLayout, 230, 100);
// New window (Stage)
Stage newWindow = new Stage();
newWindow.setTitle("Règles du jeu Latice");
newWindow.setScene(secondScene);
// Specifies the modality for new window
newWindow.initModality(Modality.WINDOW_MODAL);
// Specifies the owner window
newWindow.initOwner(primaryStage);
// Set position of window
newWindow.setX(primaryStage.getX() + 300);
newWindow.setY(primaryStage.getY() + 175);
newWindow.show();
} }
// Event Listener on Rectangle[#exitButton].onMouseClicked // Event Listener on Rectangle[#exitButton].onMouseClicked
@FXML @FXML