aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java17
2 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java
index 64c31cf..82d8b31 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/BasicOption.java
@@ -27,6 +27,7 @@
package cc.polyfrost.oneconfig.config.elements;
import cc.polyfrost.oneconfig.config.Config;
+import cc.polyfrost.oneconfig.utils.InputHandler;
import java.lang.reflect.Field;
import java.util.ArrayList;
@@ -91,7 +92,7 @@ public abstract class BasicOption {
* @param x x position
* @param y y position
*/
- public abstract void draw(long vg, int x, int y);
+ public abstract void draw(long vg, int x, int y, InputHandler inputHandler);
/**
* Function that gets called last drawing option,
@@ -101,7 +102,7 @@ public abstract class BasicOption {
* @param x x position
* @param y y position
*/
- public void drawLast(long vg, int x, int y) {
+ public void drawLast(long vg, int x, int y , InputHandler inputHandler) {
}
/**
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java
index 80e8964..282f30f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/elements/OptionSubcategory.java
@@ -32,6 +32,7 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.config.ConfigPageButton;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.utils.InputHandler;
import java.util.ArrayList;
import java.util.List;
@@ -49,7 +50,7 @@ public class OptionSubcategory {
this.name = name;
}
- public int draw(long vg, int x, int y) {
+ public int draw(long vg, int x, int y, InputHandler inputHandler) {
String filter = OneConfigGui.INSTANCE == null ? "" : OneConfigGui.INSTANCE.getSearchValue().toLowerCase().trim();
filteredOptions = options.stream().filter(option -> !option.isHidden() && (filter.equals("") || name.toLowerCase().contains(filter) || option.name.toLowerCase().contains(filter))).collect(Collectors.toList());
List<ConfigPageButton> filteredTop = topButtons.stream().filter(page -> !page.isHidden() && (filter.equals("") || name.toLowerCase().contains(filter) || page.name.toLowerCase().contains(filter) || page.description.toLowerCase().contains(filter))).collect(Collectors.toList());
@@ -62,7 +63,7 @@ public class OptionSubcategory {
}
for (ConfigPageButton page : filteredTop) {
- page.draw(vg, x, optionY);
+ page.draw(vg, x, optionY, inputHandler);
optionY += page.getHeight() + 16;
}
@@ -88,11 +89,11 @@ public class OptionSubcategory {
if (filteredOptions.size() > 0) {
for (int i = 0; i < filteredOptions.size(); i++) {
BasicOption option = filteredOptions.get(i);
- option.draw(vg, x, optionY);
+ option.draw(vg, x, optionY, inputHandler);
if (i + 1 < filteredOptions.size()) {
BasicOption nextOption = filteredOptions.get(i + 1);
if (option.size == 1 && nextOption.size == 1) {
- nextOption.draw(vg, x + 512, optionY);
+ nextOption.draw(vg, x + 512, optionY, inputHandler);
optionY += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
i++;
continue;
@@ -104,21 +105,21 @@ public class OptionSubcategory {
}
for (ConfigPageButton page : filteredBottom) {
- page.draw(vg, x, optionY);
+ page.draw(vg, x, optionY, inputHandler);
optionY += page.getHeight() + 16;
}
return optionY - y;
}
- public void drawLast(long vg, int x) {
+ public void drawLast(long vg, int x, InputHandler inputHandler) {
for (int i = 0; i < filteredOptions.size(); i++) {
BasicOption option = filteredOptions.get(i);
- option.drawLast(vg, x, drawLastY);
+ option.drawLast(vg, x, drawLastY, inputHandler);
if (i + 1 < filteredOptions.size()) {
BasicOption nextOption = filteredOptions.get(i + 1);
if (option.size == 1 && nextOption.size == 1) {
- nextOption.drawLast(vg, x + 512, drawLastY);
+ nextOption.drawLast(vg, x + 512, drawLastY, inputHandler);
drawLastY += Math.max(option.getHeight(), nextOption.getHeight()) + 16;
i++;
continue;