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"/>
</attributes>
</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">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

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

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.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");
}
}

View File

@ -3,27 +3,49 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?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"
prefWidth="640" prefHeight="380"
fx:controller="launcher.FXMLController">
fx:controller="launcher.Launcher">
<children>
<VBox fx:id="sidepanel"
prefWidth="120" prefHeight="380">
<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"
prefWidth="120" prefHeight="260">
prefWidth="120" prefHeight="260" spacing="5">
<children>
<Button text="Play" fx:id="btn_launch" onAction="#launch"/>
<Button text="Settings" fx:id="btn_settings" onAction="#settings"/>
<Button text="Quit" fx:id="btn_quit" onAction="#quit"/>
<Button text="Play" fx:id="btn_launch" onAction="#launch"
prefWidth="110" prefHeight="15"/>
<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>
</VBox>
</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;
}
/*************/
/* Sidepanel */
/*************/
#sidepanel {
-fx-background-color: #303050;
-fx-aligment: center;
}
#logo {
-fx-background-image: "logo.png";
/* Logo */
.title {
-fx-font-weight: bold;
-fx-font-size: 1.35em;
-fx-padding: 1;
}
/* Buttons */
#btn {
-fx-alignment: center;
}
#btn > Button {
#btn Button {
-fx-cursor: hand;
-fx-padding: 5;
-fx-width: 100;
-fx-border-radius: 0;
-fx-border: none;
}
#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;
}