re size windows

This commit is contained in:
Indy 2021-06-16 14:27:02 +02:00
parent 4c1f4eb441
commit 9edc455895

View File

@ -25,8 +25,16 @@ import gameplay.entities.Character;
import gameplay.input.Inputs; import gameplay.input.Inputs;
import gameplay.input.ButtonIG; import gameplay.input.ButtonIG;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.glfw.GLFW.*;
/** /**
@ -74,6 +82,7 @@ public class match {
private static Engine engine; private static Engine engine;
private static Frame f; private static Frame f;
private static int acCode = 0; private static int acCode = 0;
private static int height, width;
/** /**
* Starts a new round, by placing the timer back at base value, characters back at full hp and such. * Starts a new round, by placing the timer back at base value, characters back at full hp and such.
@ -105,9 +114,30 @@ public class match {
private static void endMatch() { private static void endMatch() {
} }
public static void parse() throws FileNotFoundException {
JSONParser jsonP = new JSONParser();
try {
JSONObject jsonO = (JSONObject) jsonP.parse(new FileReader("game.set"));
JSONArray game = (JSONArray) jsonO.get("game");
JSONObject settings = (JSONObject) game.get(0);
height = Integer.parseInt((String) settings.get("height"));
width = Integer.parseInt((String) settings.get("width"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
engine = new Engine(640, 480, new Vector3f(4.0f, 3.0f)); parse();
engine = new Engine(width, height, new Vector3f(4.0f, 3.0f));
engine.init(); engine.init();
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1); boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);