2021-05-03 02:29:11 +02:00
|
|
|
/**
|
|
|
|
* CLASS LAUNCHER
|
|
|
|
*
|
|
|
|
* Fenêtre de configuration du jeu préalablement au lancement d'une partie
|
|
|
|
*
|
|
|
|
* @author François Autin
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
package launcher;
|
|
|
|
|
2021-06-05 21:11:29 +02:00
|
|
|
import engine.TestEngine;
|
2021-05-27 03:02:36 +02:00
|
|
|
import javafx.application.Application;
|
|
|
|
import javafx.scene.Parent;
|
|
|
|
import javafx.scene.Scene;
|
|
|
|
import javafx.stage.Stage;
|
2021-06-03 03:46:38 +02:00
|
|
|
import javafx.stage.StageStyle;
|
2021-05-27 03:02:36 +02:00
|
|
|
import javafx.fxml.*;
|
2021-05-03 02:29:11 +02:00
|
|
|
|
2021-06-03 00:47:49 +02:00
|
|
|
import engine.Engine;
|
|
|
|
|
2021-05-27 03:02:36 +02:00
|
|
|
public class Launcher extends Application {
|
|
|
|
|
2021-06-03 00:47:49 +02:00
|
|
|
public static Launcher pointer;
|
|
|
|
private static Settings setter;
|
|
|
|
|
|
|
|
public Launcher() {
|
|
|
|
pointer = this;
|
|
|
|
try {
|
|
|
|
setter = new Settings();
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
System.exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-28 01:15:50 +02:00
|
|
|
/*
|
|
|
|
* Start method is used by Launcher as an implementation of the Application class to create a JavaFX thread to display the GUI window
|
|
|
|
*/
|
2021-05-27 03:02:36 +02:00
|
|
|
public void start(Stage primaryStage) throws Exception {
|
2021-05-27 03:14:20 +02:00
|
|
|
|
2021-06-03 01:53:32 +02:00
|
|
|
Parent root = FXMLLoader.load(getClass().getResource("launcher.fxml"));
|
2021-05-28 01:15:50 +02:00
|
|
|
|
|
|
|
Scene main = new Scene(root);
|
2021-05-03 02:29:11 +02:00
|
|
|
|
2021-06-03 03:46:38 +02:00
|
|
|
primaryStage.initStyle(StageStyle.UNDECORATED);
|
2021-05-28 01:15:50 +02:00
|
|
|
primaryStage.setTitle("Boulevard Combattant");
|
2021-05-27 03:14:20 +02:00
|
|
|
primaryStage.setScene(main);
|
|
|
|
primaryStage.show();
|
2021-06-03 00:47:49 +02:00
|
|
|
|
2021-05-03 02:29:11 +02:00
|
|
|
}
|
|
|
|
|
2021-06-03 00:47:49 +02:00
|
|
|
public static void runGame() {
|
|
|
|
try {
|
|
|
|
setter.setSettings();
|
2021-06-05 21:11:29 +02:00
|
|
|
TestEngine.main(null);
|
2021-06-03 00:47:49 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
System.exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-03 03:46:38 +02:00
|
|
|
@FXML
|
|
|
|
public void launch() {
|
|
|
|
Launcher.runGame();
|
|
|
|
}
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
public void settings() {
|
2021-06-03 00:47:49 +02:00
|
|
|
|
|
|
|
}
|
2021-06-03 03:46:38 +02:00
|
|
|
|
|
|
|
@FXML
|
|
|
|
public void quit() {
|
|
|
|
System.exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
public void website() {
|
|
|
|
getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat");
|
|
|
|
}
|
2021-06-03 00:47:49 +02:00
|
|
|
|
2021-05-03 02:29:11 +02:00
|
|
|
}
|