Added partial resolution setting support.
This commit is contained in:
parent
677e4dd013
commit
fba6c50de0
@ -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<String, Object> arraysettings;
|
||||
|
||||
public Launcher() {
|
||||
pointer = this;
|
||||
@ -32,6 +35,7 @@ public class Launcher extends Application {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
arraysettings = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -43,6 +47,17 @@ public class Launcher extends Application {
|
||||
|
||||
Scene main = new Scene(root);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ChoiceBox<String> cb = (ChoiceBox<String>) main.lookup("#resolution");
|
||||
|
||||
ObservableList<String> 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<String, Object> getArraysettings() {
|
||||
return arraysettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,8 +35,8 @@
|
||||
<children>
|
||||
<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"/>
|
||||
<Label text="Resolution"/>
|
||||
<ChoiceBox fx:id="resolution"/>
|
||||
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
||||
prefWidth="110" prefHeight="15"/>
|
||||
</children>
|
||||
|
@ -53,3 +53,8 @@ Text, Label {
|
||||
Hyperlink:visited {
|
||||
-fx-text-fill: #0095c8;
|
||||
}
|
||||
|
||||
.contr_box {
|
||||
-fx-fill: #000000 !important;
|
||||
-fx-text-fill: #000000 !important;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user