diff options
| author | Zach Jordan <zxjordan5@gmail.com> | 2023-05-23 08:40:03 -0400 | 
|---|---|---|
| committer | Zach Jordan <zxjordan5@gmail.com> | 2023-05-23 08:40:03 -0400 | 
| commit | a3c83b1bcddb002e61f691ccade3545c7d7e5693 (patch) | |
| tree | 5e9967542c019ae040911ec3ce7587357b66a575 | |
| parent | 1ec2cdd33df864b55cafe3326aadaf8e83cb0651 (diff) | |
| download | NPEhero-a3c83b1bcddb002e61f691ccade3545c7d7e5693.tar.gz NPEhero-a3c83b1bcddb002e61f691ccade3545c7d7e5693.tar.bz2 NPEhero-a3c83b1bcddb002e61f691ccade3545c7d7e5693.zip | |
edited settings controller, now can read and write to file
Diffstat (limited to '')
| -rw-r--r-- | src/main/SettingsController.java | 15 | 
1 files changed, 13 insertions, 2 deletions
| diff --git a/src/main/SettingsController.java b/src/main/SettingsController.java index 2e2d988..0dcf707 100644 --- a/src/main/SettingsController.java +++ b/src/main/SettingsController.java @@ -24,6 +24,19 @@ public class SettingsController  	public void saveAndWrite(int newEffVol, int newMusVol, boolean isFull)
  	{
 +		settings.put("musicVol", newMusVol);
 +		settings.put("effectsVol", newEffVol);
 +		settings.put("fullscreen", isFull);
 +
 +		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
 @@ -42,12 +55,10 @@ public class SettingsController  		}
  		catch (FileNotFoundException e) 
  		{
 -			// TODO Auto-generated catch block
  			e.printStackTrace();
  		} 
  		catch (IOException e) 
  		{
 -			// TODO Auto-generated catch block
  			e.printStackTrace();
  		}
 | 
