diff options
author | MoonTidez <79183852+MoonTidez@users.noreply.github.com> | 2022-05-15 19:50:30 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-15 17:50:30 +0200 |
commit | 6254bbc42d0611f8eaee97b6d4c7710d082c6826 (patch) | |
tree | 78337ed22153af7cb992eb98e3a569b9a372d534 /src/main/java/cc/polyfrost/oneconfig/gui/elements/config | |
parent | 2c592090b9448203559e01326bc2c2d995b15d53 (diff) | |
download | OneConfig-6254bbc42d0611f8eaee97b6d4c7710d082c6826.tar.gz OneConfig-6254bbc42d0611f8eaee97b6d4c7710d082c6826.tar.bz2 OneConfig-6254bbc42d0611f8eaee97b6d4c7710d082c6826.zip |
SVG + asset reorganization (#10)
* Assets reorganization
* forgot 4 pixels in alpha grid oops
* Updated huegradient.png
Reduces file size by only use 1px height instead of 720px while maintaining quality
* we do a little renaming
* new assets mapping
* moon I hate you
* e
* moon is weird
* make it compile
* temp
* part png rendering
* svgs
* fix some positionings and stuff
Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/config')
8 files changed, 29 insertions, 24 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java index 8a30d71..4553739 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java @@ -5,6 +5,7 @@ import cc.polyfrost.oneconfig.config.interfaces.BasicOption; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.ColorUtils; import cc.polyfrost.oneconfig.utils.InputUtils; import cc.polyfrost.oneconfig.utils.MathUtils; @@ -49,9 +50,11 @@ public class ConfigCheckbox extends BasicOption { RenderManager.drawString(vg, name, x + 32, y + 17, OneConfigConfig.WHITE_90, 14f, Fonts.MEDIUM); percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 5f)); if (percentOn != 0 && percentOn != 1f) { - RenderManager.drawImage(vg, Images.CHECKMARK, x, y + 4, 24, 24, new Color(1f, 1f, 1f, percentOn).getRGB()); + RenderManager.drawRoundedRect(vg, x, y + 4, 24, 24, ColorUtils.setAlpha(OneConfigConfig.BLUE_500, (int) (percentOn * 255)), 6f); + RenderManager.drawSvg(vg, SVGs.CHECKBOX_TICK, x, y + 4, 24, 24, new Color(1f, 1f, 1f, percentOn).getRGB()); } else if (percentOn != 0) { - RenderManager.drawImage(vg, Images.CHECKMARK, x, y + 4, 24, 24); + RenderManager.drawRoundedRect(vg, x, y + 4, 24, 24, OneConfigConfig.BLUE_500, 6f); + RenderManager.drawSvg(vg, SVGs.CHECKBOX_TICK, x, y + 4, 24, 24); } NanoVG.nvgGlobalAlpha(vg, 1f); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java index aed367f..6cf60e0 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java @@ -78,7 +78,7 @@ public class ConfigColorElement extends BasicOption { element.update(x + 432, y); RenderManager.drawRoundedRect(vg, x + 432, y, 64, 32, OneConfigConfig.GRAY_300, 12f); - RenderManager.drawImage(vg, Images.COLOR_BASE, x + 948, y + 4, 56, 24, color.getRGB()); + RenderManager.drawImage(vg, Images.ALPHA_GRID, x + 948, y + 4, 56, 24, color.getRGB()); if (element.isClicked() && !element.isToggled()) { OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(new OneColor(40, 30, 20), InputUtils.mouseX(), InputUtils.mouseY())); } 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 c2cb0cf..199e0f0 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 @@ -5,6 +5,7 @@ import cc.polyfrost.oneconfig.config.interfaces.BasicOption; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.ColorUtils; import cc.polyfrost.oneconfig.utils.InputUtils; import org.lwjgl.input.Mouse; @@ -53,14 +54,12 @@ public class ConfigDropdown extends BasicOption { // TODO: chose where dividers RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor, 12); RenderManager.drawString(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 8, 10, 6); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 24, 10, -6); + RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); } else { RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 12); RenderManager.drawString(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 971, y + 8, 10, 6); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 971, y + 24, 10, -6); + RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); } NanoVG.nvgGlobalAlpha(vg, 1f); } @@ -114,8 +113,7 @@ public class ConfigDropdown extends BasicOption { // TODO: chose where dividers if (hovered && Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f); RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 8, 10, 6); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 24, 10, -6); + RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 452, y + 4, 24, 24); } else { RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 12); RenderManager.drawString(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.MEDIUM); @@ -149,8 +147,7 @@ public class ConfigDropdown extends BasicOption { // TODO: chose where dividers if (hovered && Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f); RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 971, y + 8, 10, 6); - RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 971, y + 24, 10, -6); + RenderManager.drawSvg(vg, SVGs.DROPDOWN_LIST, x + 964, y + 4, 24, 24); } NanoVG.nvgGlobalAlpha(vg, 1f); } 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 2e29328..68ebf37 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 @@ -6,28 +6,29 @@ import cc.polyfrost.oneconfig.config.interfaces.BasicOption; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor; import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager; import java.lang.reflect.Field; public class ConfigInfo extends BasicOption { - private Images image; + private SVGs image; public ConfigInfo(Field field, Object parent, String name, int size, InfoType type) { super(field, parent, name, size); switch (type) { case INFO: - image = Images.INFO; + image = SVGs.INFO_CIRCLE; break; case SUCCESS: - image = Images.SUCCESS; + image = SVGs.CHECK_CIRCLE; break; case WARNING: - image = Images.WARNING; + image = SVGs.WARNING; break; case ERROR: - image = Images.ERROR; + image = SVGs.ERROR; break; } } @@ -35,7 +36,7 @@ public class ConfigInfo extends BasicOption { @Override 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.drawSvg(vg, image, x, y + 4, 24, 24); 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/ConfigKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java index 01a2bd2..5b3efae 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java @@ -8,6 +8,7 @@ import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import gg.essential.universal.UKeyboard; import org.lwjgl.nanovg.NanoVG; @@ -19,7 +20,7 @@ public class ConfigKeyBind extends BasicOption { public ConfigKeyBind(Field field, Object parent, String name, int size) { super(field, parent, name, size); - button = new BasicButton(256, 32, "", Images.KEYSTROKE, null, 0, BasicButton.ALIGNMENT_CENTER, true); + button = new BasicButton(256, 32, "", SVGs.KEYSTROKE, null, 0, BasicButton.ALIGNMENT_CENTER, true); button.alignIconLeft(true); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java index 3288123..81cd946 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java @@ -8,6 +8,7 @@ import cc.polyfrost.oneconfig.gui.pages.ModConfigPage; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.ColorUtils; import cc.polyfrost.oneconfig.utils.InputUtils; import org.lwjgl.input.Mouse; @@ -40,7 +41,7 @@ public class ConfigPageButton extends BasicOption { RenderManager.drawString(vg, name, x + 10, y + 32, OneConfigConfig.WHITE_90, 24, Fonts.MEDIUM); if (!description.equals("")) RenderManager.drawString(vg, name, x + 10, y + 70, OneConfigConfig.WHITE_90, 14, Fonts.MEDIUM); - RenderManager.drawImage(vg, Images.CHEVRON_ARROW, x + 981f, y + (description.equals("") ? 20f : 36f), 13, 22); + RenderManager.drawSvg(vg, SVGs.CHEVRON_RIGHT, x + 981f, y + (description.equals("") ? 20f : 36f), 13, 22); if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page)); NanoVG.nvgGlobalAlpha(vg, 1f); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java index 3aa4050..d420f01 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java @@ -5,6 +5,7 @@ import cc.polyfrost.oneconfig.config.interfaces.BasicOption; import cc.polyfrost.oneconfig.lwjgl.RenderManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.Images; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.utils.InputUtils; import cc.polyfrost.oneconfig.gui.elements.text.TextInputField; import org.lwjgl.nanovg.NanoVG; @@ -39,7 +40,7 @@ public class ConfigTextBox extends BasicOption { textField.draw(vg, x + (size == 1 && hasHalfSize() ? 224 : 352), y); if (secure) - RenderManager.drawImage(vg, Images.HIDE_EYE, x + 967, y + 7, 18, 18, new Color(196, 196, 196).getRGB()); + RenderManager.drawSvg(vg, SVGs.EYE, x + 967, y + 7, 18, 18, new Color(196, 196, 196).getRGB()); if (secure && InputUtils.isAreaClicked(x + 967, y + 7, 18, 18)) textField.setPassword(!textField.getPassword()); NanoVG.nvgGlobalAlpha(vg, 1f); } 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 a9b0ab1..e8927fd 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 @@ -3,6 +3,7 @@ package cc.polyfrost.oneconfig.gui.elements.config; import cc.polyfrost.oneconfig.config.OneConfigConfig; import cc.polyfrost.oneconfig.config.interfaces.BasicOption; import cc.polyfrost.oneconfig.lwjgl.RenderManager; +import cc.polyfrost.oneconfig.lwjgl.image.SVGs; import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor; import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; @@ -49,10 +50,10 @@ public class ConfigUniSelector extends BasicOption { } ScissorManager.resetScissor(vg, scissor); - RenderManager.drawImage(vg, Images.CHEVRON_ARROW, x + 248, y + 7, -8, 14, OneConfigConfig.BLUE_400); - RenderManager.drawImage(vg, Images.CHEVRON_ARROW, x + 456, y + 7, 8, 14, OneConfigConfig.BLUE_400); + RenderManager.drawSvg(vg, SVGs.CHEVRON_LEFT, x + 231, y + 7, 18, 18, OneConfigConfig.BLUE_400); + RenderManager.drawSvg(vg, SVGs.CHEVRON_RIGHT, x + 455, y + 7, 18, 18, OneConfigConfig.BLUE_400); - if (InputUtils.isAreaClicked(x + 235, y + 5, 18, 18) && selected > 0 && isEnabled()) { + if (InputUtils.isAreaClicked(x + 231, y + 7, 18, 18) && selected > 0 && isEnabled()) { previous = selected; selected -= 1; try { @@ -60,7 +61,7 @@ public class ConfigUniSelector extends BasicOption { } catch (IllegalAccessException ignored) { } percentMove = selected < previous ? 0f : 1f; - } else if (InputUtils.isAreaClicked(x + 451, y + 5, 18, 18) && selected < options.length - 1 && isEnabled()) { + } else if (InputUtils.isAreaClicked(x + 455, y + 7, 18, 18) && selected < options.length - 1 && isEnabled()) { previous = selected; selected += 1; try { |