diff --git a/src/launcher/Launcher.java b/src/launcher/Launcher.java index eba028b..bffe9bd 100644 --- a/src/launcher/Launcher.java +++ b/src/launcher/Launcher.java @@ -9,20 +9,23 @@ package launcher; -import engine.TestEngine; +import gameplay.match.*; import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.ChoiceBox; import javafx.stage.Stage; import javafx.stage.StageStyle; import javafx.fxml.*; - -import engine.Engine; +import java.util.HashMap; public class Launcher extends Application { public static Launcher pointer; private static Settings setter; + private HashMap arraysettings; public Launcher() { pointer = this; @@ -32,6 +35,7 @@ public class Launcher extends Application { e.printStackTrace(); System.exit(1); } + arraysettings = new HashMap(); } /* @@ -43,6 +47,17 @@ public class Launcher extends Application { Scene main = new Scene(root); + @SuppressWarnings("unchecked") + ChoiceBox cb = (ChoiceBox) main.lookup("#resolution"); + + ObservableList availableres = FXCollections.observableArrayList("640x480", "800x600", "1024x768", "1280x720", "1366x768", "1600x900", "1920x1080"); + cb.setItems(availableres); + if (!availableres.contains(setter.getResolution())) { + cb.setValue("640x480"); + } else { + cb.setValue(setter.getResolution()); + } + primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setTitle("Boulevard Combattant"); primaryStage.setScene(main); @@ -53,7 +68,7 @@ public class Launcher extends Application { public static void runGame() { try { setter.setSettings(); - TestEngine.main(null); + match.main(null); } catch (Exception e) { e.printStackTrace(); System.exit(1); @@ -80,4 +95,8 @@ public class Launcher extends Application { getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat"); } + public HashMap getArraysettings() { + return arraysettings; + } + } diff --git a/src/launcher/launcher.fxml b/src/launcher/launcher.fxml index 4523e2d..369b2a5 100644 --- a/src/launcher/launcher.fxml +++ b/src/launcher/launcher.fxml @@ -35,8 +35,8 @@