menu #43

Merged
Mat_02 merged 20 commits from menu into master 2023-05-09 15:52:14 +02:00
3 changed files with 21 additions and 48 deletions
Showing only changes of commit d455b7f450 - Show all commits

View File

@ -20,17 +20,10 @@ import javafx.stage.Stage;
public class Controller extends Application {
private Stage stage;
//set up scene one
private Scene Menu;
private BorderPane BdP;
private Label title;
private Button Play;
private Button Select_level;
private Button Trophy;
//set up scene 2
private Scene Level_menu;
private GridPane GdP;
private Button bck_menu;
//set up scene 3
Review

tu pourrais faire un appel à #L33 (switchRoot) dans un premier temps ca ne changer rien mais si on change la façon de changer de scene un moment ca sera alors plus cohérent!

tu pourrais faire un appel à #L33 (switchRoot) dans un premier temps ca ne changer rien mais si on change la façon de changer de scene un moment ca sera alors plus cohérent!
Review

en gros au lieu de faire

        stage.setScene(new Scene(root));

Tu pourrais faire

        switchRoot(root);

Ca ne changerait pas grand chose pour l'instant mais si plus tard dans le code on a besoin de changer le fonctionnement de Scene par expemple, alors ca serait plus simple à changer.

en gros au lieu de faire ```java stage.setScene(new Scene(root)); ``` Tu pourrais faire ```java switchRoot(root); ``` Ca ne changerait pas grand chose pour l'instant mais si plus tard dans le code on a besoin de changer le fonctionnement de Scene par expemple, alors ca serait plus simple à changer.
private Scene Level_menu2;
private GridPane GdP2;
@ -49,16 +42,6 @@ public class Controller extends Application {
private Button Day_1;
private Button Day_2;
private Button Day_3;
private Button _1;
private Button _2;
private Button _3;
private Button _4;
private Button _5;
private Button _6;
private Button _7;
private Button _8;
private Button _9;
private Button _10;
public void start(Stage primaryStage) {
//set up the page
@ -73,37 +56,7 @@ public class Controller extends Application {
}
private Scene createLevel_menu(){
bck_menu = new Button("Back to the menu");
bck_menu.setOnAction(event -> switchScenes(Menu));
ColumnConstraints col_1 = new ColumnConstraints();
col_1.setPercentWidth(33);
ColumnConstraints col_2 = new ColumnConstraints();
col_2.setPercentWidth(33);
ColumnConstraints col_3 = new ColumnConstraints();
col_3.setPercentWidth(34);
GdP.getColumnConstraints().addAll(col_1,col_2,col_3);
//GdP.setGridLinesVisible(true);
GridPane.setHalignment(_1, HPos.CENTER);
GridPane.setHalignment(_2, HPos.CENTER);
GridPane.setHalignment(_3, HPos.CENTER);
GridPane.setHalignment(_4, HPos.CENTER);
GridPane.setHalignment(_5, HPos.CENTER);
GridPane.setHalignment(_6, HPos.CENTER);
GridPane.setHalignment(_7, HPos.CENTER);
GridPane.setHalignment(_8, HPos.CENTER);
GridPane.setHalignment(_9, HPos.CENTER);
GridPane.setHalignment(_10, HPos.CENTER);
GridPane.setHalignment(Day_2, HPos.LEFT);
GridPane.setHalignment(Day_3, HPos.RIGHT);
GridPane.setHalignment(bck_menu, HPos.CENTER);
Day_2.setOnAction(event -> switchScenes(Level_menu2));
return Level_menu;
}
private Scene createLevel_Menu2(){
bck_menu = new Button("Back to menu");
bck_menu.setOnAction(event -> switchScenes(Menu));

View File

@ -36,6 +36,7 @@ public class MenuAcceuil extends GridPane {
BorderPane.setAlignment(Trophy,Pos.CENTER);
//Menu.getStylesheets().add("style.css"); todo creat a file css
BdP.setPadding(new Insets(20,60,20,60));
//need help to add MenuAcceuil
}

View File

@ -20,6 +20,11 @@ public class MenuLevelDay1 extends GridPane {
super();
GdP = new GridPane();
//add all the button for level
for (Button c : Level_button) {
c = new Button();
}
Level_button[0] = new Button("1");
Level_button[1] = new Button("2");
Level_button[2]= new Button("3");
@ -48,6 +53,20 @@ public class MenuLevelDay1 extends GridPane {
GdP.add(Level_button[9],1,4);
GdP.add(Level_button[12],2,4);
for( int i= 0;i<=9;i++);
GridPane.setHalignment((Level_button[i],HPos.CENTER));;
GridPane.setHalignment(Level_button[10], HPos.LEFT);
GridPane.setHalignment(Level_button[11], HPos.RIGHT);
GridPane.setHalignment(Level_button[12], HPos.CENTER);
ColumnConstraints col_1 = new ColumnConstraints();
col_1.setPercentWidth(33);
ColumnConstraints col_2 = new ColumnConstraints();
col_2.setPercentWidth(33);
ColumnConstraints col_3 = new ColumnConstraints();
col_3.setPercentWidth(34);
GdP.getColumnConstraints().addAll(col_1,col_2,col_3);