aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-30 18:10:49 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-30 18:10:49 +0200
commit5514e4b97ab2a7a37bf25cf4a4a57baf8f94e052 (patch)
tree6bc07d092ae94f89f6013563fa7c5d3ceccfdbae /src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
parent0283a6618360ed473da42c1144da5b44146155bb (diff)
downloadOneConfig-5514e4b97ab2a7a37bf25cf4a4a57baf8f94e052.tar.gz
OneConfig-5514e4b97ab2a7a37bf25cf4a4a57baf8f94e052.tar.bz2
OneConfig-5514e4b97ab2a7a37bf25cf4a4a57baf8f94e052.zip
uni selector
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java24
1 files changed, 24 insertions, 0 deletions
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 4827ebe..f3224b5 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -22,11 +22,13 @@ public class ModConfigPage extends Page {
int optionX = x + 30;
int optionY = y + (page.categories.size() == 1 ? 16 : 64);
+ // Top page buttons
for (ConfigPageButton page : page.categories.get(selectedCategory).topPages) {
page.draw(vg, optionX, optionY);
optionY += page.getHeight() + 16;
}
+ // Background
int backgroundSize = 48;
for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) {
backgroundSize += 32;
@@ -45,7 +47,9 @@ public class ModConfigPage extends Page {
}
RenderManager.drawRoundedRect(vg, x + 14, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20);
+ // draw options
optionY += 16;
+ int optionLastY = optionX;
for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) {
RenderManager.drawString(vg, subCategory, optionX, optionY + 16, OneConfigConfig.WHITE_90, 24f, Fonts.INTER_MEDIUM);
optionY += 48;
@@ -66,10 +70,30 @@ public class ModConfigPage extends Page {
}
optionY += 16;
+ // Bottom page buttons
for (ConfigPageButton page : page.categories.get(selectedCategory).bottomPages) {
page.draw(vg, optionX, optionY);
optionY += page.getHeight() + 16;
}
+
+ // Draw last options
+ for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) {
+ optionLastY += 48;
+ for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) {
+ BasicOption option = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i);
+ option.drawLast(vg, optionX, optionLastY);
+ if (i + 1 < page.categories.get(selectedCategory).subcategories.get(subCategory).size()) {
+ BasicOption nextOption = page.categories.get(selectedCategory).subcategories.get(subCategory).get(i + 1);
+ if (option.size == 1 && option.hasHalfSize() && nextOption.size == 1 && nextOption.hasHalfSize()) {
+ nextOption.drawLast(vg, optionX + 512, optionLastY);
+ optionLastY += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
+ i++;
+ continue;
+ }
+ }
+ optionLastY += option.getHeight() + 16;
+ }
+ }
}
@Override