aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-25 13:12:22 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-25 13:12:22 +0100
commit89d6576a7777a2949e04b2c6c8d2eb015a733529 (patch)
tree1a6906f9c71591aacbcbf5a32a1a1ed582b95fcb /src/main/java/io/polyfrost/oneconfig/gui
parent29156d83c4213e319149fa5e0a926dd913404528 (diff)
downloadOneConfig-89d6576a7777a2949e04b2c6c8d2eb015a733529.tar.gz
OneConfig-89d6576a7777a2949e04b2c6c8d2eb015a733529.tar.bz2
OneConfig-89d6576a7777a2949e04b2c6c8d2eb015a733529.zip
add size, do some config element stuff, fixes for cards, finish mods page and performance page, cleanup and some more
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/HudGui.java1
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java28
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/SideBar.java10
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/BasicButton.java11
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/ModCard.java69
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/SearchField.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java98
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java20
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigCategory.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigHud.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java1
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java52
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java74
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java8
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/PerformanceModsPage.java42
20 files changed, 348 insertions, 110 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/io/polyfrost/oneconfig/gui/HudGui.java
index 12b9755..32e401b 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/HudGui.java
@@ -3,7 +3,6 @@ package io.polyfrost.oneconfig.gui;
import io.polyfrost.oneconfig.hud.HudCore;
import io.polyfrost.oneconfig.hud.interfaces.BasicHud;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
-import io.polyfrost.oneconfig.test.TestHud;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.input.Keyboard;
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
index 6f8aeea..fd0ef47 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -12,7 +12,8 @@ import net.minecraft.client.gui.GuiScreen;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
-import static org.lwjgl.nanovg.NanoVG.*;
+import static org.lwjgl.nanovg.NanoVG.nvgResetScissor;
+import static org.lwjgl.nanovg.NanoVG.nvgScissor;
public class OneConfigGui extends GuiScreen {
public static OneConfigGui INSTANCE;
@@ -33,13 +34,15 @@ public class OneConfigGui extends GuiScreen {
public OneConfigGui() {
INSTANCE = this;
}
+
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
+ long start = System.nanoTime();
RenderManager.setupAndDraw((vg) -> {
- if(currentPage == null) currentPage = new HomePage();
+ if (currentPage == null) currentPage = new HomePage();
//nvgScale(vg, 0.5f, 0.5f);
- if(OneConfigConfig.ROUNDED_CORNERS) {
+ if (OneConfigConfig.ROUNDED_CORNERS) {
RenderManager.drawRoundedRect(vg, 544, 140, 1056, 800, OneConfigConfig.GRAY_800, OneConfigConfig.CORNER_RADIUS_WIN);
RenderManager.drawRoundedRect(vg, 320, 140, 244, 800, OneConfigConfig.GRAY_900_80, OneConfigConfig.CORNER_RADIUS_WIN);
RenderManager.drawRect(vg, 544, 140, 20, 800, OneConfigConfig.GRAY_800);
@@ -48,21 +51,22 @@ public class OneConfigGui extends GuiScreen {
// L;
}
- RenderManager.drawLine(vg, 544, 212, 1600, 212, 1, OneConfigConfig.GRAY_700);
+ RenderManager.drawLine(vg, 544, 212, 1600, 212, 1, OneConfigConfig.GRAY_700);
RenderManager.drawLine(vg, 544, 140, 544, 940, 1, OneConfigConfig.GRAY_700);
RenderManager.drawImage(vg, "/assets/oneconfig/textures/icon.png", x + 19, y + 19, 42, 42);
RenderManager.drawString(vg, "OneConfig", x + 69, y + 32, OneConfigConfig.WHITE, 18f, Fonts.INTER_BOLD); // added half line height to center text
RenderManager.drawString(vg, "By Polyfrost", x + 69, y + 51, OneConfigConfig.WHITE, 12f, Fonts.INTER_REGULAR);
+ textInputField.draw(vg, x + 400, y + 200);
//element.setColorPalette(0);
sideBar.draw(vg, x, y);
nvgScissor(vg, x + 224, y + 72, 1056, 728);
- if(prevPage != null) {
+ if (prevPage != null) {
pageProgress = MathUtils.easeInOutCirc(50, pageProgress, 832 - pageProgress, 220);
prevPage.draw(vg, (int) (x - pageProgress), y + 72);
RenderManager.drawLine(vg, (int) (x - pageProgress + 1055), y + 72, (int) (x - pageProgress + 1057), y + 800, 2, OneConfigConfig.GRAY_700); // TODO might remove this
currentPage.draw(vg, (int) (x - pageProgress + 1056), y + 72);
- if(pageProgress > 828f) {
+ if (pageProgress > 828f) {
prevPage = null;
pageProgress = -224f;
}
@@ -70,14 +74,19 @@ public class OneConfigGui extends GuiScreen {
currentPage.draw(vg, (int) (x - pageProgress), y + 72);
}
nvgResetScissor(vg);
+ long end = System.nanoTime() - start;
+ String s = (" draw: " + end / 1000000f + "ms");
RenderManager.drawString(vg, currentPage.getTitle(), x + 336, y + 36, OneConfigConfig.WHITE_90, 32f, Fonts.INTER_SEMIBOLD);
+ RenderManager.drawString(vg, s, x + 1170, y + 790, OneConfigConfig.GRAY_300, 10f, Fonts.INTER_MEDIUM);
+
- //textInputField.draw(vg, 792, 548);
- //btn.draw(vg, 976, 870);
+ //textInputField.draw(vg, 792, 548);
+ //btn.draw(vg, 976, 870);
//RenderManager.drawGradientRoundedRect(vg, 100, 100, 500, 100, OneConfigConfig.BLUE_600, OneConfigConfig.BLUE_500, OneConfigConfig.CORNER_RADIUS_WIN);
});
+
}
protected void keyTyped(char key, int keyCode) {
@@ -91,7 +100,8 @@ public class OneConfigGui extends GuiScreen {
}
public void openPage(@NotNull Page page) {
- if(prevPage == null) {
+ currentPage.finishUpAndClose();
+ if (prevPage == null) {
prevPage = currentPage;
}
currentPage = page;
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/io/polyfrost/oneconfig/gui/SideBar.java
index fd8f92e..f6ec15f 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/SideBar.java
@@ -4,12 +4,11 @@ import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.gui.elements.BasicButton;
import io.polyfrost.oneconfig.gui.pages.HomePage;
import io.polyfrost.oneconfig.gui.pages.ModsPage;
+import io.polyfrost.oneconfig.gui.pages.PerformanceModsPage;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import io.polyfrost.oneconfig.utils.MathUtils;
-import io.polyfrost.oneconfig.utils.TickDelay;
import net.minecraft.client.Minecraft;
-import scala.collection.parallel.ParIterableLike;
import java.util.ArrayList;
import java.util.List;
@@ -23,7 +22,7 @@ public class SideBar {
btnList.add(new BasicButton(192, 36, "Dashboard", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT, new HomePage()));
btnList.add(new BasicButton(192, 36, "Global Search", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Mods", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT, new ModsPage()));
- btnList.add(new BasicButton(192, 36, "Performance", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT));
+ btnList.add(new BasicButton(192, 36, "Performance Mods", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT, new PerformanceModsPage()));
btnList.add(new BasicButton(192, 36, "Profiles", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Updates", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Screenshots", "/assets/oneconfig/textures/share.png", null, -3, BasicButton.ALIGNMENT_LEFT));
@@ -60,13 +59,10 @@ public class SideBar {
}
if (btn.isClicked()) {
- if(i < 520) targetY = btn.y;
+ if (i < 520) targetY = btn.y;
}
}
-
-
-
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicButton.java
index c0d4cec..3ded1b1 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -9,9 +9,6 @@ import io.polyfrost.oneconfig.utils.ColorUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
public class BasicButton extends BasicElement {
protected String text;
@@ -135,4 +132,12 @@ public class BasicButton extends BasicElement {
runnable.run();
}
}
+
+ public void setToggled(boolean state) {
+ this.toggled = state;
+ }
+
+ public String getText() {
+ return text;
+ }
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/ModCard.java
index 38304e4..071a311 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -1,12 +1,18 @@
package io.polyfrost.oneconfig.gui.elements;
+import io.polyfrost.oneconfig.OneConfig;
import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.config.data.ModData;
+import io.polyfrost.oneconfig.config.data.ModType;
+import io.polyfrost.oneconfig.gui.OneConfigGui;
+import io.polyfrost.oneconfig.gui.pages.ModConfigPage;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import io.polyfrost.oneconfig.utils.ColorUtils;
import io.polyfrost.oneconfig.utils.InputUtils;
import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.ClientCommandHandler;
+import net.minecraftforge.fml.common.ModMetadata;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.nanovg.NanoVG;
@@ -32,23 +38,21 @@ public class ModCard extends BasicElement {
@Override
public void draw(long vg, int x, int y) {
- if(disabled) NanoVG.nvgGlobalAlpha(vg, 0.5f);
+ if (disabled) NanoVG.nvgGlobalAlpha(vg, 0.5f);
RenderManager.drawRoundedRectVaried(vg, x, y, width, 87, colorGray, 12f, 12f, 0f, 0f);
RenderManager.drawRoundedRectVaried(vg, x, y + 87, width, 32, colorPrimary, 0f, 0f, 12f, 12f);
- RenderManager.drawLine(vg, x, y + 86, x + width, y + 86, 2,OneConfigConfig.GRAY_300);
- //RenderManager.drawRect(vg, x, y + 87, width, 12, colorPrimary);
- if(iconPath != null) {
+ RenderManager.drawLine(vg, x, y + 86, x + width, y + 86, 2, OneConfigConfig.GRAY_300);
+ if (iconPath != null) {
RenderManager.drawImage(vg, iconPath, x, y, width, 87);
} else {
RenderManager.drawImage(vg, "/assets/oneconfig/textures/box.png", x + 98, y + 19, 48, 48);
}
- //favoriteHitbox.draw(vg, x + 212, y + 87);
favoriteHitbox.update(x + 212, y + 87);
favoriteHitbox.currentColor = ColorUtils.getColor(favoriteHitbox.currentColor, favoriteHitbox.colorPalette, favoriteHitbox.hovered, favoriteHitbox.clicked);
RenderManager.drawRoundedRectVaried(vg, x + 212, y + 87, 32, 32, favoriteHitbox.currentColor, 0f, 0f, 12f, 0f);
favorite = favoriteHitbox.isToggled();
- RenderManager.drawString(vg, modData.name, x + 12, y + 102, OneConfigConfig.WHITE, 14f, Fonts.INTER_MEDIUM);
- if(favorite) {
+ RenderManager.drawString(vg, modData.name, x + 12, y + 103, OneConfigConfig.WHITE, 14f, Fonts.INTER_MEDIUM);
+ if (favorite) {
RenderManager.drawImage(vg, "/assets/oneconfig/textures/love.png", x + 220, y + 95, 16, 16);
} else {
RenderManager.drawImage(vg, "/assets/oneconfig/textures/love_empty.png", x + 220, y + 95, 16, 16);
@@ -57,19 +61,20 @@ public class ModCard extends BasicElement {
isHoveredMain = InputUtils.isAreaHovered(x, y, width, 87);
boolean isHoveredSecondary = InputUtils.isAreaHovered(x, y + 87, width - 32, 32) && !disabled;
colorGray = ColorUtils.getColor(colorGray, 0, isHoveredMain, clicked && isHoveredMain);
- if(active && !disabled) {
+ if (active && !disabled) {
colorPrimary = ColorUtils.getColor(colorPrimary, 1, isHoveredSecondary, clicked && isHoveredSecondary);
- } else colorPrimary = ColorUtils.smoothColor(colorPrimary, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, isHoveredSecondary, 20f);
+ } else
+ colorPrimary = ColorUtils.smoothColor(colorPrimary, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, isHoveredSecondary, 20f);
- if(clicked && isHoveredMain) {
- if(!active) toggled = false;
+ if (clicked && isHoveredMain) {
+ if (!active) toggled = false;
}
- if(clicked && favoriteHitbox.hovered) toggled = false;
- if(clicked && !isHoveredSecondary && active) toggled = true;
- if(!active & disabled) toggled = false;
- //RenderManager.drawString(vg, "active=" + active, x + 300, y + 12, OneConfigConfig.WHITE, 12f, Fonts.INTER_MEDIUM); // TODO remove debug stuff
- //RenderManager.drawString(vg, "disabled=" + disabled, x + 300, y + 24, OneConfigConfig.WHITE, 12f, Fonts.INTER_MEDIUM);
- //RenderManager.drawString(vg, "favorite=" + favorite, x + 300, y + 36, OneConfigConfig.WHITE, 12f, Fonts.INTER_MEDIUM);
+ if (clicked && favoriteHitbox.hovered) toggled = false;
+ if (clicked && !isHoveredSecondary && active) toggled = true;
+ if (!active & disabled) toggled = false;
+ //RenderManager.drawString(vg, "active=" + active, x + 150, y + 92, OneConfigConfig.WHITE, 10f, Fonts.INTER_MEDIUM); // debug stuff
+ //RenderManager.drawString(vg, "disabled=" + disabled, x + 150, y + 103, OneConfigConfig.WHITE, 10f, Fonts.INTER_MEDIUM);
+ //RenderManager.drawString(vg, "favorite=" + favorite, x + 150, y + 114, OneConfigConfig.WHITE, 10f, Fonts.INTER_MEDIUM);
active = toggled;
@@ -77,8 +82,34 @@ public class ModCard extends BasicElement {
}
public void onClick() {
- if(isHoveredMain) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("you thought you opened the config for " + modData.name + " but actually it doesnt exist");
+ if (isHoveredMain) {
+ for (ModData data : OneConfig.loadedMods) {
+ if (data.modType != ModType.OTHER) {
+ if (data.name.equalsIgnoreCase(modData.name)) {
+ OneConfigGui.INSTANCE.openPage(new ModConfigPage(data));
+ }
+ }
+ }
+ for (ModMetadata mod : OneConfig.loadedOtherMods) {
+ if (mod.name.equalsIgnoreCase(modData.name)) {
+ System.out.println("Attempting to run command for a mod that isn't OneConfig: " + mod.name);
+ for (String commands : ClientCommandHandler.instance.getCommands().keySet()) {
+ if (commands.equalsIgnoreCase(mod.name)) {
+ System.out.println("Found command for mod: /" + commands);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + commands);
+ //Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + mod.name.toLowerCase());
+ break;
+ }
+ if (commands.equalsIgnoreCase(mod.modId)) {
+ System.out.println("Found command for mod: /" + commands);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + commands);
+ break;
+ }
+ }
+ return;
+ }
+
+ }
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/SearchField.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/SearchField.java
index 93df1b4..641f5fd 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/SearchField.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/SearchField.java
@@ -1,6 +1,6 @@
package io.polyfrost.oneconfig.gui.elements;
-public class SearchField extends TextInputField{
+public class SearchField extends TextInputField {
public SearchField(int width, int height, String defaultText, boolean multiLine, boolean password) {
super(width, height, defaultText, multiLine, password);
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java
index e2c7602..c7756fb 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java
@@ -1,14 +1,16 @@
package io.polyfrost.oneconfig.gui.elements;
-import com.google.common.base.Strings;
import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import net.minecraft.client.gui.GuiScreen;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.nanovg.NanoVG;
-import static org.lwjgl.nanovg.NanoVG.*;
+import static org.lwjgl.nanovg.NanoVG.nvgResetScissor;
+import static org.lwjgl.nanovg.NanoVG.nvgScissor;
public class TextInputField extends BasicElement {
@@ -18,6 +20,10 @@ public class TextInputField extends BasicElement {
protected boolean password;
protected int caretPos;
+ protected int x, y;
+ protected long vg;
+ protected int deltaX;
+ protected int prevCaret = 0;
public TextInputField(int width, int height, String defaultText, boolean multiLine, boolean password) {
super(width, height, false);
@@ -41,42 +47,68 @@ public class TextInputField extends BasicElement {
@Override
public void draw(long vg, int x, int y) {
+ this.x = x;
+ this.y = y;
+ this.vg = vg;
RenderManager.drawHollowRoundRect(vg, x, y, width, height, OneConfigConfig.GRAY_700, 12f, 2f);
super.update(x, y);
int color = toggled ? OneConfigConfig.WHITE : OneConfigConfig.WHITE_60;
float width;
StringBuilder s = new StringBuilder();
int offset = 12;
- if(!password) {
+ if (!password) {
width = RenderManager.getTextWidth(vg, input.substring(0, caretPos), 14f);
} else {
- for(int i = 0; i < input.length(); i++) {
+ for (int i = 0; i < input.length(); i++) {
s.append("*");
}
width = RenderManager.getTextWidth(vg, s.substring(0, caretPos), 14f);
}
+ nvgScissor(vg, x, y, this.width, height);
+ if (clicked) {
+ NanoVG.nvgGlobalAlpha(vg, 0.3f);
+ int point = (Mouse.getX() - x) - deltaX;
+ if (Mouse.getX() - x - 12 < 0) {
+ RenderManager.drawRect(vg, x + offset + width, y + 2, -width, height - 4, OneConfigConfig.BLUE_600);
+ } else if (!(Mouse.getX() - x > RenderManager.getTextWidth(vg, input, 14f) + 12)) {
+ RenderManager.drawRect(vg, x + offset + width, y + 2, point, height - 4, OneConfigConfig.BLUE_600);
+ } else {
+ RenderManager.drawRect(vg, x + offset + width, y + 2, RenderManager.getTextWidth(vg, input, 14f) - width, height - 4, OneConfigConfig.BLUE_600);
+ }
+ //System.out.println(offset + width);
+ //System.out.println(point);
+ prevCaret = calculatePos((int) (offset + width));
+ NanoVG.nvgGlobalAlpha(vg, 1f);
+ }
+ try {
+ //System.out.println("prevCaret: " + prevCaret + " caretPos: " + caretPos);
+ //RenderManager.drawRect(vg, (int) x + RenderManager.getTextWidth(vg, input.substring(0, caretPos), 14f), y, (int) RenderManager.getTextWidth(vg, input.substring(caretPos, prevCaret), 14f), height, OneConfigConfig.GRAY_300);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
- if(toggled) {
- RenderManager.drawLine(vg, x + width + 12, (float) y + 7, x + width + 13, (float) y + height - 7, 1, OneConfigConfig.WHITE);
+ if (toggled) {
+ RenderManager.drawLine(vg, x + width + 12, (float) y + 7, x + width + 12, (float) y + height - 7, 1, OneConfigConfig.WHITE);
}
- if(input.equals("")){
+
+ if (input.equals("")) {
RenderManager.drawString(vg, defaultText, x + 12, y + 17, color, 14f, Fonts.INTER_REGULAR);
}
- nvgScissor(vg, x, y, this.width, height);
- if(!password) {
+
+ if (!password) {
RenderManager.drawString(vg, input, x + offset, y + 17, color, 14f, Fonts.INTER_REGULAR);
- nvgResetScissor(vg);
} else {
-
RenderManager.drawString(vg, s.toString(), x + offset, y + 17, color, 14f, Fonts.INTER_REGULAR);
}
+ nvgResetScissor(vg);
}
public void keyTyped(char c, int key) {
if (toggled) {
- if(GuiScreen.isCtrlKeyDown()) {
- if(key == Keyboard.KEY_BACK) {
+ if (GuiScreen.isCtrlKeyDown()) {
+ if (key == Keyboard.KEY_BACK) {
try {
input = input.substring(0, input.lastIndexOf(" "));
caretPos = input.length();
@@ -89,7 +121,7 @@ public class TextInputField extends BasicElement {
}
if (key == Keyboard.KEY_BACK) {
if (input.length() > 0) {
- if(caretPos == input.length()) {
+ if (caretPos == input.length()) {
input = input.substring(0, input.length() - 1);
} else {
input = input.substring(0, caretPos - 1) + input.substring(caretPos);
@@ -98,7 +130,7 @@ public class TextInputField extends BasicElement {
}
return;
}
- if(key == Keyboard.KEY_TAB) {
+ if (key == Keyboard.KEY_TAB) {
input += " ";
caretPos += 4;
return;
@@ -106,26 +138,25 @@ public class TextInputField extends BasicElement {
if (key == Keyboard.KEY_RIGHT) {
caretPos++;
- if(caretPos > input.length()) {
+ if (caretPos > input.length()) {
caretPos = input.length();
}
return;
}
if (key == Keyboard.KEY_LEFT) {
caretPos--;
- if(caretPos < 0) {
+ if (caretPos < 0) {
caretPos = 0;
}
return;
}
-
- if(key == Keyboard.KEY_RETURN) {
+ if (key == Keyboard.KEY_RETURN) {
toggled = false;
}
- if(key == Keyboard.KEY_LCONTROL || key == Keyboard.KEY_RCONTROL || key == Keyboard.KEY_LMENU || key == Keyboard.KEY_RMENU || key == Keyboard.KEY_LMETA || key == Keyboard.KEY_RMETA || key == Keyboard.KEY_LSHIFT || key == Keyboard.KEY_RSHIFT || key == Keyboard.KEY_RETURN || key == Keyboard.KEY_CAPITAL || key == 221) {
+ if (key == Keyboard.KEY_LCONTROL || key == Keyboard.KEY_RCONTROL || key == Keyboard.KEY_LMENU || key == Keyboard.KEY_RMENU || key == Keyboard.KEY_LMETA || key == Keyboard.KEY_RMETA || key == Keyboard.KEY_LSHIFT || key == Keyboard.KEY_RSHIFT || key == Keyboard.KEY_RETURN || key == Keyboard.KEY_CAPITAL || key == 221) {
return;
}
input = addCharAtPoint(caretPos, c);
@@ -136,4 +167,31 @@ public class TextInputField extends BasicElement {
private @NotNull String addCharAtPoint(int index, char c) {
return input.substring(0, index) + c + input.substring(index);
}
+
+ @Override
+ public void onClick() {
+ deltaX = Mouse.getX() - x;
+ toggled = true;
+ caretPos = calculatePos(Mouse.getX());
+ }
+
+ private int calculatePos(int pos) {
+ String s1 = "";
+ int i;
+ for (char c : input.toCharArray()) {
+ if (pos - x - 12 < 0) {
+ return 0;
+ }
+ if (pos - x - 12 > RenderManager.getTextWidth(vg, input, 14f)) {
+ deltaX = (int) RenderManager.getTextWidth(vg, input, 14f) + 12;
+ return input.length();
+ }
+ s1 += c;
+ i = (int) RenderManager.getTextWidth(vg, s1, 14f);
+ if (i >= pos - x - 16) {
+ return s1.length();
+ }
+ }
+ return 0;
+ }
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java
index 1cf0ab8..a19cb55 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigButton.java
@@ -1,15 +1,21 @@
package io.polyfrost.oneconfig.gui.elements.config;
+import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.config.interfaces.Option;
+import io.polyfrost.oneconfig.gui.elements.BasicElement;
+import io.polyfrost.oneconfig.lwjgl.RenderManager;
+import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import java.lang.reflect.Field;
public class OConfigButton extends Option {
private final String text;
+ private final BasicElement element;
- public OConfigButton(Field field, String name, String description, String text) {
- super(field, name, description);
+ public OConfigButton(Field field, String name, String description, String text, int size) {
+ super(field, name, description, size);
this.text = text;
+ element = new BasicElement(128, 32, 1, true);
}
@Override
@@ -18,7 +24,13 @@ public class OConfigButton extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
-
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
+ if (size == 0) {
+ RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
+ element.setWidth((int) RenderManager.getTextWidth(vg, text, 12f) + 80);
+ element.draw(vg, x + 480 - element.getWidth(), y);
+ RenderManager.drawString(vg, text, x + element.getWidth() / 2f, y + 16, OneConfigConfig.WHITE, 12f, Fonts.INTER_MEDIUM);
+ // ???
+ }
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigCategory.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigCategory.java
index e57f130..aa763ef 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigCategory.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigCategory.java
@@ -7,8 +7,8 @@ import java.util.List;
public class OConfigCategory extends Option {
public final List<Option> options;
- public OConfigCategory(String name, String description, List<Option> options) {
- super(null, name, description);
+ public OConfigCategory(String name, String description, List<Option> options, int size) {
+ super(null, name, description, size);
this.options = options;
}
@@ -18,7 +18,7 @@ public class OConfigCategory extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java
index fcad08f..ed98bd4 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigColor.java
@@ -7,8 +7,8 @@ import java.lang.reflect.Field;
public class OConfigColor extends Option {
private final boolean allowAlpha;
- public OConfigColor(Field field, String name, String description, boolean allowAlpha) {
- super(field, name, description);
+ public OConfigColor(Field field, String name, String description, boolean allowAlpha, int size) {
+ super(field, name, description, size);
this.allowAlpha = allowAlpha;
}
@@ -18,7 +18,7 @@ public class OConfigColor extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigHud.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigHud.java
index 2d6141a..8e36fe9 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigHud.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigHud.java
@@ -6,8 +6,8 @@ import java.lang.reflect.Field;
public class OConfigHud extends Option {
- public OConfigHud(Field field, String name, String description) {
- super(field, name, description);
+ public OConfigHud(Field field, String name, String description, int size) {
+ super(field, name, description, size);
}
@Override
@@ -16,7 +16,7 @@ public class OConfigHud extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java
index 3e0e208..30bb709 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSelector.java
@@ -8,8 +8,8 @@ public class OConfigSelector extends Option {
private final String[] options;
private final int defaultSelection;
- public OConfigSelector(Field field, String name, String description, String[] options, int defaultSelection) {
- super(field, name, description);
+ public OConfigSelector(Field field, String name, String description, String[] options, int defaultSelection, int size) {
+ super(field, name, description, size);
this.options = options;
this.defaultSelection = defaultSelection;
}
@@ -20,7 +20,7 @@ public class OConfigSelector extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java
index 0427b35..bb3a485 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSlider.java
@@ -9,8 +9,8 @@ public class OConfigSlider extends Option {
private final float max;
private final float precision;
- public OConfigSlider(Field field, String name, String description, float min, float max, float precision) {
- super(field, name, description);
+ public OConfigSlider(Field field, String name, String description, float min, float max, float precision, int size) {
+ super(field, name, description, size);
this.min = min;
this.max = max;
this.precision = precision;
@@ -22,7 +22,7 @@ public class OConfigSlider extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java
index 08c315f..753d8f6 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigSwitch.java
@@ -6,8 +6,8 @@ import java.lang.reflect.Field;
public class OConfigSwitch extends Option {
- public OConfigSwitch(Field field, String name, String description) {
- super(field, name, description);
+ public OConfigSwitch(Field field, String name, String description, int size) {
+ super(field, name, description, size);
}
@Override
@@ -16,7 +16,7 @@ public class OConfigSwitch extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java
index 407f733..606d493 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/OConfigText.java
@@ -8,8 +8,8 @@ public class OConfigText extends Option {
private final String placeholder;
private final boolean hideText;
- public OConfigText(Field field, String name, String description, String placeholder, boolean hideText) {
- super(field, name, description);
+ public OConfigText(Field field, String name, String description, String placeholder, boolean hideText, int size) {
+ super(field, name, description, size);
this.placeholder = placeholder;
this.hideText = hideText;
}
@@ -20,7 +20,7 @@ public class OConfigText extends Option {
}
@Override
- public void draw(int x, int y, int width, int mouseX, int mouseY) {
+ public void draw(long vg, int x, int y, int mouseX, int mouseY) {
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java
index d38f565..667b02e 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java
@@ -7,6 +7,7 @@ import io.polyfrost.oneconfig.lwjgl.font.Fonts;
public class HomePage extends Page {
private final BasicButton btn = new BasicButton(184, 36, "Socials", "/assets/oneconfig/textures/share.png", "/assets/oneconfig/textures/share2.png", 1, BasicButton.ALIGNMENT_CENTER);
+
public HomePage() {
super("Home Dashboard");
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
new file mode 100644
index 0000000..357d684
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -0,0 +1,52 @@
+package io.polyfrost.oneconfig.gui.pages;
+
+import io.polyfrost.oneconfig.config.core.ConfigCore;
+import io.polyfrost.oneconfig.config.data.ModData;
+import io.polyfrost.oneconfig.config.interfaces.Option;
+import io.polyfrost.oneconfig.gui.elements.config.OConfigCategory;
+import org.lwjgl.input.Mouse;
+
+import java.util.ArrayList;
+
+public class ModConfigPage extends Page {
+ private final ModData modData;
+ private final ArrayList<Option> options;
+
+ public ModConfigPage(ModData mod) {
+ super("Mod: " + mod.name);
+ this.modData = mod;
+ options = ConfigCore.settings.get(mod);
+ }
+
+ @Override
+ public void draw(long vg, int x, int y) {
+ for (Option option : options) {
+ if (option instanceof OConfigCategory) {
+ OConfigCategory category = (OConfigCategory) option;
+ for (Option subOption : category.options) {
+ if (subOption.size == 0) {
+ subOption.draw(vg, x, y, Mouse.getX(), Mouse.getY());
+ }
+ }
+ for (Option subOption : category.options) {
+ if (subOption.size == 1) {
+ subOption.draw(vg, x, y, Mouse.getX(), Mouse.getY());
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void finishUpAndClose() {
+ modData.config.save(); // TODO
+ }
+
+ public ModData getModData() {
+ return modData;
+ }
+
+ protected ArrayList<Option> getOptions() {
+ return options;
+ }
+}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java
index 856b2f3..9fc14f7 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -1,52 +1,80 @@
package io.polyfrost.oneconfig.gui.pages;
import io.polyfrost.oneconfig.OneConfig;
+import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.config.data.ModData;
+import io.polyfrost.oneconfig.config.data.ModType;
import io.polyfrost.oneconfig.gui.elements.BasicButton;
import io.polyfrost.oneconfig.gui.elements.ModCard;
+import io.polyfrost.oneconfig.lwjgl.RenderManager;
+import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import java.util.ArrayList;
import java.util.List;
public class ModsPage extends Page {
- private final BasicButton allBtn = new BasicButton(49, 40, "All", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton newBtn = new BasicButton(64, 40, "New", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton combatBtn = new BasicButton(104, 40, "Combat", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton hudBtn = new BasicButton(104, 40, "HUD & QoL", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton hypixelBtn = new BasicButton(104, 40, "Hypixel", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton skyblockBtn = new BasicButton(104, 40, "Skyblock", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton utilBtn = new BasicButton(104, 40, "Utility", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
- private final BasicButton customBtn = new BasicButton(104, 40, "Custom", null, null, 0, BasicButton.ALIGNMENT_CENTER, true);
private final List<ModCard> modCards = new ArrayList<>();
+ private final List<BasicButton> modCategories = new ArrayList<>();
public ModsPage() {
super("Mods");
- for(ModData modData : OneConfig.loadedMods) {
+ for (ModData modData : OneConfig.loadedMods) {
modCards.add(new ModCard(modData, null, true, false, false));
}
+ for (ModCard card : modCards) {
+ if (card.isFavorite()) {
+ modCards.remove(card);
+ modCards.add(0, card);
+ }
+ }
+ modCategories.add(new BasicButton(64, 32, "All", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(80, 32, "Combat", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(64, 32, "HUD", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(104, 32, "Utility & QoL", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(80, 32, "Hypixel", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(80, 32, "Skyblock", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.add(new BasicButton(88, 32, "3rd Party", null, null, 0, BasicButton.ALIGNMENT_CENTER, true));
+ modCategories.get(0).setToggled(true);
}
public void draw(long vg, int x, int y) {
- allBtn.draw(vg, x + 16, y + 16);
- newBtn.draw(vg, x + 92, y + 16);
- combatBtn.draw(vg, x + 168, y + 16);
- hudBtn.draw(vg, x + 284, y + 16);
- hypixelBtn.draw(vg, x + 400, y + 16);
- skyblockBtn.draw(vg, x + 516, y + 16);
- utilBtn.draw(vg, x + 632, y + 16);
- customBtn.draw(vg, x + 748, y + 16);
+ int iXCat = x + 16;
+ for (BasicButton btn : modCategories) {
+ btn.draw(vg, iXCat, y + 16);
+ iXCat += btn.getWidth() + 8;
+ }
+ if ((modCategories.get(1).isClicked() || modCategories.get(2).isClicked() || modCategories.get(3).isClicked() || modCategories.get(4).isClicked() || modCategories.get(5).isClicked() || modCategories.get(6).isClicked()) && modCategories.get(0).isToggled()) {
+ modCategories.get(0).setToggled(false);
+ }
+ if (!modCategories.get(0).isToggled() && !modCategories.get(1).isToggled() && !modCategories.get(2).isToggled() && !modCategories.get(3).isToggled() && !modCategories.get(4).isToggled() && !modCategories.get(5).isToggled() && !modCategories.get(6).isToggled()) {
+ modCategories.get(0).setToggled(true);
+ }
+ if (modCategories.get(0).isToggled()) {
+ for (BasicButton btn : modCategories) {
+ if (!btn.getText().equals("All")) {
+ btn.setToggled(false);
+ }
+ }
+ }
+
int iX = x + 16;
int iY = y + 72;
- for(ModCard modCard : modCards) {
- modCard.draw(vg, iX, iY);
- iX += 260;
- if(iX > x + 796) {
- iX = x + 16;
- iY += 135;
+ for (ModCard modCard : modCards) {
+ if (modCategories.get(0).isToggled() || (modCategories.get(1).isToggled() && modCard.getModData().modType == ModType.PVP) || (modCategories.get(2).isToggled() && modCard.getModData().modType == ModType.HUD) || (modCategories.get(3).isToggled() && modCard.getModData().modType == ModType.UTIL_QOL) || (modCategories.get(4).isToggled() && modCard.getModData().modType == ModType.HYPIXEL) || (modCategories.get(5).isToggled() && modCard.getModData().modType == ModType.SKYBLOCK) || (modCategories.get(6).isToggled() && modCard.getModData().modType == ModType.OTHER)) {
+ modCard.draw(vg, iX, iY);
+ iX += 260;
+ if (iX > x + 796) {
+ iX = x + 16;
+ iY += 135;
+ }
}
}
+ if (iX == x + 16 && iY == y + 72) {
+ RenderManager.drawString(vg, "Looks like there is nothing here. Try another category?", x + 16, y + 72, OneConfigConfig.WHITE_60, 14f, Fonts.INTER_MEDIUM);
+ }
}
+
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java
index 492a1f9..58c181f 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java
@@ -6,7 +6,7 @@ import io.polyfrost.oneconfig.lwjgl.font.Fonts;
/**
* A page is a 1056x728 rectangle of the GUI. It is the main content of the gui, and can be switched back and forwards easily. All the content of OneConfig is in a page.
*/
-public class Page {
+public abstract class Page {
protected final String title;
Page(String title) {
@@ -14,7 +14,11 @@ public class Page {
}
public void draw(long vg, int x, int y) {
- RenderManager.drawString(vg, "If you are seeing this, something went quite wrong.", x + 12, y + 12, -1, 24f, Fonts.INTER_BOLD);
+ RenderManager.drawString(vg, "Doesn't appear there is any content to this page :(", x + 12, y + 18, -1, 24f, Fonts.INTER_BOLD);
+ }
+
+ public void finishUpAndClose() {
+
}
public String getTitle() {
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/PerformanceModsPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/PerformanceModsPage.java
new file mode 100644
index 0000000..8dbdea9
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/PerformanceModsPage.java
@@ -0,0 +1,42 @@
+package io.polyfrost.oneconfig.gui.pages;
+
+import io.polyfrost.oneconfig.OneConfig;
+import io.polyfrost.oneconfig.config.OneConfigConfig;
+import io.polyfrost.oneconfig.config.data.ModData;
+import io.polyfrost.oneconfig.config.data.ModType;
+import io.polyfrost.oneconfig.gui.elements.ModCard;
+import io.polyfrost.oneconfig.lwjgl.RenderManager;
+import io.polyfrost.oneconfig.lwjgl.font.Fonts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PerformanceModsPage extends Page {
+ List<ModCard> modCards = new ArrayList<>();
+
+ public PerformanceModsPage() {
+ super("Performance Mods");
+ for (ModData mod : OneConfig.loadedMods) {
+ if (mod.modType == ModType.PERFORMANCE) {
+ modCards.add(new ModCard(mod, null, true, false, false));
+ }
+ }
+ }
+
+ @Override
+ public void draw(long vg, int x, int y) {
+ int iX = x + 16;
+ int iY = y + 16;
+ for (ModCard card : modCards) {
+ card.draw(vg, iX, iY);
+ iX += 260;
+ if (iX > x + 796) {
+ iX = x + 16;
+ iY += 135;
+ }
+ }
+ if (iX == x + 16 && iY == y + 16) {
+ RenderManager.drawString(vg, "Looks like there is nothing here. Try getting some more mods!", x + 16, y + 16, OneConfigConfig.WHITE_60, 14f, Fonts.INTER_MEDIUM);
+ }
+ }
+}