diff options
| -rw-r--r-- | .classpath | 19 | ||||
| -rw-r--r-- | lib/json-simple-1.1.1.jar | bin | 0 -> 23737 bytes | |||
| -rw-r--r-- | src/assets/settings.json | 5 | ||||
| -rw-r--r-- | src/gui/JsonReader.java | 5 | ||||
| -rw-r--r-- | src/gui/JsonStructure.java | 5 | ||||
| -rw-r--r-- | src/gui/JsonValue.java | 9 | ||||
| -rw-r--r-- | src/gui/JsonWriter.java | 5 | ||||
| -rw-r--r-- | src/gui/SettingsController.java | 51 | 
8 files changed, 65 insertions, 34 deletions
| @@ -1,18 +1,19 @@  <?xml version="1.0" encoding="UTF-8"?>
  <classpath>
  	<classpathentry kind="src" path="src"/>
 -	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
 +	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
  		<attributes>
  			<attribute name="module" value="true"/>
  		</attributes>
  	</classpathentry>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.base.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.controls.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.fxml.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.graphics.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.media.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.swing.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx.web.jar"/>
 -	<classpathentry exported="true" kind="lib" path="lib/windows/lib/javafx-swt.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.base.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.controls.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.fxml.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.graphics.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.media.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.swing.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx.web.jar"/>
 +	<classpathentry kind="lib" path="lib/windows/lib/javafx-swt.jar"/>
 +	<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
  	<classpathentry kind="output" path="bin"/>
  </classpath>
 diff --git a/lib/json-simple-1.1.1.jar b/lib/json-simple-1.1.1.jarBinary files differ new file mode 100644 index 0000000..66347a6 --- /dev/null +++ b/lib/json-simple-1.1.1.jar diff --git a/src/assets/settings.json b/src/assets/settings.json new file mode 100644 index 0000000..37f05f1 --- /dev/null +++ b/src/assets/settings.json @@ -0,0 +1,5 @@ +{
 +    "musicVol": 100,
 +    "effectsVol": 100,
 +    "fullscreen": true
 +}
\ No newline at end of file diff --git a/src/gui/JsonReader.java b/src/gui/JsonReader.java deleted file mode 100644 index b1da06f..0000000 --- a/src/gui/JsonReader.java +++ /dev/null @@ -1,5 +0,0 @@ -package gui;
 -
 -public interface JsonReader {
 -
 -}
 diff --git a/src/gui/JsonStructure.java b/src/gui/JsonStructure.java deleted file mode 100644 index 1ea2fa1..0000000 --- a/src/gui/JsonStructure.java +++ /dev/null @@ -1,5 +0,0 @@ -package gui;
 -
 -public interface JsonStructure {
 -
 -}
 diff --git a/src/gui/JsonValue.java b/src/gui/JsonValue.java deleted file mode 100644 index e91f45b..0000000 --- a/src/gui/JsonValue.java +++ /dev/null @@ -1,9 +0,0 @@ -package gui;
 -
 -public interface JsonValue 
 -{
 -	static JsonValue.ValueType getValueType() 
 -	{
 -		return null;
 -	}
 -}
 diff --git a/src/gui/JsonWriter.java b/src/gui/JsonWriter.java deleted file mode 100644 index 04fae8e..0000000 --- a/src/gui/JsonWriter.java +++ /dev/null @@ -1,5 +0,0 @@ -package gui;
 -
 -public interface JsonWriter {
 -
 -}
 diff --git a/src/gui/SettingsController.java b/src/gui/SettingsController.java index 8898dc3..66da588 100644 --- a/src/gui/SettingsController.java +++ b/src/gui/SettingsController.java @@ -1,5 +1,54 @@  package gui;
 -public class SettingsController {
 +import java.util.Map;
 +import java.util.HashMap;
 +import java.io.FileWriter;
 +import java.io.FileNotFoundException;
 +import java.io.FileReader;
 +import java.io.IOException;
 +import org.json.simple.JSONObject;
 +import org.json.simple.JSONArray;
 +import org.json.simple.parser.JSONParser;
 +import org.json.simple.parser.ParseException;
 +
 +public class SettingsController 
 +{
 +	private int effectsVol;
 +	private int musicVol;
 +	private boolean fullscreen;
 +	private JSONObject settings;
 +	
 +	public void saveAndWrite(int newEffVol, int newMusVol, boolean isFull)
 +	{
 +		
 +	}
 +	
 +	public void readFile() throws ParseException
 +	{
 +		JSONParser jsonParser = new JSONParser(); //parser to read the file
 +		
 +		try(FileReader reader = new FileReader("settings.json"))
 +		{
 +			Object obj = jsonParser.parse(reader); 
 +			
 +			settings = (JSONObject)(obj); //converts read object to a JSONObject
 +			
 +			effectsVol = (int) settings.get("effectsVol");
 +			musicVol = (int) settings.get("musicVol");
 +			fullscreen = (boolean) settings.get("fullscreen");
 +		}
 +		catch (FileNotFoundException e) 
 +		{
 +			// TODO Auto-generated catch block
 +			e.printStackTrace();
 +		} 
 +		catch (IOException e) 
 +		{
 +			// TODO Auto-generated catch block
 +			e.printStackTrace();
 +		}
 +				
 +	}
 +	
  }
 | 
