aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-02 17:06:44 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-02 17:06:44 +0200
commit0ba6b9e25e5d69072b7a2496656818894864edb2 (patch)
tree963fadeac722f739413a3bd7ea73eb58ed16b7c4 /src
parent63633b2286bd8717f078131014199c6ccaa6a8e3 (diff)
downloadOneConfig-0ba6b9e25e5d69072b7a2496656818894864edb2.tar.gz
OneConfig-0ba6b9e25e5d69072b7a2496656818894864edb2.tar.bz2
OneConfig-0ba6b9e25e5d69072b7a2496656818894864edb2.zip
back and forward buttons and breadcrumbs
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java1
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java18
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/data/Mod.java3
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/BasicOption.java1
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java110
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java4
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java8
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java5
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java5
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java12
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java3
-rw-r--r--src/main/java/io/polyfrost/oneconfig/test/TestConfig.java4
-rw-r--r--src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_left.pngbin209 -> 0 bytes
-rw-r--r--src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_right.pngbin214 -> 0 bytes
-rw-r--r--src/main/resources/assets/oneconfig/textures/gui/general/arrows/circle_arrow.pngbin0 -> 394 bytes
21 files changed, 130 insertions, 60 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java
index 30eb6ab..a772a23 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/OneConfigConfig.java
@@ -41,6 +41,7 @@ public class OneConfigConfig extends Config {
public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB(); // White 60%
public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB(); // White 80%
public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB(); // White 90%
+ public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 90%
public static final int WHITE = new Color(255, 255, 255, 255).getRGB(); // White 100%
public static final int ERROR_700 = new Color(180, 24, 24, 255).getRGB(); // Red 700
diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
index 77831db..9955c17 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
@@ -31,6 +31,10 @@ public @interface Option {
*/
String subcategory();
+ /**
+ * The width of the option (1 = half width, 2 = full width)
+ */
+ int size() default 1;
/**
* A String array of all the possible values for the UniSelector, dropdownList, and ComboBox.
@@ -40,9 +44,9 @@ public @interface Option {
String[] options() default {};
/**
- * The width of the option (1 = half width, 2 = full width)
+ * The places you want dividers to be in a dropdown
*/
- int size() default 1;
+ int[] dividers() default {};
/**
* The placeholder in the text field
@@ -60,11 +64,6 @@ public @interface Option {
boolean multiLine() default false;
/**
- * Steps of slider (0 for no steps)
- */
- int step() default 0;
-
- /**
* Minimum value of slider
*/
float min() default 0;
@@ -75,6 +74,11 @@ public @interface Option {
float max() default 0;
/**
+ * Steps of slider (0 for no steps)
+ */
+ int step() default 0;
+
+ /**
* Option for info option type
*/
InfoType infoType() default InfoType.INFO;
diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java
index bd6c3f3..095dded 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/data/Mod.java
@@ -8,7 +8,7 @@ public class Mod {
public final String creator;
public final String version;
public Config config;
- public OptionPage defaultPage = new OptionPage("", this);
+ public final OptionPage defaultPage;
/**
* @param name Friendly name of the mod
@@ -21,5 +21,6 @@ public class Mod {
this.modType = modType;
this.creator = creator;
this.version = version;
+ this.defaultPage = new OptionPage(name, this);
}
}
diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/BasicOption.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/BasicOption.java
index 3c02b69..7b9a807 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/BasicOption.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/BasicOption.java
@@ -61,7 +61,6 @@ public abstract class BasicOption {
* @param y y position
*/
public void drawLast(long vg, int x, int y) {
-
}
/**
diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
index b3c8c75..f511ae3 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
@@ -124,7 +124,7 @@ public class Config {
options.add(new ConfigUniSelector(field, option.name(), option.size(), option.options()));
break;
case DROPDOWN:
- options.add(new ConfigDropdown(field, option.name(), option.size(), option.options()));
+ options.add(new ConfigDropdown(field, option.name(), option.size(), option.options(), option.dividers()));
break;
case SLIDER:
options.add(new ConfigSlider(field, option.name(), option.size(), option.min(), option.max(), option.step()));
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
index 930c8cd..35fe40d 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -9,6 +9,7 @@ import io.polyfrost.oneconfig.gui.pages.Page;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
import io.polyfrost.oneconfig.lwjgl.image.Images;
+import io.polyfrost.oneconfig.utils.InputUtils;
import io.polyfrost.oneconfig.utils.MathUtils;
import net.minecraft.client.gui.GuiScreen;
import org.jetbrains.annotations.NotNull;
@@ -24,24 +25,19 @@ import static org.lwjgl.nanovg.NanoVG.nvgScissor;
public class OneConfigGui extends GuiScreen {
public static OneConfigGui INSTANCE;
-
public final int x = 320;
public final int y = 140;
-
private final SideBar sideBar = new SideBar();
-
protected Page currentPage;
protected Page prevPage;
private float pageProgress = -224f;
-
private final TextInputField textInputField = new TextInputField(248, 40, "Search all of OneConfig...", false, false);
- private final ArrayList<Page> pageHistory = new ArrayList<>();
- private int currentPageIndex = 0;
- private final BasicElement backArrow = new BasicElement(40, 40, -1, true);
- private final BasicElement forwardArrow = new BasicElement(40, 40, -1, true);
-
+ private final ArrayList<Page> previousPages = new ArrayList<>();
+ private final ArrayList<Page> nextPages = new ArrayList<>();
+ private final BasicElement backArrow = new BasicElement(40, 40, -1, false);
+ private final BasicElement forwardArrow = new BasicElement(40, 40, -1, false);
+ private final ArrayList<Page> parents = new ArrayList<>();
private ColorSelector currentColorSelector;
-
public boolean mouseDown;
public OneConfigGui() {
@@ -58,7 +54,10 @@ public class OneConfigGui extends GuiScreen {
super.drawScreen(mouseX, mouseY, partialTicks);
long start = System.nanoTime();
RenderManager.setupAndDraw((vg) -> {
- if (currentPage == null) currentPage = new HomePage();
+ if (currentPage == null) {
+ currentPage = new HomePage();
+ parents.add(currentPage);
+ }
//nvgScale(vg, 0.5f, 0.5f);
if (OneConfigConfig.ROUNDED_CORNERS) {
RenderManager.drawRoundedRect(vg, 544, 140, 1056, 800, OneConfigConfig.GRAY_800, OneConfigConfig.CORNER_RADIUS_WIN);
@@ -78,34 +77,43 @@ public class OneConfigGui extends GuiScreen {
backArrow.draw(vg, x + 240, y + 16);
forwardArrow.draw(vg, x + 280, y + 16);
- if (currentPageIndex <= 0) {
+ if (previousPages.size() == 0) {
backArrow.disable(true);
NanoVG.nvgGlobalAlpha(vg, 0.5f);
- } else backArrow.disable(false);
- RenderManager.drawImage(vg, Images.ARROW_LEFT, x + 250, y + 26, 20, 20);
+ } else {
+ backArrow.disable(false);
+ if (!backArrow.isHovered() || Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f);
+ }
+ NanoVG.nvgTranslate(vg, x + 271, y + 47);
+ NanoVG.nvgRotate(vg, (float) Math.toRadians(180));
+ RenderManager.drawImage(vg, Images.CIRCLE_ARROW, 0, 0, 22, 22);
+ NanoVG.nvgResetTransform(vg);
NanoVG.nvgGlobalAlpha(vg, 1f);
- if (currentPageIndex > pageHistory.size() - 1) {
+ if (nextPages.size() == 0) {
forwardArrow.disable(true);
NanoVG.nvgGlobalAlpha(vg, 0.5f);
- } else forwardArrow.disable(false);
- RenderManager.drawImage(vg, Images.ARROW_RIGHT, x + 290, y + 26, 20, 20);
+ } else {
+ forwardArrow.disable(false);
+ if (!forwardArrow.isHovered() || Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f);
+ }
+ RenderManager.drawImage(vg, Images.CIRCLE_ARROW, x + 289, y + 25, 22, 22);
NanoVG.nvgGlobalAlpha(vg, 1f);
- /*if (backArrow.isClicked()) { // TODO
+ if (backArrow.isClicked() && previousPages.size() > 0) {
try {
- openPage(pageHistory.get(currentPageIndex--));
- } catch (Exception e) {
- e.printStackTrace();
+ nextPages.add(0, currentPage);
+ openPage(previousPages.get(0), false);
+ previousPages.remove(0);
+ } catch (Exception ignored) {
}
- }
- if (forwardArrow.isClicked()) {
+ } else if (forwardArrow.isClicked() && nextPages.size() > 0) {
try {
- pageHistory.add(currentPage);
- openPage(pageHistory.get(currentPageIndex++));
+ previousPages.add(0, currentPage);
+ openPage(nextPages.get(0), false);
+ nextPages.remove(0);
} catch (Exception ignored) {
}
- }*/
-
+ }
nvgScissor(vg, x + 224, y + 72, 1056, 728);
if (prevPage != null) {
@@ -121,12 +129,29 @@ public class OneConfigGui extends GuiScreen {
currentPage.draw(vg, (int) (x - pageProgress), y + 72);
}
nvgResetScissor(vg);
- if(currentColorSelector != null) {
+ if (currentColorSelector != null) {
currentColorSelector.draw(vg);
}
+
+ float breadcrumbX = x + 336;
+ for (int i = 0; i < parents.size(); i++) {
+ String title = parents.get(i).getTitle();
+ float width = RenderManager.getTextWidth(vg, title, 24f, Fonts.INTER_SEMIBOLD);
+ boolean hovered = InputUtils.isAreaHovered((int) breadcrumbX, y + 24, (int) width, 36);
+ int color = OneConfigConfig.WHITE_60;
+ if (i == parents.size() - 1) color = OneConfigConfig.WHITE_95;
+ else if (hovered && !Mouse.isButtonDown(0)) color = OneConfigConfig.WHITE_80;
+ RenderManager.drawString(vg, title, breadcrumbX, y + 38, color, 24f, Fonts.INTER_SEMIBOLD);
+ if (i != 0)
+ RenderManager.drawImage(vg, Images.CHEVRON_ARROW, breadcrumbX - 22, y + 26, 13, 22, color);
+ if (hovered && i != parents.size() - 1)
+ RenderManager.drawLine(vg, breadcrumbX, y + 48, breadcrumbX + width, y + 48, 2, color);
+ if (hovered && InputUtils.isClicked()) openPage(parents.get(i));
+ breadcrumbX += width + 32;
+ }
+
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);
});
mouseDown = Mouse.isButtonDown(0);
@@ -144,8 +169,31 @@ public class OneConfigGui extends GuiScreen {
}
public void openPage(@NotNull Page page) {
+ openPage(page, true);
+ }
+
+ public void openPage(@NotNull Page page, boolean addToPrevious) {
if (page == currentPage) return;
currentPage.finishUpAndClose();
+ if (!page.isBase()) {
+ boolean alreadyInParents = false;
+ for (int i = 0; i < parents.size(); i++) {
+ Page parent = parents.get(i);
+ if (parent == page) {
+ alreadyInParents = true;
+ parents.subList(i + 1, parents.size()).clear();
+ break;
+ }
+ }
+ if (!alreadyInParents) parents.add(page);
+ } else {
+ parents.clear();
+ parents.add(page);
+ }
+ if (addToPrevious) {
+ previousPages.add(0, currentPage);
+ nextPages.clear();
+ }
if (prevPage == null) {
prevPage = currentPage;
}
@@ -154,13 +202,15 @@ public class OneConfigGui extends GuiScreen {
/**
* initialize a new ColorSelector and add it to the draw script. This method is used to make sure it is always rendered on top.
+ *
* @implNote Correct usage: <code>OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY()));</code>
*/
public void initColorSelector(ColorSelector colorSelector) {
currentColorSelector = colorSelector;
}
- /** Close the current color selector and return the color it had when it closed.
+ /**
+ * Close the current color selector and return the color it had when it closed.
*/
public Color closeColorSelector() {
Color color = currentColorSelector.getColor();
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
index 5f506f7..bd268cb 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
@@ -44,7 +44,7 @@ public class ConfigCheckbox extends BasicOption {
RenderManager.drawHollowRoundRect(vg, x, y + 4, 23.5f, 23.5f, OneConfigConfig.GRAY_300, 6f, 1f); // the 0.5f is to make it look better ok
}
color = ColorUtils.smoothColor(color, OneConfigConfig.GRAY_600, OneConfigConfig.GRAY_400, hover, 40f);
- RenderManager.drawString(vg, name, x + 32, y + 17, OneConfigConfig.WHITE_90, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x + 32, y + 17, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 5f));
if (percentOn == 0f) return;
if (percentOn != 1f) {
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
index d80f242..c3d1369 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -18,10 +18,12 @@ public class ConfigDropdown extends BasicOption { // TODO: chose where dividers
private final String[] options;
private int backgroundColor = OneConfigConfig.GRAY_500;
private boolean opened = false;
+ private int[] dividers;
- public ConfigDropdown(Field field, String name, int size, String[] options) {
+ public ConfigDropdown(Field field, String name, int size, String[] options, int [] dividers) {
super(field, name, size);
this.options = options;
+ this.dividers = dividers;
}
@Override
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
index 3e90e57..46f86e9 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
@@ -32,12 +32,12 @@ public class ConfigDualOption extends BasicOption {
toggled = (boolean) get();
} catch (IllegalAccessException ignored) {
}
- RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
RenderManager.drawRoundedRect(vg, x + 226, y, 256, 32, OneConfigConfig.GRAY_500, 12f);
int x1 = (int) (x + 228 + (percentMove * 128));
RenderManager.drawRoundedRect(vg, x1, y + 2, 124, 28, OneConfigConfig.BLUE_600, 10f);
- RenderManager.drawString(vg, left, x + 290 - RenderManager.getTextWidth(vg, left, 14f, Fonts.INTER_MEDIUM) / 2, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
- RenderManager.drawString(vg, right, x + 418 - RenderManager.getTextWidth(vg, right, 14f, Fonts.INTER_MEDIUM) / 2, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, left, x + 290 - RenderManager.getTextWidth(vg, left, 12f, Fonts.INTER_MEDIUM) / 2, y + 17, OneConfigConfig.WHITE_90, 12f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, right, x + 418 - RenderManager.getTextWidth(vg, right, 12f, Fonts.INTER_MEDIUM) / 2, y + 17, OneConfigConfig.WHITE_90, 12f, Fonts.INTER_MEDIUM);
if (InputUtils.isAreaClicked(x + 226, y, 256, 32)) {
toggled = !toggled;
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
index 47ce15c..ded546a 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
@@ -84,7 +84,7 @@ public class ConfigSlider extends BasicOption {
}
inputField.draw(vg, x + 892, y);
- RenderManager.drawString(vg, name, x, y + 15, OneConfigConfig.WHITE_90, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x, y + 17, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
RenderManager.drawRoundedRect(vg, x + 352, y + 13, 512, 6, OneConfigConfig.GRAY_300, 4f);
slideYBoi.update(x + 340 + (int) (current * 512), y + 4);
if (steps != 0) {
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 62637e9..daf3de3 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
@@ -33,7 +33,7 @@ public class ConfigSwitch extends BasicOption {
}
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 + 50, y + 17, OneConfigConfig.WHITE, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x + 50, y + 17, OneConfigConfig.WHITE, 14f, Fonts.INTER_MEDIUM);
if (InputUtils.isAreaClicked(x, y, 42, 32)) {
toggled = !toggled;
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
index 18bebbf..9e3a4a4 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
@@ -34,15 +34,15 @@ public class ConfigUniSelector extends BasicOption {
} catch (IllegalAccessException ignored) {
}
String option = options[selected] + " " + (selected + 1) + "/" + options.length;
- RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 18f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
if (previous == -1) {
- RenderManager.drawString(vg, option, x + 352 - RenderManager.getTextWidth(vg, option, 14f, Fonts.INTER_MEDIUM) / 2f, y + 15, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, option, x + 352 - RenderManager.getTextWidth(vg, option, 12f, Fonts.INTER_MEDIUM) / 2f, y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.INTER_MEDIUM);
} else {
String prevOption = options[previous] + " " + (previous + 1) + "/" + options.length;
NanoVG.nvgScissor(vg, x + 256, y, 192, 32);
- RenderManager.drawString(vg, selected < previous ? prevOption : option, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? prevOption : option, 14f, Fonts.INTER_MEDIUM) / 2f + 192 * percentMove, y + 15, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
- RenderManager.drawString(vg, selected < previous ? option : prevOption, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? option : prevOption, 14f, Fonts.INTER_MEDIUM) / 2f - 192 * (1 - percentMove), y + 15, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, selected < previous ? prevOption : option, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? prevOption : option, 12f, Fonts.INTER_MEDIUM) / 2f + 192 * percentMove, y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.INTER_MEDIUM);
+ RenderManager.drawString(vg, selected < previous ? option : prevOption, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? option : prevOption, 12f, Fonts.INTER_MEDIUM) / 2f - 192 * (1 - percentMove), y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.INTER_MEDIUM);
NanoVG.nvgResetScissor(vg);
}
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 0dfd983..9d71527 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/HomePage.java
@@ -20,4 +20,9 @@ public class HomePage extends Page {
//RenderManager.drawRoundedRect(vg);
btn.draw(vg, x + 432, y + 658);
}
+
+ @Override
+ public boolean isBase() {
+ return true;
+ }
}
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 4839c61..1287f67 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -16,7 +16,7 @@ public class ModConfigPage extends Page {
private String selectedCategory;
public ModConfigPage(OptionPage page) {
- super("Mod: " + page.mod.name);
+ super(page.name);
this.page = page;
if (page.categories.size() == 0) return;
for (String category : page.categories.keySet()) {
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 7834e0b..2db82cc 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -68,4 +68,9 @@ public class ModsPage extends Page {
modCategories.get(i).setToggled(false);
}
}
+
+ @Override
+ public boolean isBase() {
+ return true;
+ }
}
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 b98bc01..91d0efd 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/Page.java
@@ -13,12 +13,9 @@ public abstract class Page {
this.title = title;
}
- public void draw(long vg, int x, int y) {
- RenderManager.drawString(vg, "Doesn't appear there is any content to this page :(", x + 12, y + 18, -1, 24f, Fonts.INTER_BOLD);
- }
+ public abstract void draw(long vg, int x, int y);
public void finishUpAndClose() {
-
}
public String getTitle() {
@@ -27,4 +24,11 @@ public abstract class Page {
public void keyTyped(char key, int keyCode) {
}
+
+ /**
+ * Overwrite this method and make it return true if you want this to always be the base in breadcrumbs
+ */
+ public boolean isBase() {
+ return false;
+ }
}
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java
index cdd79e3..58492bc 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java
@@ -4,8 +4,7 @@ public enum Images {
CHEVRON_ARROW("/assets/oneconfig/textures/gui/general/arrows/chevron.png"),
DROPDOWN_ARROW("/assets/oneconfig/textures/gui/general/arrows/dropdown_arrow.png"),
UP_ARROW("/assets/oneconfig/textures/gui/general/arrows/up_arrow.png"),
- ARROW_RIGHT("/assets/oneconfig/textures/gui/general/arrows/arrow_right.png"),
- ARROW_LEFT("/assets/oneconfig/textures/gui/general/arrows/arrow_left.png"),
+ CIRCLE_ARROW("/assets/oneconfig/textures/gui/general/arrows/circle_arrow.png"),
CHECKMARK("/assets/oneconfig/textures/gui/general/configs/checkmark.png"),
FAVORITE("/assets/oneconfig/textures/gui/general/configs/favorite_active.png"),
diff --git a/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
index c0fda13..93043e9 100644
--- a/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
+++ b/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
@@ -64,9 +64,9 @@ public class TestConfig extends Config {
public static boolean switchTest4;
@Option(
- name = "Test switch",
+ name = "Test checkbox",
subcategory = "Other subcategory",
- type = OptionType.SWITCH
+ type = OptionType.CHECKBOX
)
public static boolean switchTest5;
diff --git a/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_left.png b/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_left.png
deleted file mode 100644
index d705ce7..0000000
--- a/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_left.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_right.png b/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_right.png
deleted file mode 100644
index 1646de1..0000000
--- a/src/main/resources/assets/oneconfig/textures/gui/general/arrows/arrow_right.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/oneconfig/textures/gui/general/arrows/circle_arrow.png b/src/main/resources/assets/oneconfig/textures/gui/general/arrows/circle_arrow.png
new file mode 100644
index 0000000..dbf1bf0
--- /dev/null
+++ b/src/main/resources/assets/oneconfig/textures/gui/general/arrows/circle_arrow.png
Binary files differ