2021-05-28 00:50:57 +02:00
|
|
|
package launcher;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
|
|
public class Settings {
|
|
|
|
|
|
|
|
private class Player {
|
|
|
|
|
|
|
|
private int controller_id;
|
|
|
|
private String character;
|
|
|
|
private int color;
|
|
|
|
|
|
|
|
public Player(int cid, String ch, int col) {
|
|
|
|
controller_id = cid;
|
|
|
|
character = ch;
|
|
|
|
color = col;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getController_id() {
|
|
|
|
return controller_id;
|
|
|
|
}
|
|
|
|
protected void setController_id(int controller_id) {
|
|
|
|
this.controller_id = controller_id;
|
|
|
|
}
|
|
|
|
protected String getCharacter() {
|
|
|
|
return character;
|
|
|
|
}
|
|
|
|
protected void setCharacter(String character) {
|
|
|
|
this.character = character;
|
|
|
|
}
|
|
|
|
protected int getColor() {
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
protected void setColor(int color) {
|
|
|
|
this.color = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private FileInputStream f_is;
|
|
|
|
private int width, height, r_x, r_y, rounds;
|
|
|
|
private boolean fullscreen;
|
2021-05-28 00:55:12 +02:00
|
|
|
private String stage;
|
2021-05-28 00:50:57 +02:00
|
|
|
private Player p1, p2;
|
|
|
|
|
|
|
|
public Settings() throws Exception {
|
|
|
|
try {
|
|
|
|
f_is = new FileInputStream("game.set");
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
File f = new File("game.set");
|
|
|
|
f.createNewFile();
|
|
|
|
} finally {
|
|
|
|
f_is = new FileInputStream("game.set");
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
parseSettings();
|
|
|
|
} finally {
|
|
|
|
setDefaultSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void parseSettings() throws Exception {
|
|
|
|
//TODO: parseSettings() (Needs settings syntax fixed)
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSettings() throws Exception {
|
|
|
|
//TODO: parseSettings() (Needs settings syntax fixed)
|
|
|
|
}
|
|
|
|
|
|
|
|
private void setDefaultSettings() {
|
|
|
|
width = 800;
|
|
|
|
height = 600;
|
|
|
|
r_x = 4;
|
|
|
|
r_y = 3;
|
|
|
|
rounds = 3;
|
|
|
|
fullscreen = false;
|
|
|
|
p1 = new Player(0, "base", 0);
|
|
|
|
p2 = new Player(0, "base", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected FileInputStream getF_is() {
|
|
|
|
return f_is;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getWidth() {
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getHeight() {
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getR_x() {
|
|
|
|
return r_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getR_y() {
|
|
|
|
return r_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected int getRounds() {
|
|
|
|
return rounds;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected boolean isFullscreen() {
|
|
|
|
return fullscreen;
|
|
|
|
}
|
2021-05-28 00:55:12 +02:00
|
|
|
|
|
|
|
protected String getStage() {
|
|
|
|
return stage;
|
|
|
|
}
|
2021-05-28 00:50:57 +02:00
|
|
|
|
|
|
|
protected Player getP1() {
|
|
|
|
return p1;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Player getP2() {
|
|
|
|
return p2;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setF_is(FileInputStream f_is) {
|
|
|
|
this.f_is = f_is;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setWidth(int width) {
|
|
|
|
this.width = width;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setHeight(int height) {
|
|
|
|
this.height = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setR_x(int r_x) {
|
|
|
|
this.r_x = r_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setR_y(int r_y) {
|
|
|
|
this.r_y = r_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setRounds(int rounds) {
|
|
|
|
this.rounds = rounds;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setFullscreen(boolean fullscreen) {
|
|
|
|
this.fullscreen = fullscreen;
|
|
|
|
}
|
|
|
|
|
2021-05-28 00:55:12 +02:00
|
|
|
protected void setStage(String stage) {
|
|
|
|
this.stage = stage;
|
|
|
|
}
|
|
|
|
|
2021-05-28 00:50:57 +02:00
|
|
|
protected void setP1(Player p1) {
|
|
|
|
this.p1 = p1;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void setP2(Player p2) {
|
|
|
|
this.p2 = p2;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|