diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-31 18:20:56 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-31 18:20:56 +0200 |
commit | cefa8b73541a129f590816a0a28af8ed8422d463 (patch) | |
tree | bd434e22fe6a43a7f15140bd4cc41996c45d7161 /src/main/java/cc/polyfrost | |
parent | db27528fc27f42ed0c8082630be0103c9f03dcf3 (diff) | |
parent | e4ae388003330bfbdc1726237f89bdfd92871b0b (diff) | |
download | OneConfig-cefa8b73541a129f590816a0a28af8ed8422d463.tar.gz OneConfig-cefa8b73541a129f590816a0a28af8ed8422d463.tar.bz2 OneConfig-cefa8b73541a129f590816a0a28af8ed8422d463.zip |
fix
Diffstat (limited to 'src/main/java/cc/polyfrost')
8 files changed, 32 insertions, 25 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java index 9bde547..7b42fe9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java @@ -42,6 +42,7 @@ public class OneConfig { throw new RuntimeException("OneConfig has not been initialized! Please add the OneConfig tweaker or call OneConfigInit via an ITweaker or a FMLLoadingPlugin!"); } oneConfigDir.mkdirs(); + new File(oneConfigDir, "profiles").mkdirs(); config = new OneConfigConfig(); } diff --git a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java index dfc5e16..9ab6f68 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java @@ -43,7 +43,9 @@ public class Profiles { } public static File getProfileDir(String profile) { - return new File(new File("OneConfig/profiles"), profile); + File folder = new File("OneConfig/profiles"); + folder.mkdirs(); + return new File(folder, profile); } public static File getProfileFile(String file) { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index be473f9..6c37229 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -169,7 +169,7 @@ public class OneConfigGui extends UScreen { long end = System.nanoTime() - start; String s = (" draw: " + end / 1000000f + "ms"); - RenderManager.drawText(vg, s, x + 1170, y + 790, OneConfigConfig.GRAY_300, 10f, Fonts.MEDIUM); + RenderManager.drawText(vg, s, x + 1170, y + 792, OneConfigConfig.GRAY_300, 10f, Fonts.MEDIUM); if (currentColorSelector != null) { currentColorSelector.draw(vg); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java index d3326a5..410f98f 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java @@ -19,7 +19,7 @@ import java.util.ArrayList; public class ModCard extends BasicElement { private final Mod modData; - private final BasicElement favoriteHitbox = new BasicElement(32, 32, -2, true); + private final BasicElement favoriteHitbox = new BasicElement(32, 32, ColorUtils.PRIMARY, true); private boolean active, disabled, favorite; private int colorGray = OneConfigConfig.GRAY_600; private int colorPrimary = OneConfigConfig.PRIMARY_600; diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java index 9024516..4a986d7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java @@ -51,12 +51,12 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f if (size == 1) { RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor, 12); RenderManager.drawText(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); - RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); } else { RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 12); RenderManager.drawText(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); - RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); } RenderManager.setAlpha(vg, 1f); @@ -82,13 +82,13 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor, 12); RenderManager.drawText(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); if (hovered && Mouse.isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); - RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); RenderManager.setAlpha(vg, 1f); - RenderManager.drawRoundedRect(vg, x + 224, y + 48, 256, options.length * 32 + 8, OneConfigConfig.GRAY_700, 12); - RenderManager.drawHollowRoundRect(vg, x + 223, y + 47, 258, options.length * 32 + 10, new Color(204, 204, 204, 77).getRGB(), 12, 1); - int optionY = y + 52; + RenderManager.drawRoundedRect(vg, x + 224, y + 40, 256, options.length * 32 + 8, OneConfigConfig.GRAY_700, 12); + RenderManager.drawHollowRoundRect(vg, x + 223, y + 39, 258, options.length * 32 + 10, new Color(204, 204, 204, 77).getRGB(), 12, 1); + int optionY = y + 44; for (String option : options) { int color = OneConfigConfig.WHITE_80; boolean optionHovered = InputUtils.isAreaHovered(x + 224, optionY, 252, 32); @@ -114,13 +114,13 @@ public class ConfigDropdown extends BasicOption { // TODO: remove dividers and f RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 12); RenderManager.drawText(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); if (hovered && Mouse.isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); - RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, OneConfigConfig.PRIMARY_600, 8); + RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, hovered ? OneConfigConfig.PRIMARY_500 : OneConfigConfig.PRIMARY_600, 8); RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); RenderManager.setAlpha(vg, 1f); - RenderManager.drawRoundedRect(vg, x + 352, y + 48, 640, options.length * 32 + 8, OneConfigConfig.GRAY_700, 12); - RenderManager.drawHollowRoundRect(vg, x + 351, y + 47, 642, options.length * 32 + 10, new Color(204, 204, 204, 77).getRGB(), 12, 1); - int optionY = y + 52; + RenderManager.drawRoundedRect(vg, x + 352, y + 40, 640, options.length * 32 + 8, OneConfigConfig.GRAY_700, 12); + RenderManager.drawHollowRoundRect(vg, x + 351, y + 39, 642, options.length * 32 + 10, new Color(204, 204, 204, 77).getRGB(), 12, 1); + int optionY = y + 44; for (String option : options) { int color = OneConfigConfig.WHITE_80; boolean optionHovered = InputUtils.isAreaHovered(x + 352, optionY, 640, 36); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java index ff82879..91a8ff2 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java @@ -103,9 +103,9 @@ public class TextInputField extends BasicElement { RenderManager.drawHollowRoundRect(vg, x, y, width - 0.5f, height - 0.5f, colorOutline, 12f, 2f); else { RenderManager.setAlpha(vg, 0.15f); - RenderManager.drawRoundedRect(vg, x - 4, y - 4, width + 8, height + 8, OneConfigConfig.PRIMARY_600, 16); + RenderManager.drawRoundedRect(vg, x - 4, y - 4, width + 8, height + 8, errored ? OneConfigConfig.ERROR_600 : OneConfigConfig.PRIMARY_600, 16); RenderManager.setAlpha(vg, 1f); - RenderManager.drawHollowRoundRect(vg, x, y, width - 0.5f, height - 0.5f, OneConfigConfig.PRIMARY_600, 12f, 2f); + RenderManager.drawHollowRoundRect(vg, x, y, width - 0.5f, height - 0.5f, errored ? OneConfigConfig.ERROR_600 : OneConfigConfig.PRIMARY_600, 12f, 2f); } Scissor scissor = ScissorManager.scissor(vg, x, y, width, height); super.update(x, y); 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 67a1124..cc087a3 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java @@ -65,10 +65,13 @@ public class ModsPage extends Page { @Override public int drawStatic(long vg, int x, int y) { int iXCat = x + 16; + boolean selected = false; for (BasicButton btn : modCategories) { btn.draw(vg, iXCat, y + 16); iXCat += btn.getWidth() + 8; + if(btn.isToggled()) selected = true; } + if(!selected) modCategories.get(0).setToggled(true); return 60; } diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java index 7095869..b980642 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java @@ -73,18 +73,18 @@ public final class ColorUtils { case SECONDARY_TRANSPARENT: // Formally -2 return getColorComponents(color, new float[]{0f, 0f, 0f, 0f}, new float[]{0.9f, 0.9f, 0.9f, 0.3f}, hover, 50f); case PRIMARY: // Formally 1 - return getColorComponents(color, splitColor(OneConfigConfig.PRIMARY_700), splitColor(OneConfigConfig.PRIMARY_600), hover, 100f); + return getColorComponents(color, splitColor(OneConfigConfig.PRIMARY_700), splitColor(OneConfigConfig.PRIMARY_600), hover, 20f); default: case SECONDARY: // Formally 0 - return getColorComponents(color, splitColor(OneConfigConfig.GRAY_500), splitColor(OneConfigConfig.GRAY_400), hover, 100f); + return getColorComponents(color, splitColor(OneConfigConfig.GRAY_500), splitColor(OneConfigConfig.GRAY_400), hover, 20f); case TERTIARY: - return getColorComponents(color, splitColor(OneConfigConfig.WHITE_90), splitColor(OneConfigConfig.WHITE), hover, 150f); + return getColorComponents(color, splitColor(OneConfigConfig.WHITE_90), splitColor(OneConfigConfig.WHITE), hover, 20f); case PRIMARY_DESTRUCTIVE: - return getColorComponents(color, splitColor(OneConfigConfig.ERROR_700), splitColor(OneConfigConfig.ERROR_600), hover, 100f); + return getColorComponents(color, splitColor(OneConfigConfig.ERROR_700), splitColor(OneConfigConfig.ERROR_600), hover, 20f); case SECONDARY_DESTRUCTIVE: - return getColorComponents(color, splitColor(OneConfigConfig.ERROR_800), splitColor(OneConfigConfig.GRAY_500), !hover, 100f); + return getColorComponents(color, splitColor(OneConfigConfig.ERROR_800), splitColor(OneConfigConfig.GRAY_500), !hover, 20f); case TERTIARY_DESTRUCTIVE: - return getColorComponents(color, splitColor(OneConfigConfig.WHITE_90), splitColor(OneConfigConfig.ERROR_300), hover, 100f); + return getColorComponents(color, splitColor(OneConfigConfig.WHITE_90), splitColor(OneConfigConfig.ERROR_300), hover, 20f); } } @@ -99,7 +99,7 @@ public final class ColorUtils { float[] init = splitColor(initColor); float[] finalC = splitColor(finalColor); float[] current = splitColor(currentColor); - return getColorComponents(current, init, finalC, direction, speed + 100f); + return getColorComponents(current, init, finalC, direction, speed); } private static float[] splitColor(int color) { @@ -120,12 +120,13 @@ public final class ColorUtils { } private static float smooth(float current, float min, float max, boolean moveToFinal, float speed) { - current = MathUtils.easeOut(current, moveToFinal ? 1f : 0f, speed); - if (current <= min) { + if(min > max) System.out.println(min * 255 + " " + max * 255); + current = MathUtils.easeOut(current, moveToFinal ? max : min, speed); + if (current < min) { current = min; } - if (current >= max) { + if (current > max) { current = max; } return current; |