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 17:05:10 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-30 17:05:10 +0200
commit0283a6618360ed473da42c1144da5b44146155bb (patch)
tree7002057b340df87e20989473a7f370aa89f5ad44 /src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
parent026aebb4748747f08d5088947056a75740550b17 (diff)
downloadOneConfig-0283a6618360ed473da42c1144da5b44146155bb.tar.gz
OneConfig-0283a6618360ed473da42c1144da5b44146155bb.tar.bz2
OneConfig-0283a6618360ed473da42c1144da5b44146155bb.zip
more config system stuff
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.java39
1 files changed, 26 insertions, 13 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 2b31421..4827ebe 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -3,6 +3,7 @@ package io.polyfrost.oneconfig.gui.pages;
import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.config.data.OptionPage;
import io.polyfrost.oneconfig.config.interfaces.BasicOption;
+import io.polyfrost.oneconfig.gui.elements.config.ConfigPageButton;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
@@ -20,13 +21,19 @@ public class ModConfigPage extends Page {
String selectedCategory = page.categories.keySet().stream().findFirst().get();
int optionX = x + 30;
int optionY = y + (page.categories.size() == 1 ? 16 : 64);
+
+ for (ConfigPageButton page : page.categories.get(selectedCategory).topPages) {
+ page.draw(vg, optionX, optionY);
+ optionY += page.getHeight() + 16;
+ }
+
int backgroundSize = 48;
- for (String subCategory : page.categories.get(selectedCategory).keySet()) {
+ for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) {
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()) {
- BasicOption nextOption = page.categories.get(selectedCategory).get(subCategory).get(i + 1);
+ 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);
+ 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()) {
backgroundSize += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
i++;
@@ -39,14 +46,14 @@ public class ModConfigPage extends Page {
RenderManager.drawRoundedRect(vg, x + 14, optionY, 1024, backgroundSize, OneConfigConfig.GRAY_900, 20);
optionY += 16;
- for (String subCategory : page.categories.get(selectedCategory).keySet()) {
+ 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;
- for (int i = 0; i < page.categories.get(selectedCategory).get(subCategory).size(); i++) {
- BasicOption option = page.categories.get(selectedCategory).get(subCategory).get(i);
+ 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.draw(vg, optionX, optionY);
- if (i + 1 < page.categories.get(selectedCategory).get(subCategory).size()) {
- BasicOption nextOption = page.categories.get(selectedCategory).get(subCategory).get(i + 1);
+ 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.draw(vg, optionX + 512, optionY);
optionY += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
@@ -57,6 +64,12 @@ public class ModConfigPage extends Page {
optionY += option.getHeight() + 16;
}
}
+ optionY += 16;
+
+ for (ConfigPageButton page : page.categories.get(selectedCategory).bottomPages) {
+ page.draw(vg, optionX, optionY);
+ optionY += page.getHeight() + 16;
+ }
}
@Override
@@ -68,9 +81,9 @@ public class ModConfigPage extends Page {
public void keyTyped(char key, int keyCode) {
if (page.categories.size() == 0) return;
String selectedCategory = page.categories.keySet().stream().findFirst().get();
- for (String subCategory : page.categories.get(selectedCategory).keySet()) {
- for (int i = 0; i < page.categories.get(selectedCategory).get(subCategory).size(); i++) {
- page.categories.get(selectedCategory).get(subCategory).get(i).keyTyped(key, keyCode);
+ for (String subCategory : page.categories.get(selectedCategory).subcategories.keySet()) {
+ for (int i = 0; i < page.categories.get(selectedCategory).subcategories.get(subCategory).size(); i++) {
+ page.categories.get(selectedCategory).subcategories.get(subCategory).get(i).keyTyped(key, keyCode);
}
}
}