diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-07 15:12:10 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-07 15:12:10 +0200 |
commit | e6e408195e887e94eaf27e821de89ca560b020a8 (patch) | |
tree | 17f911cbed0596ed5404a1905a7da09f8a78c59a | |
parent | 2a6f0a8173018970ef35bcf8c2cea8f091f79056 (diff) | |
download | OneConfig-e6e408195e887e94eaf27e821de89ca560b020a8.tar.gz OneConfig-e6e408195e887e94eaf27e821de89ca560b020a8.tar.bz2 OneConfig-e6e408195e887e94eaf27e821de89ca560b020a8.zip |
font size changes and scrolling
6 files changed, 44 insertions, 11 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java index efa9e9f..7434e49 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java @@ -9,10 +9,12 @@ import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; public class OneConfigConfig extends Config { public static String currentProfile = "Default Profile"; + public static ArrayList<String> favoriteMods = new ArrayList<>(); public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent // button sidebar normal diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java index 86c9893..0c8a3b8 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java @@ -131,6 +131,10 @@ public class Config { break; case INFO: options.add(new ConfigInfo(field, option.name(), option.size(), option.infoType())); + break; + case COLOR: + options.add(new ConfigColorElement(field, option.name(), option.size())); + break; } } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java index e1323c3..1eda01b 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java @@ -36,7 +36,7 @@ public class ConfigInfo extends BasicOption { public void draw(long vg, int x, int y) { Scissor scissor = ScissorManager.scissor(vg, x, y, size == 1 ? 448 : 960, 32); RenderManager.drawImage(vg, image, x, y + 4, 24, 24); - RenderManager.drawString(vg, name, x + 32, y + 18, OneConfigConfig.WHITE_90, 12, Fonts.MEDIUM); + RenderManager.drawString(vg, name, x + 32, y + 18, OneConfigConfig.WHITE_90, 14, Fonts.MEDIUM); ScissorManager.resetScissor(vg, scissor); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java index 77a68ad..b9bd095 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java @@ -40,11 +40,11 @@ public class ConfigUniSelector extends BasicOption { Scissor scissor = ScissorManager.scissor(vg, x + 256, y, 192, 32); if (previous == -1) { - RenderManager.drawString(vg, option, x + 352 - RenderManager.getTextWidth(vg, option, 12f, Fonts.MEDIUM) / 2f, y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.MEDIUM); + RenderManager.drawString(vg, option, x + 352 - RenderManager.getTextWidth(vg, option, 12f, Fonts.MEDIUM) / 2f, y + 15, OneConfigConfig.WHITE_90, 14f, Fonts.MEDIUM); } else { String prevOption = options[previous] + " " + (previous + 1) + "/" + options.length; - RenderManager.drawString(vg, selected < previous ? prevOption : option, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? prevOption : option, 12f, Fonts.MEDIUM) / 2f + 192 * percentMove, y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.MEDIUM); - RenderManager.drawString(vg, selected < previous ? option : prevOption, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? option : prevOption, 12f, Fonts.MEDIUM) / 2f - 192 * (1 - percentMove), y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.MEDIUM); + RenderManager.drawString(vg, selected < previous ? prevOption : option, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? prevOption : option, 14f, Fonts.MEDIUM) / 2f + 192 * percentMove, y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.MEDIUM); + RenderManager.drawString(vg, selected < previous ? option : prevOption, x + 352 - RenderManager.getTextWidth(vg, selected < previous ? option : prevOption, 14f, Fonts.MEDIUM) / 2f - 192 * (1 - percentMove), y + 15, OneConfigConfig.WHITE_90, 12f, Fonts.MEDIUM); } ScissorManager.resetScissor(vg, scissor); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java index f9b930b..c7351d3 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java @@ -16,11 +16,12 @@ public class ModsPage extends Page { private final List<ModCard> modCards = new ArrayList<>(); private final List<BasicButton> modCategories = new ArrayList<>(); + private int size; public ModsPage() { super("Mods"); for (Mod modData : OneConfig.loadedMods) { - modCards.add(new ModCard(modData, null, true, false, false)); + modCards.add(new ModCard(modData, null, true, false, OneConfigConfig.favoriteMods.contains(modData.name))); } for (ModCard card : modCards) { if (card.isFavorite()) { @@ -39,12 +40,6 @@ public class ModsPage extends Page { } public void draw(long vg, int x, int y) { - int iXCat = x + 16; - for (BasicButton btn : modCategories) { - btn.draw(vg, iXCat, y + 16); - iXCat += btn.getWidth() + 8; - } - int iX = x + 16; int iY = y + 72; for (ModCard modCard : modCards) { @@ -57,11 +52,22 @@ public class ModsPage extends Page { } } } + size = iY + 119; 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.MEDIUM); } } + @Override + public int drawStatic(long vg, int x, int y) { + int iXCat = x + 16; + for (BasicButton btn : modCategories) { + btn.draw(vg, iXCat, y + 16); + iXCat += btn.getWidth() + 8; + } + return 60; + } + private void unselect(int index) { for (int i = 0; i < modCategories.size(); i++) { if (index == i) continue; @@ -70,6 +76,19 @@ public class ModsPage extends Page { } @Override + public void finishUpAndClose() { + OneConfigConfig.favoriteMods.clear(); + for (ModCard modCard : modCards) { + if (modCard.isFavorite()) OneConfigConfig.favoriteMods.add(modCard.getModData().name); + } + } + + @Override + public int getMaxScrollHeight() { + return size; + } + + @Override public boolean isBase() { return true; } diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java index 806cb0a..5669681 100644 --- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java @@ -17,6 +17,14 @@ public class TestConfig extends Config { public static boolean ignored; @Option( + name = "Test color selector", + subcategory = "Test", + type = OptionType.COLOR, + size = 2 + ) + public static int color; + + @Option( name = "Test dual thing", subcategory = "Test", min = 3f, max = 127f, |