Added partial resolution setting support.
This commit is contained in:
parent
677e4dd013
commit
fba6c50de0
@ -9,20 +9,23 @@
|
|||||||
|
|
||||||
package launcher;
|
package launcher;
|
||||||
|
|
||||||
import engine.TestEngine;
|
import gameplay.match.*;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
import javafx.fxml.*;
|
import javafx.fxml.*;
|
||||||
|
import java.util.HashMap;
|
||||||
import engine.Engine;
|
|
||||||
|
|
||||||
public class Launcher extends Application {
|
public class Launcher extends Application {
|
||||||
|
|
||||||
public static Launcher pointer;
|
public static Launcher pointer;
|
||||||
private static Settings setter;
|
private static Settings setter;
|
||||||
|
private HashMap<String, Object> arraysettings;
|
||||||
|
|
||||||
public Launcher() {
|
public Launcher() {
|
||||||
pointer = this;
|
pointer = this;
|
||||||
@ -32,6 +35,7 @@ public class Launcher extends Application {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
arraysettings = new HashMap<String, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,6 +47,17 @@ public class Launcher extends Application {
|
|||||||
|
|
||||||
Scene main = new Scene(root);
|
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.initStyle(StageStyle.UNDECORATED);
|
||||||
primaryStage.setTitle("Boulevard Combattant");
|
primaryStage.setTitle("Boulevard Combattant");
|
||||||
primaryStage.setScene(main);
|
primaryStage.setScene(main);
|
||||||
@ -53,7 +68,7 @@ public class Launcher extends Application {
|
|||||||
public static void runGame() {
|
public static void runGame() {
|
||||||
try {
|
try {
|
||||||
setter.setSettings();
|
setter.setSettings();
|
||||||
TestEngine.main(null);
|
match.main(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
@ -80,4 +95,8 @@ public class Launcher extends Application {
|
|||||||
getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat");
|
getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Object> getArraysettings() {
|
||||||
|
return arraysettings;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
<children>
|
<children>
|
||||||
<Button text="Play" fx:id="btn_launch" onAction="#launch"
|
<Button text="Play" fx:id="btn_launch" onAction="#launch"
|
||||||
prefWidth="110" prefHeight="15"/>
|
prefWidth="110" prefHeight="15"/>
|
||||||
<Button text="Settings" fx:id="btn_settings" onAction="#settings"
|
<Label text="Resolution"/>
|
||||||
prefWidth="110" prefHeight="15"/>
|
<ChoiceBox fx:id="resolution"/>
|
||||||
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
||||||
prefWidth="110" prefHeight="15"/>
|
prefWidth="110" prefHeight="15"/>
|
||||||
</children>
|
</children>
|
||||||
|
@ -52,4 +52,9 @@ Text, Label {
|
|||||||
/* Link to project */
|
/* Link to project */
|
||||||
Hyperlink:visited {
|
Hyperlink:visited {
|
||||||
-fx-text-fill: #0095c8;
|
-fx-text-fill: #0095c8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contr_box {
|
||||||
|
-fx-fill: #000000 !important;
|
||||||
|
-fx-text-fill: #000000 !important;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user