diff --git a/.classpath b/.classpath index 9fea69d..914add1 100644 --- a/.classpath +++ b/.classpath @@ -6,12 +6,6 @@ - - - - - - diff --git a/src/configuration/JsonToJava.java b/src/configuration/JsonToJava.java index f0d0d8f..94478bc 100644 --- a/src/configuration/JsonToJava.java +++ b/src/configuration/JsonToJava.java @@ -8,39 +8,60 @@ public class JsonToJava { public static void main(String args[]) { + JsonRecover(); + + } + + private static void JsonRecover() { // initialize the parser JSONParser jsonP = new JSONParser(); try { // read the json document JSONObject jsonO = (JSONObject) jsonP.parse(new FileReader("src/configuration/config.json")); - - //to print all values - //System.out.println(jsonO.values()); + + // to print all values + // System.out.println(jsonO.values()); // isolate the "test" part and print it // String test = (String) jsonO.get("test"); // System.out.println("ceci est un test :" + test); - - //select an element on the list - JSONArray arene = (JSONArray) jsonO.get("arena"); - //print a case of this element - System.out.println(arene.get(1)); - - JSONArray nb_players = (JSONArray) jsonO.get("nb_players"); - System.out.println(nb_players.get(1)); + // arena selection + // select an element on the list + JSONArray arena = (JSONArray) jsonO.get("arena"); + // print a case of this element + System.out.println("arena : " + arena.get(1)); + // nb players selection + JSONArray nb_players = (JSONArray) jsonO.get("nb_players"); + System.out.println("nb_player : " + nb_players.get(1)); + + // character selection JSONArray character1 = (JSONArray) jsonO.get("character1"); - System.out.println(character1.get(1)); - + System.out.println("players 1 : " + character1.get(1)); + JSONArray character2 = (JSONArray) jsonO.get("character2"); - System.out.println(character2.get(1)); - + System.out.println("players 2 : " + character2.get(1)); + + // resolution JSONArray resolution = (JSONArray) jsonO.get("resolution"); - System.out.println(resolution.get(1)); - - JSONArray button = (JSONArray) jsonO.get("button"); - System.out.println(button); + // resolution string " width x heigth" + JSONObject reso = (JSONObject) resolution.get(1); + + String heightStr = (String) reso.get("height"); + int height = Integer.parseInt(heightStr); // String to int + + String widthStr = (String) reso.get("width"); + int width = Integer.parseInt(widthStr); + + System.out.println("heigth : " + height + " width : " + width); + + // button selection + JSONArray allButton = (JSONArray) jsonO.get("button"); + System.out.println(allButton); + + String up = (String) allButton.get(0); + System.out.println("button for up is : " + up); } catch (FileNotFoundException e) { e.printStackTrace(); diff --git a/src/launcher/FXMLController.java b/src/launcher/FXMLController.java deleted file mode 100644 index 37efe09..0000000 --- a/src/launcher/FXMLController.java +++ /dev/null @@ -1,25 +0,0 @@ -package launcher; - -import javafx.fxml.FXML; - -public class FXMLController { - - public FXMLController() { - } - - @FXML - public void launch() { - Launcher.runGame(); - } - - @FXML - public void settings() { - - } - - @FXML - public void quit() { - System.exit(0); - } - -} diff --git a/src/launcher/Launcher.java b/src/launcher/Launcher.java index 2a32a12..6899a35 100644 --- a/src/launcher/Launcher.java +++ b/src/launcher/Launcher.java @@ -13,6 +13,7 @@ import javafx.application.Application; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; +import javafx.stage.StageStyle; import javafx.fxml.*; import engine.Engine; @@ -41,7 +42,7 @@ public class Launcher extends Application { Scene main = new Scene(root); - //primaryStage.initStyle(StageStyle.UNDECORATED); + primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setTitle("Boulevard Combattant"); primaryStage.setScene(main); primaryStage.show(); @@ -56,11 +57,26 @@ public class Launcher extends Application { e.printStackTrace(); System.exit(1); } + } + + @FXML + public void launch() { + Launcher.runGame(); + } + + @FXML + public void settings() { } - public static void openSettings() { - + @FXML + public void quit() { + System.exit(0); + } + + @FXML + public void website() { + getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat"); } } diff --git a/src/launcher/launcher.fxml b/src/launcher/launcher.fxml index 60d61b8..4523e2d 100644 --- a/src/launcher/launcher.fxml +++ b/src/launcher/launcher.fxml @@ -3,29 +3,51 @@ + + + + + fx:controller="launcher.Launcher"> - + + + + + + + +