From 4e43d6f020d908ccd9b8a6b77803cac943da00ed Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 2 Jun 2023 00:48:13 -0400 Subject: Finish levelUtility and project cleanup --- src/main/SettingsController.java | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/main/SettingsController.java') diff --git a/src/main/SettingsController.java b/src/main/SettingsController.java index f3bd671..4bd2b24 100644 --- a/src/main/SettingsController.java +++ b/src/main/SettingsController.java @@ -15,26 +15,9 @@ public class SettingsController { public SimpleIntegerProperty effectsVol = new SimpleIntegerProperty(0); public SimpleIntegerProperty musicVol = new SimpleIntegerProperty(0); - private boolean fullscreen; private JSONObject settings; - public void saveAndWrite(int newEffVol, int newMusVol) - { - settings.put("musicVol", newMusVol); - settings.put("effectsVol", newEffVol); - try (FileWriter file = new FileWriter("settings.json")) - { - //write the settings JSONObject instance to the file - file.write(settings.toJSONString()); - file.flush(); - - } - catch (IOException e) { - e.printStackTrace(); - } - } - - public void readFile() throws ParseException + public void read() throws ParseException { JSONParser jsonParser = new JSONParser(); //parser to read the file @@ -57,5 +40,20 @@ public class SettingsController } } - + + public void write(int newEffVol, int newMusVol) + { + settings.put("musicVol", newMusVol); + settings.put("effectsVol", newEffVol); + try (FileWriter file = new FileWriter("settings.json")) + { + //write the settings JSONObject instance to the file + file.write(settings.toJSONString()); + file.flush(); + + } + catch (IOException e) { + e.printStackTrace(); + } + } } -- cgit v1.2.3