From 327be47178bebb323f618c6a6d36a12d3b15dbe4 Mon Sep 17 00:00:00 2001 From: inyourwalls Date: Mon, 19 Feb 2024 17:46:42 -0500 Subject: create config class, start working on config screen --- .../customlevelcolour/CustomLevelColourConfig.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java (limited to 'src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java') diff --git a/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java new file mode 100644 index 0000000..b963f02 --- /dev/null +++ b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColourConfig.java @@ -0,0 +1,26 @@ +package net.inyourwalls.customlevelcolour; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Path; + +public class CustomLevelColourConfig { + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + public int outlineColour = 0x000000; + public int textColour = 0x80ff20; + + public static CustomLevelColourConfig load(Path path) throws IOException { + FileReader reader = new FileReader(path.toFile()); + return GSON.fromJson(reader, CustomLevelColourConfig.class); + } + + public static void save(Path path) throws IOException { + FileWriter writer = new FileWriter(path.toFile()); + GSON.toJson(writer); + writer.close(); + } +} -- cgit v1.3.1