diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 1d1d8ad..05649d6 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -25,8 +25,16 @@ import gameplay.entities.Character; import gameplay.input.Inputs; import gameplay.input.ButtonIG; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; 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.*; /** @@ -74,6 +82,7 @@ public class match { private static Engine engine; private static Frame f; 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. @@ -105,9 +114,30 @@ public class match { 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 { - 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(); boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);