Merge remote-tracking branch 'origin/master'

This commit is contained in:
no 2021-06-03 13:22:57 +02:00
commit 2b0adacbcb
7 changed files with 123 additions and 67 deletions

View File

@ -6,12 +6,6 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>

View File

@ -8,6 +8,11 @@ public class JsonToJava {
public static void main(String args[]) { public static void main(String args[]) {
JsonRecover();
}
private static void JsonRecover() {
// initialize the parser // initialize the parser
JSONParser jsonP = new JSONParser(); JSONParser jsonP = new JSONParser();
try { try {
@ -21,26 +26,42 @@ public class JsonToJava {
// String test = (String) jsonO.get("test"); // String test = (String) jsonO.get("test");
// System.out.println("ceci est un test :" + test); // System.out.println("ceci est un test :" + test);
// arena selection
// select an element on the list // select an element on the list
JSONArray arene = (JSONArray) jsonO.get("arena"); JSONArray arena = (JSONArray) jsonO.get("arena");
// print a case of this element // print a case of this element
System.out.println(arene.get(1)); System.out.println("arena : " + arena.get(1));
// nb players selection
JSONArray nb_players = (JSONArray) jsonO.get("nb_players"); JSONArray nb_players = (JSONArray) jsonO.get("nb_players");
System.out.println(nb_players.get(1)); System.out.println("nb_player : " + nb_players.get(1));
// character selection
JSONArray character1 = (JSONArray) jsonO.get("character1"); 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"); 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"); JSONArray resolution = (JSONArray) jsonO.get("resolution");
System.out.println(resolution.get(1)); // resolution string " width x heigth"
JSONObject reso = (JSONObject) resolution.get(1);
JSONArray button = (JSONArray) jsonO.get("button"); String heightStr = (String) reso.get("height");
System.out.println(button); 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) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -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);
}
}

View File

@ -13,6 +13,7 @@ import javafx.application.Application;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.fxml.*; import javafx.fxml.*;
import engine.Engine; import engine.Engine;
@ -41,7 +42,7 @@ public class Launcher extends Application {
Scene main = new Scene(root); Scene main = new Scene(root);
//primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setTitle("Boulevard Combattant"); primaryStage.setTitle("Boulevard Combattant");
primaryStage.setScene(main); primaryStage.setScene(main);
primaryStage.show(); primaryStage.show();
@ -56,11 +57,26 @@ public class Launcher extends Application {
e.printStackTrace(); e.printStackTrace();
System.exit(1); 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");
} }
} }

View File

@ -3,27 +3,49 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?> <?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Hyperlink?>
<HBox xmlns:fx="http://javafx.com/fxml" stylesheets="@style.css" fx:id="window" <HBox xmlns:fx="http://javafx.com/fxml" stylesheets="@style.css" fx:id="window"
prefWidth="640" prefHeight="380" prefWidth="640" prefHeight="380"
fx:controller="launcher.FXMLController"> fx:controller="launcher.Launcher">
<children> <children>
<VBox fx:id="sidepanel" <VBox fx:id="sidepanel"
prefWidth="120" prefHeight="380"> prefWidth="120" prefHeight="380">
<children> <children>
<Pane fx:id="logo"
prefWidth="120" prefHeight="120"></Pane> <ImageView fx:id="logo" fitHeight="120" fitWidth="120">
<image>
<Image url="/launcher/logo.png"/>
</image>
</ImageView>
<Label StyleClass="title" text="BOULEVARD"/>
<Label StyleClass="title" text="COMBATTANT"/>
<VBox fx:id="btn" <VBox fx:id="btn"
prefWidth="120" prefHeight="260"> prefWidth="120" prefHeight="260" spacing="5">
<children> <children>
<Button text="Play" fx:id="btn_launch" onAction="#launch"/> <Button text="Play" fx:id="btn_launch" onAction="#launch"
<Button text="Settings" fx:id="btn_settings" onAction="#settings"/> prefWidth="110" prefHeight="15"/>
<Button text="Quit" fx:id="btn_quit" onAction="#quit"/> <Button text="Settings" fx:id="btn_settings" onAction="#settings"
prefWidth="110" prefHeight="15"/>
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
prefWidth="110" prefHeight="15"/>
</children>
</VBox>
<VBox fx:id="prgm"
prefWidth="120">
<children>
<Hyperlink text="GIT" onAction="#website"/>
<Text text="Ver: Snapshot"/>
</children> </children>
</VBox> </VBox>
</children> </children>

BIN
src/launcher/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -2,26 +2,54 @@
-fx-background-color: #131320; -fx-background-color: #131320;
} }
/*************/
/* Sidepanel */ /* Sidepanel */
/*************/
#sidepanel { #sidepanel {
-fx-background-color: #303050; -fx-background-color: #303050;
-fx-aligment: center;
} }
#logo { /* Logo */
-fx-background-image: "logo.png"; .title {
-fx-font-weight: bold;
-fx-font-size: 1.35em;
-fx-padding: 1;
} }
/* Buttons */
#btn { #btn {
-fx-alignment: center; -fx-alignment: center;
} }
#btn > Button { #btn Button {
-fx-cursor: hand; -fx-cursor: hand;
-fx-padding: 5; -fx-border-radius: 0;
-fx-width: 100; -fx-border: none;
} }
#btn_launch { #btn_launch {
-fx-text-alignment: center; -fx-background-color: #30c130;
-fx-text-fill: #f2f2f2;
}
#btn_quit {
-fx-background-color: #c13030;
-fx-text-fill: #f2f2f2;
}
#prgm {
-fx-alignment: bottom-center;
-fx-padding: 5;
}
Text, Label {
-fx-fill: #f2f2f2;
-fx-text-fill: #f2f2f2;
}
/* Link to project */
Hyperlink:visited {
-fx-text-fill: #0095c8;
} }