leendert/src/main/java/nl/minkema/leendert/Main.java

60 lines
1.8 KiB
Java

package nl.minkema.leendert;
import de.codecentric.centerdevice.javafxsvg.SvgImageLoaderFactory;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.util.Properties;
/**
* @author J0QUE
* @version 1.0
*/
public class Main extends Application {
public static Scene scene;
public static void main(String[] args) throws Exception {
//Je kan properties best goed gebruiken om simpele lijsten in te laden
Properties properties = new Properties();
properties.load(Main.class.getResourceAsStream("/text/locations.properties"));
Game.locations = new int[properties.size()][2];
for (int i = 0; i < properties.size(); i++) {
String[] split = properties.getProperty(String.valueOf(i)).split(",");
Game.locations[i] = new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1])};
}
int[][] locations = Game.locations;
for (int i = 0; i < locations.length; i++) {
int[] k = locations[i];
if (k[0] == k[1] && k[0] == 0) {
throw new Exception("Invalid Location at index " + i);
}
}
properties = new Properties();
properties.load(Main.class.getResourceAsStream("/text/specials.properties"));
for (Object s : properties.keySet()) {
Game.specials.put(Integer.parseInt((String) s), Integer.parseInt((String) properties.get(s)));
}
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
SvgImageLoaderFactory.install();
primaryStage.setTitle("Het spectaculaire tuinavontuur");
scene = new Scene(new Menu(), 1200, 800);
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
}
}