diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-05 17:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 17:43:23 +0200 |
commit | ab7256dff5d6d37488081ba7a01b36d3ee9ef563 (patch) | |
tree | 8207341e6c402848cdbe7b2f2297f5f975e0e083 /src/main/java/cc/polyfrost/oneconfig/config | |
parent | a903cfc4d3f76cf3db24749b65156d126fa714e7 (diff) | |
download | OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.gz OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.bz2 OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.zip |
refactor (#36)
* refactor
* fix vig compat
* fix nanovg thingy
* e
* finalize
* gui utils package thingy
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/Config.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java) | 8 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java | 91 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java) | 12 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilantAccessor.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java) | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java | 5 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java) | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/elements/OptionCategory.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java) | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/elements/OptionPage.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/data/OptionPage.java) | 9 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java) | 14 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/Migrator.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/migration/Migrator.java) | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/VigilanceMigrator.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java) | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java | 4 |
12 files changed, 32 insertions, 121 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java index 8eb5eb1..d0d8acf 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java @@ -1,16 +1,20 @@ -package cc.polyfrost.oneconfig.config.interfaces; +package cc.polyfrost.oneconfig.config; import cc.polyfrost.oneconfig.config.annotations.ConfigPage; import cc.polyfrost.oneconfig.config.annotations.Option; import cc.polyfrost.oneconfig.config.core.ConfigCore; import cc.polyfrost.oneconfig.config.data.*; +import cc.polyfrost.oneconfig.config.elements.BasicOption; +import cc.polyfrost.oneconfig.config.elements.OptionCategory; +import cc.polyfrost.oneconfig.config.elements.OptionPage; +import cc.polyfrost.oneconfig.config.elements.OptionSubcategory; import cc.polyfrost.oneconfig.config.profiles.Profiles; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.gui.elements.config.*; import cc.polyfrost.oneconfig.gui.pages.ModConfigPage; import cc.polyfrost.oneconfig.hud.BasicHud; import cc.polyfrost.oneconfig.hud.HudCore; -import cc.polyfrost.oneconfig.utils.GuiUtils; +import cc.polyfrost.oneconfig.utils.gui.GuiUtils; import com.google.gson.*; import java.io.*; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java deleted file mode 100644 index b867bc0..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java +++ /dev/null @@ -1,91 +0,0 @@ -package cc.polyfrost.oneconfig.config; - -import cc.polyfrost.oneconfig.config.core.OneColor; -import cc.polyfrost.oneconfig.config.data.Mod; -import cc.polyfrost.oneconfig.config.interfaces.Config; -import com.google.gson.JsonParser; - -import java.awt.*; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; - -public class OneConfigConfig extends Config { - - // the color library - public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent - public static final int BLACK = new Color(0, 0, 0, 255).getRGB(); // Black - public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900 - public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB(); // Gray 900 80% - public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB(); // Gray 800 - public static final int GRAY_800_95 = new Color(21, 22, 23, 242).getRGB(); - public static final int GRAY_700 = new Color(34, 35, 38, 255).getRGB(); // Gray 700 - public static final int GRAY_600 = new Color(42, 44, 48, 255).getRGB(); // Gray 600 - public static final int GRAY_500 = new Color(49, 51, 56, 255).getRGB(); // Gray 500 // button sidebar hover, button gray normal - public static final int GRAY_500_80 = new Color(49, 51, 56, 204).getRGB(); // Gray 500 80% // button sidebar pressed - public static final int GRAY_400 = new Color(55, 59, 69, 255).getRGB(); // Gray 400 - public static final int GRAY_300 = new Color(73, 79, 92, 255).getRGB(); // Gray 300 // button gray hover - public static final int GRAY_400_80 = new Color(55, 59, 69, 204).getRGB(); // Gray 400 80% // button gray pressed - public static final int PRIMARY_800 = new Color(13, 51, 128, 255).getRGB(); // Blue 800 - public static final int PRIMARY_700 = new Color(18, 71, 178, 255).getRGB(); // Blue 700 - public static final int PRIMARY_700_80 = new Color(18, 71, 178, 204).getRGB(); // Blue 700 80% - public static final int PRIMARY_600 = new Color(20, 82, 204, 255).getRGB(); // Blue 600 // button blue normal - public static final int PRIMARY_500 = new Color(25, 103, 255, 255).getRGB(); // Blue 500 // button blue hover - public static final int PRIMARY_400 = new Color(48, 129, 242, 255).getRGB(); - public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB(); // White 60% - public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB(); // White 60% - public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB(); // White 80% - public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB(); // White 90% - public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 90% - public static final int WHITE = new Color(255, 255, 255, 255).getRGB(); // White 100% - public static final int SUCCESS_600 = new Color(3, 152, 85).getRGB(); - public static final int SUCCESS_700 = new Color(2, 121, 72).getRGB(); - public static final int WARNING_500 = new Color(247, 144, 9).getRGB(); - public static final int WARNING_600 = new Color(220, 104, 3).getRGB(); - public static final int ERROR_600_80 = new Color(217, 32, 32, 204).getRGB(); - public static final int ERROR_600 = new Color(217, 32, 32).getRGB(); - public static final int ERROR_700 = new Color(180, 24, 24).getRGB(); // Red 700 - public static final int ERROR_800 = new Color(145, 24, 24).getRGB(); // Red 800 - public static final int ERROR_800_80 = new Color(145, 24, 24, 204).getRGB(); // Red 800 - public static final int ERROR_300 = new Color(253, 155, 155).getRGB(); - public static final int ERROR_300_80 = new Color(253, 155, 155, 204).getRGB(); - public static String currentProfile = "Default Profile"; - public static ArrayList<String> favoriteMods = new ArrayList<>(); - public static ArrayList<OneColor> favoriteColors = new ArrayList<>(); - public static ArrayList<OneColor> recentColors = new ArrayList<>(); - public static boolean ROUNDED_CORNERS = true; - public static float CORNER_RADIUS_WIN = 20f; - public static float CORNER_RADIUS = 12f; - - public static boolean allShowShortCut = false; - - public OneConfigConfig() { - super(null, "OneConfig.json"); - } - - @Override - public void init(Mod mod) { - if (new File("OneConfig/" + configFile).exists()) load(); - else save(); - } - - @Override - public void save() { - try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) { - writer.write(gson.toJson(this)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void load() { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) { - deserializePart(new JsonParser().parse(reader).getAsJsonObject(), this); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java index fa4f058..cfa717f 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java @@ -1,13 +1,13 @@ -package cc.polyfrost.oneconfig.config.compatibility; +package cc.polyfrost.oneconfig.config.compatibility.vigilance; import cc.polyfrost.oneconfig.config.core.ConfigCore; import cc.polyfrost.oneconfig.config.core.OneColor; import cc.polyfrost.oneconfig.config.data.Mod; -import cc.polyfrost.oneconfig.config.data.OptionCategory; -import cc.polyfrost.oneconfig.config.data.OptionPage; -import cc.polyfrost.oneconfig.config.data.OptionSubcategory; -import cc.polyfrost.oneconfig.config.interfaces.BasicOption; -import cc.polyfrost.oneconfig.config.interfaces.Config; +import cc.polyfrost.oneconfig.config.elements.OptionCategory; +import cc.polyfrost.oneconfig.config.elements.OptionPage; +import cc.polyfrost.oneconfig.config.elements.OptionSubcategory; +import cc.polyfrost.oneconfig.config.elements.BasicOption; +import cc.polyfrost.oneconfig.config.Config; import cc.polyfrost.oneconfig.gui.elements.config.*; import gg.essential.vigilance.Vigilant; import gg.essential.vigilance.data.*; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilantAccessor.java index ca2b1da..c449bd9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilantAccessor.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.config.compatibility; +package cc.polyfrost.oneconfig.config.compatibility.vigilance; import gg.essential.vigilance.data.PropertyCollector; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java index 241dca7..090d1f8 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java @@ -1,7 +1,8 @@ package cc.polyfrost.oneconfig.config.data; -import cc.polyfrost.oneconfig.config.interfaces.Config; -import cc.polyfrost.oneconfig.config.migration.Migrator; +import cc.polyfrost.oneconfig.config.Config; +import cc.polyfrost.oneconfig.config.elements.OptionPage; +import cc.polyfrost.oneconfig.config.migration.vigilance.Migrator; import org.jetbrains.annotations.Nullable; public class Mod { diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java index d4b4498..d4efeaa 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.config.interfaces; +package cc.polyfrost.oneconfig.config.elements; import java.lang.reflect.Field; import java.util.function.Supplier; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionCategory.java index 76b2b34..4a37bfc 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionCategory.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.config.data; +package cc.polyfrost.oneconfig.config.elements; import java.util.ArrayList; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionPage.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionPage.java index 32a07b9..5eaac8b 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionPage.java @@ -1,15 +1,12 @@ -package cc.polyfrost.oneconfig.config.data; +package cc.polyfrost.oneconfig.config.elements; + +import cc.polyfrost.oneconfig.config.data.Mod; import java.util.LinkedHashMap; public class OptionPage { public final String name; public final Mod mod; - /** - * Depth 1 = categories - * Depth 2 = subcategories - * Depth 3 = list of options - */ public final LinkedHashMap<String, OptionCategory> categories = new LinkedHashMap<>(); public OptionPage(String name, Mod mod) { diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java index e69e077..ff1d770 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java @@ -1,11 +1,11 @@ -package cc.polyfrost.oneconfig.config.data; +package cc.polyfrost.oneconfig.config.elements; -import cc.polyfrost.oneconfig.config.OneConfigConfig; -import cc.polyfrost.oneconfig.config.interfaces.BasicOption; +import cc.polyfrost.oneconfig.gui.Colors; +import cc.polyfrost.oneconfig.config.elements.BasicOption; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.gui.elements.config.ConfigPageButton; -import cc.polyfrost.oneconfig.lwjgl.RenderManager; -import cc.polyfrost.oneconfig.lwjgl.font.Fonts; +import cc.polyfrost.oneconfig.renderer.RenderManager; +import cc.polyfrost.oneconfig.renderer.font.Fonts; import java.util.ArrayList; @@ -45,7 +45,7 @@ public class OptionSubcategory { if (filteredOptions.size() == 0 && filteredTop.size() == 0 && filteredBottom.size() == 0) return 0; int optionY = y; if (!name.equals("")) { - RenderManager.drawText(vg, name, x, y + 12, OneConfigConfig.WHITE_90, 24, Fonts.MEDIUM); + RenderManager.drawText(vg, name, x, y + 12, Colors.WHITE_90, 24, Fonts.MEDIUM); optionY += 36; } @@ -68,7 +68,7 @@ public class OptionSubcategory { } backgroundSize += option.getHeight() + 16; } - RenderManager.drawRoundedRect(vg, x - 16, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20); + RenderManager.drawRoundedRect(vg, x - 16, optionY, 1024, backgroundSize, Colors.GRAY_900, 20); optionY += 16; } diff --git a/src/main/java/cc/polyfrost/oneconfig/config/migration/Migrator.java b/src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/Migrator.java index abfb2a0..f3f60b7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/migration/Migrator.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/Migrator.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.config.migration; +package cc.polyfrost.oneconfig.config.migration.vigilance; import java.lang.reflect.Field; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java b/src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/VigilanceMigrator.java index b45aeba..2870e03 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/migration/vigilance/VigilanceMigrator.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.config.migration; +package cc.polyfrost.oneconfig.config.migration.vigilance; import cc.polyfrost.oneconfig.config.annotations.VigilanceName; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java index dfc5e16..006fea9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java @@ -1,8 +1,8 @@ package cc.polyfrost.oneconfig.config.profiles; -import cc.polyfrost.oneconfig.OneConfig; -import cc.polyfrost.oneconfig.config.OneConfigConfig; +import cc.polyfrost.oneconfig.internal.OneConfig; import cc.polyfrost.oneconfig.config.core.ConfigCore; +import cc.polyfrost.oneconfig.internal.config.OneConfigConfig; import org.apache.commons.io.FileUtils; import java.io.File; |