aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-30 12:37:21 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-30 12:37:21 +0200
commit78fab84df48759e8968c477924b4bcc3b81e6cee (patch)
tree1273be94b15da4f468c7c7f94efcb57d2cd7f593 /src
parentcb211a4c727243ede579a439008c6097506fe046 (diff)
downloadOneConfig-78fab84df48759e8968c477924b4bcc3b81e6cee.tar.gz
OneConfig-78fab84df48759e8968c477924b4bcc3b81e6cee.tar.bz2
OneConfig-78fab84df48759e8968c477924b4bcc3b81e6cee.zip
config page system rewrite start
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java17
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java8
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java16
3 files changed, 30 insertions, 11 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java b/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java
new file mode 100644
index 0000000..4286264
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java
@@ -0,0 +1,17 @@
+package io.polyfrost.oneconfig.config.data;
+
+import io.polyfrost.oneconfig.config.interfaces.BasicOption;
+import io.polyfrost.oneconfig.gui.elements.config.ConfigPage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class OptionCategory {
+ public final HashMap<String, ArrayList<BasicOption>> options;
+ public final ArrayList<ConfigPage> pages;
+
+ public OptionCategory(HashMap<String, ArrayList<BasicOption>> options, ArrayList<ConfigPage> pages) {
+ this.options = options;
+ this.pages = pages;
+ }
+}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
index 581257b..62637e9 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
@@ -26,16 +26,16 @@ public class ConfigSwitch extends BasicOption {
toggled = (boolean) get();
} catch (IllegalAccessException ignored) {
}
- int x2 = x + 19 + (int) (percentOn * 18);
+ int x2 = x + 3 + (int) (percentOn * 18);
color = ColorUtils.smoothColor(color, OneConfigConfig.GRAY_400, OneConfigConfig.BLUE_500, toggled, 20f);
if (color == -15123643) {
color = OneConfigConfig.GRAY_400;
}
- RenderManager.drawRoundedRect(vg, x + 16, y + 4, 42, 24, color, 12f);
+ RenderManager.drawRoundedRect(vg, x, y + 4, 42, 24, color, 12f);
RenderManager.drawRoundedRect(vg, x2, y + 7, 18, 18, OneConfigConfig.WHITE, 9f);
- RenderManager.drawString(vg, name, x + 66, y + 17, OneConfigConfig.WHITE, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x + 50, y + 17, OneConfigConfig.WHITE, 18f, Fonts.INTER_MEDIUM);
- if (InputUtils.isAreaClicked(x + 16, y, 42, 32)) {
+ if (InputUtils.isAreaClicked(x, y, 42, 32)) {
toggled = !toggled;
try {
set(toggled);
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
index 79e04ff..2b31421 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -19,9 +19,10 @@ public class ModConfigPage extends Page {
if (page.categories.size() == 0) return;
String selectedCategory = page.categories.keySet().stream().findFirst().get();
int optionX = x + 30;
- int optionY = y + (page.categories.size() == 1 ? 32 : 72);
+ int optionY = y + (page.categories.size() == 1 ? 16 : 64);
+ int backgroundSize = 48;
for (String subCategory : page.categories.get(selectedCategory).keySet()) {
- int backgroundSize = 48;
+ backgroundSize += 32;
for (int i = 0; i < page.categories.get(selectedCategory).get(subCategory).size(); i++) {
BasicOption option = page.categories.get(selectedCategory).get(subCategory).get(i);
if (i + 1 < page.categories.get(selectedCategory).get(subCategory).size()) {
@@ -34,10 +35,12 @@ public class ModConfigPage extends Page {
}
backgroundSize += option.getHeight() + 16;
}
- RenderManager.drawRoundedRect(vg, x + 14, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20);
+ }
+ RenderManager.drawRoundedRect(vg, x + 14, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20);
- optionY += 16;
- RenderManager.drawString(vg, subCategory, x + 18, optionY, OneConfigConfig.WHITE, 24f, Fonts.INTER_MEDIUM);
+ optionY += 16;
+ for (String subCategory : page.categories.get(selectedCategory).keySet()) {
+ RenderManager.drawString(vg, subCategory, optionX, optionY + 16, OneConfigConfig.WHITE_90, 24f, Fonts.INTER_MEDIUM);
optionY += 48;
for (int i = 0; i < page.categories.get(selectedCategory).get(subCategory).size(); i++) {
BasicOption option = page.categories.get(selectedCategory).get(subCategory).get(i);
@@ -45,7 +48,7 @@ public class ModConfigPage extends Page {
if (i + 1 < page.categories.get(selectedCategory).get(subCategory).size()) {
BasicOption nextOption = page.categories.get(selectedCategory).get(subCategory).get(i + 1);
if (option.size == 1 && option.hasHalfSize() && nextOption.size == 1 && nextOption.hasHalfSize()) {
- nextOption.draw(vg, optionX + 528, optionY);
+ nextOption.draw(vg, optionX + 512, optionY);
optionY += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
i++;
continue;
@@ -53,7 +56,6 @@ public class ModConfigPage extends Page {
}
optionY += option.getHeight() + 16;
}
- optionY += 28;
}
}