44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
package launcher;
|
|
|
|
import java.util.HashMap;
|
|
|
|
public class Settings {
|
|
|
|
private Config config;
|
|
|
|
public Settings() {
|
|
try {
|
|
config = new Config();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
System.exit(1);
|
|
}
|
|
}
|
|
|
|
public void setSettings() throws Exception {
|
|
HashMap<String, Object> set = Launcher.pointer.getArraysettings();
|
|
try {
|
|
int width = (Integer) set.get("width");
|
|
int height = (Integer) set.get("height");
|
|
int rounds = (Integer) set.get("rounds");
|
|
boolean fullscreen = (Boolean) set.get("fullscreen");
|
|
String character1 = (String) set.get("character1");
|
|
String character2 = (String) set.get("character2");
|
|
String stage = (String) set.get("stage");
|
|
config.write(width, height, rounds, fullscreen, character1, character2, stage);
|
|
} catch (Exception e) {
|
|
config.write(800, 600, 3, false, "default", "default", "default");
|
|
System.out.println("Incorrect config file");
|
|
}
|
|
}
|
|
|
|
public String getResolution() {
|
|
return "" + Integer.toString(config.width) + "x" + Integer.toString(config.height);
|
|
}
|
|
|
|
public boolean getFullscreen() {
|
|
return config.fullscreen;
|
|
}
|
|
|
|
}
|