diff options
Diffstat (limited to 'src')
13 files changed, 118 insertions, 101 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index b25a8e3..34a5f98 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -3,7 +3,6 @@ package cc.polyfrost.oneconfig.gui; import cc.polyfrost.oneconfig.gui.animations.Animation; import cc.polyfrost.oneconfig.gui.animations.CubicBezier; import cc.polyfrost.oneconfig.gui.animations.DummyAnimation; -import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuart; import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.gui.pages.CreditsPage; import cc.polyfrost.oneconfig.gui.pages.ModConfigPage; diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java index afe899d..f98371d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java @@ -1,11 +1,11 @@ package cc.polyfrost.oneconfig.gui.elements; -import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.gui.pages.Page; +import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.renderer.RenderManager; +import cc.polyfrost.oneconfig.renderer.SVG; import cc.polyfrost.oneconfig.renderer.font.Fonts; -import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.utils.color.ColorPalette; import cc.polyfrost.oneconfig.utils.color.ColorUtils; import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; public class BasicButton extends BasicElement { protected String text; - protected SVGs icon1, icon2; + protected SVG icon1, icon2; private final int alignment; private final float fontSize, cornerRadius; private final float xSpacing, xPadding; @@ -31,7 +31,7 @@ public class BasicButton extends BasicElement { private Page page; private Runnable runnable; - public BasicButton(int width, int size, String text, SVGs icon1, SVGs icon2, int align, @NotNull ColorPalette colorPalette) { + public BasicButton(int width, int size, String text, SVG icon1, SVG icon2, int align, @NotNull ColorPalette colorPalette) { super(width, 32, colorPalette, true); if (text != null) this.text = text; if (icon1 != null) this.icon1 = icon1; @@ -48,7 +48,7 @@ public class BasicButton extends BasicElement { this.fontSize = size == SIZE_48 ? 20 : (float) (size / 2 - 4); } - public BasicButton(int width, int size, SVGs icon, int align, @NotNull ColorPalette colorPalette) { + public BasicButton(int width, int size, SVG icon, int align, @NotNull ColorPalette colorPalette) { this(width, size, null, icon, null, align, colorPalette); } @@ -156,11 +156,11 @@ public class BasicButton extends BasicElement { this.text = text; } - public void setLeftIcon(SVGs icon) { + public void setLeftIcon(SVG icon) { icon1 = icon; } - public void setRightIcon(SVGs icon) { + public void setRightIcon(SVG icon) { icon2 = icon; } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java index 568567d..d32aa65 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -102,7 +102,7 @@ public class ColorSelector { recentColors.add(new ColorBox(new OneColor(0, 0, 0, 0))); } - topSlider.setImage(Images.HUE_GRADIENT); + topSlider.setImage(Images.HUE_GRADIENT.filePath); } public void draw(long vg) { @@ -183,7 +183,7 @@ public class ColorSelector { dragging = false; } bottomSlider.setGradient(Colors.TRANSPARENT, color.getRGBNoAlpha()); - RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 16, y + 456, 384, 16, 8f); + RenderManager.drawRoundImage(vg, Images.ALPHA_GRID.filePath, x + 16, y + 456, 384, 16, 8f); bottomSlider.draw(vg, x + 16, y + 456); if (percentMoveMain > 0.96f) { @@ -198,7 +198,7 @@ public class ColorSelector { // draw the color preview RenderManager.drawHollowRoundRect(vg, x + 15, y + 487, 384, 40, Colors.GRAY_300, 12f, 2f); - RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 20, y + 492, 376, 32, 8f); + RenderManager.drawRoundImage(vg, Images.ALPHA_GRID.filePath, x + 20, y + 492, 376, 32, 8f); RenderManager.drawRoundedRect(vg, x + 20, y + 492, 376, 32, color.getRGB(), 8f); inputScissor = InputUtils.blockInputArea(x - 3, y - 3, width + 6, height + 6); @@ -215,7 +215,7 @@ public class ColorSelector { case 0: case 2: //buttons.get(mode).colorAnimation.setPalette(ColorPalette.TERTIARY); - topSlider.setImage(Images.HUE_GRADIENT); + topSlider.setImage(Images.HUE_GRADIENT.filePath); RenderManager.drawHSBBox(vg, x + 16, y + 120, 384, 288, color.getRGBMax(true)); if (mode == 0) { @@ -231,7 +231,7 @@ public class ColorSelector { case 1: //buttons.get(1).colorAnimation.setPalette(ColorPalette.TERTIARY); topSlider.setImage(null); - RenderManager.drawRoundImage(vg, Images.COLOR_WHEEL, x + 64, y + 120, 288, 288, 144f); + RenderManager.drawRoundImage(vg, Images.COLOR_WHEEL.filePath, x + 64, y + 120, 288, 288, 144f); topSlider.setGradient(Colors.BLACK, color.getRGBMax(true)); topSlider.setImage(null); @@ -419,7 +419,7 @@ public class ColorSelector { private static class ColorSlider extends Slider { protected int gradColorStart, gradColorEnd; - protected Images image; + protected String image; protected int color; public ColorSlider(int length, float min, float max, float startValue) { @@ -455,7 +455,7 @@ public class ColorSelector { this.color = color; } - public void setImage(Images image) { + public void setImage(String image) { this.image = image; } } 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 a3b45bf..ce6b378 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 @@ -84,7 +84,7 @@ public class ConfigColorElement extends BasicOption { element.update(x1 + 416, y); RenderManager.drawHollowRoundRect(vg, x1 + 415, y - 1, 64, 32, Colors.GRAY_300, 12f, 2f); - RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x1 + 420, y + 4, 56, 24, 8f); + RenderManager.drawRoundImage(vg, Images.ALPHA_GRID.filePath, x1 + 420, y + 4, 56, 24, 8f); RenderManager.drawRoundedRect(vg, x1 + 420, y + 4, 56, 24, color.getRGB(), 8f); if (element.isClicked() && !open) { open = true; 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 3d9602b..4f7d0f5 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 @@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.config.elements.BasicOption; import cc.polyfrost.oneconfig.gui.elements.text.TextInputField; import cc.polyfrost.oneconfig.platform.Platform; import cc.polyfrost.oneconfig.renderer.RenderManager; +import cc.polyfrost.oneconfig.renderer.SVG; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.utils.InputUtils; @@ -46,7 +47,7 @@ public class ConfigTextBox extends BasicOption { textField.draw(vg, x + (size == 1 ? 224 : 352), y); if (secure) { - SVGs icon = textField.getPassword() ? SVGs.EYE_OFF : SVGs.EYE; + final SVG icon = textField.getPassword() ? SVGs.EYE_OFF : SVGs.EYE; boolean hovered = InputUtils.isAreaHovered(x + 967, y + 7, 18, 18) && isEnabled(); int color = hovered ? Colors.WHITE : Colors.WHITE_80; if (hovered && InputUtils.isClicked()) textField.setPassword(!textField.getPassword()); 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 3c2cb1c..1052487 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 @@ -2,10 +2,10 @@ package cc.polyfrost.oneconfig.gui.elements.text; import cc.polyfrost.oneconfig.gui.elements.BasicElement; import cc.polyfrost.oneconfig.internal.assets.Colors; -import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.libs.universal.UKeyboard; import cc.polyfrost.oneconfig.platform.Platform; import cc.polyfrost.oneconfig.renderer.RenderManager; +import cc.polyfrost.oneconfig.renderer.SVG; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.renderer.scissor.Scissor; import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager; @@ -35,12 +35,12 @@ public class TextInputField extends BasicElement { protected boolean onlyNums = false; protected boolean errored = false; protected boolean centered = false; - protected SVGs icon; + protected SVG icon; protected ArrayList<String> wrappedText = null; private long clickTimeD1; private int lines = 1; - public TextInputField(int width, int height, String defaultText, boolean multiLine, boolean password, SVGs icon) { + public TextInputField(int width, int height, String defaultText, boolean multiLine, boolean password, SVG icon) { super(width, height, false); this.multiLine = multiLine; this.defaultText = defaultText; diff --git a/src/main/java/cc/polyfrost/oneconfig/images/Image.java b/src/main/java/cc/polyfrost/oneconfig/images/OneImage.java index 16957c1..20bfc2c 100644 --- a/src/main/java/cc/polyfrost/oneconfig/images/Image.java +++ b/src/main/java/cc/polyfrost/oneconfig/images/OneImage.java @@ -20,53 +20,53 @@ import java.util.Objects; /** An Image wrapper class that is used by the OneConfig system.*/ @SuppressWarnings("unused") -public class Image { +public class OneImage { private static final Logger LOGGER = LogManager.getLogger("OneConfig Images"); private BufferedImage image; private Graphics2D graphics = null; private final int width, height; /** - * Create a new Image from the file. This can be as a resource location inside your JAR. + * Create a new OneImage from the file. This can be as a resource location inside your JAR. * @param filePath The path to the image file. */ - public Image(String filePath) throws IOException { - image = ImageIO.read(Objects.requireNonNull(Image.class.getResourceAsStream(filePath))); + public OneImage(String filePath) throws IOException { + image = ImageIO.read(Objects.requireNonNull(OneImage.class.getResourceAsStream(filePath))); width = image.getWidth(); height = image.getHeight(); } /** - * Create a new Image from the file. + * Create a new OneImage from the file. * @param is InputStream to the image file. */ - public Image(InputStream is) throws IOException { + public OneImage(InputStream is) throws IOException { image = ImageIO.read(is); width = image.getWidth(); height = image.getHeight(); } /** - * Create a new Image from the file. + * Create a new OneImage from the file. * @param file File to the image file. */ - public Image(File file) throws IOException { + public OneImage(File file) throws IOException { image = ImageIO.read(Objects.requireNonNull(file)); width = image.getWidth(); height = image.getHeight(); } /** - * Create a new Image from the BufferedImage. + * Create a new OneImage from the BufferedImage. */ - public Image(BufferedImage image) { + public OneImage(BufferedImage image) { this.image = image; width = image.getWidth(); height = image.getHeight(); } /** Create a new blank image with the specified width and height. */ - public Image(int width, int height) { + public OneImage(int width, int height) { this.width = width; this.height = height; image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/assets/Images.java b/src/main/java/cc/polyfrost/oneconfig/internal/assets/Images.java index b7dc9cc..1007be7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/assets/Images.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/assets/Images.java @@ -1,6 +1,7 @@ package cc.polyfrost.oneconfig.internal.assets; import cc.polyfrost.oneconfig.renderer.AssetLoader; +import cc.polyfrost.oneconfig.renderer.Image; /** * An enum of images used in OneConfig. @@ -8,14 +9,8 @@ import cc.polyfrost.oneconfig.renderer.AssetLoader; * @see cc.polyfrost.oneconfig.renderer.RenderManager#drawImage(long, String, float, float, float, float, int) * @see AssetLoader */ -public enum Images { - HUE_GRADIENT("/assets/oneconfig/options/HueGradient.png"), - COLOR_WHEEL("/assets/oneconfig/options/ColorWheel.png"), - ALPHA_GRID("/assets/oneconfig/options/AlphaGrid.png"); - - public final String filePath; - - Images(String filePath) { - this.filePath = filePath; - } +public class Images { + public static final Image HUE_GRADIENT = new Image("/assets/oneconfig/options/HueGradient.png"); + public static final Image COLOR_WHEEL = new Image("/assets/oneconfig/options/ColorWheel.png"); + public static final Image ALPHA_GRID = new Image("/assets/oneconfig/options/AlphaGrid.png"); }
\ No newline at end of file diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java b/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java index eaad4ba..d0e05bf 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java @@ -1,6 +1,7 @@ package cc.polyfrost.oneconfig.internal.assets; import cc.polyfrost.oneconfig.renderer.AssetLoader; +import cc.polyfrost.oneconfig.renderer.SVG; /** * An enum of SVGs used in OneConfig. @@ -8,47 +9,41 @@ import cc.polyfrost.oneconfig.renderer.AssetLoader; * @see cc.polyfrost.oneconfig.renderer.RenderManager#drawSvg(long, String, float, float, float, float, int) * @see AssetLoader */ -public enum SVGs { - ONECONFIG("/assets/oneconfig/icons/OneConfig.svg"), - ONECONFIG_OFF("/assets/oneconfig/icons/OneConfigOff.svg"), - COPYRIGHT_FILL("/assets/oneconfig/icons/CopyrightFill.svg"), - APERTURE_FILL("/assets/oneconfig/icons/ApertureFill.svg"), - ARROWS_CLOCKWISE_BOLD("/assets/oneconfig/icons/ArrowsClockwiseBold.svg"), - FADERS_HORIZONTAL_BOLD("/assets/oneconfig/icons/FadersHorizontalBold.svg"), - GAUGE_FILL("/assets/oneconfig/icons/GaugeFill.svg"), - GEAR_SIX_FILL("/assets/oneconfig/icons/GearSixFill.svg"), - MAGNIFYING_GLASS_BOLD("/assets/oneconfig/icons/MagnifyingGlassBold.svg"), - NOTE_PENCIL_BOLD("/assets/oneconfig/icons/NotePencilBold.svg"), - PAINT_BRUSH_BROAD_FILL("/assets/oneconfig/icons/PaintBrushBroadFill.svg"), - USER_SWITCH_FILL("/assets/oneconfig/icons/UserSwitchFill.svg"), - X_CIRCLE_BOLD("/assets/oneconfig/icons/XCircleBold.svg"), - CARET_LEFT("/assets/oneconfig/icons/CaretLeftBold.svg"), - CARET_RIGHT("/assets/oneconfig/icons/CaretRightBold.svg"), +public class SVGs { + public static final SVG ONECONFIG = new SVG("/assets/oneconfig/icons/OneConfig.svg"); + public static final SVG ONECONFIG_OFF = new SVG("/assets/oneconfig/icons/OneConfigOff.svg"); + public static final SVG COPYRIGHT_FILL = new SVG("/assets/oneconfig/icons/CopyrightFill.svg"); + public static final SVG APERTURE_FILL = new SVG("/assets/oneconfig/icons/ApertureFill.svg"); + public static final SVG ARROWS_CLOCKWISE_BOLD = new SVG("/assets/oneconfig/icons/ArrowsClockwiseBold.svg"); + public static final SVG FADERS_HORIZONTAL_BOLD = new SVG("/assets/oneconfig/icons/FadersHorizontalBold.svg"); + public static final SVG GAUGE_FILL = new SVG("/assets/oneconfig/icons/GaugeFill.svg"); + public static final SVG GEAR_SIX_FILL = new SVG("/assets/oneconfig/icons/GearSixFill.svg"); + public static final SVG MAGNIFYING_GLASS_BOLD = new SVG("/assets/oneconfig/icons/MagnifyingGlassBold.svg"); + public static final SVG NOTE_PENCIL_BOLD = new SVG("/assets/oneconfig/icons/NotePencilBold.svg"); + public static final SVG PAINT_BRUSH_BROAD_FILL = new SVG("/assets/oneconfig/icons/PaintBrushBroadFill.svg"); + public static final SVG USER_SWITCH_FILL = new SVG("/assets/oneconfig/icons/UserSwitchFill.svg"); + public static final SVG X_CIRCLE_BOLD = new SVG("/assets/oneconfig/icons/XCircleBold.svg"); + public static final SVG CARET_LEFT = new SVG("/assets/oneconfig/icons/CaretLeftBold.svg"); + public static final SVG CARET_RIGHT = new SVG("/assets/oneconfig/icons/CaretRightBold.svg"); // OLD ICONS - BOX("/assets/oneconfig/old-icons/Box.svg"), - CHECKBOX_TICK("/assets/oneconfig/old-icons/CheckboxTick.svg"), - CHECK_CIRCLE("/assets/oneconfig/old-icons/CheckCircle.svg"), - CHEVRON_DOWN("/assets/oneconfig/old-icons/ChevronDown.svg"), - CHEVRON_UP("/assets/oneconfig/old-icons/ChevronUp.svg"), - COPY("/assets/oneconfig/old-icons/Copy.svg"), - DROPDOWN_LIST("/assets/oneconfig/old-icons/DropdownList.svg"), - ERROR("/assets/oneconfig/old-icons/Error.svg"), - EYE("/assets/oneconfig/old-icons/Eye.svg"), - EYE_OFF("/assets/oneconfig/old-icons/EyeOff.svg"), - HEART_FILL("/assets/oneconfig/old-icons/HeartFill.svg"), - HEART_OUTLINE("/assets/oneconfig/old-icons/HeartOutline.svg"), - HELP_CIRCLE("/assets/oneconfig/old-icons/HelpCircle.svg"), - HISTORY("/assets/oneconfig/old-icons/History.svg"), - INFO_CIRCLE("/assets/oneconfig/old-icons/InfoCircle.svg"), - KEYSTROKE("/assets/oneconfig/old-icons/Keystroke.svg"), - PASTE("/assets/oneconfig/old-icons/Paste.svg"), - POP_OUT("/assets/oneconfig/old-icons/PopOut.svg"), - WARNING("/assets/oneconfig/old-icons/Warning.svg"); - - public final String filePath; - - SVGs(String filePath) { - this.filePath = filePath; - } + public static final SVG BOX = new SVG("/assets/oneconfig/old-icons/Box.svg"); + public static final SVG CHECKBOX_TICK = new SVG("/assets/oneconfig/old-icons/CheckboxTick.svg"); + public static final SVG CHECK_CIRCLE = new SVG("/assets/oneconfig/old-icons/CheckCircle.svg"); + public static final SVG CHEVRON_DOWN = new SVG("/assets/oneconfig/old-icons/ChevronDown.svg"); + public static final SVG CHEVRON_UP = new SVG("/assets/oneconfig/old-icons/ChevronUp.svg"); + public static final SVG COPY = new SVG("/assets/oneconfig/old-icons/Copy.svg"); + public static final SVG DROPDOWN_LIST = new SVG("/assets/oneconfig/old-icons/DropdownList.svg"); + public static final SVG ERROR = new SVG("/assets/oneconfig/old-icons/Error.svg"); + public static final SVG EYE = new SVG("/assets/oneconfig/old-icons/Eye.svg"); + public static final SVG EYE_OFF = new SVG("/assets/oneconfig/old-icons/EyeOff.svg"); + public static final SVG HEART_FILL = new SVG("/assets/oneconfig/old-icons/HeartFill.svg"); + public static final SVG HEART_OUTLINE = new SVG("/assets/oneconfig/old-icons/HeartOutline.svg"); + public static final SVG HELP_CIRCLE = new SVG("/assets/oneconfig/old-icons/HelpCircle.svg"); + public static final SVG HISTORY = new SVG("/assets/oneconfig/old-icons/History.svg"); + public static final SVG INFO_CIRCLE = new SVG("/assets/oneconfig/old-icons/InfoCircle.svg"); + public static final SVG KEYSTROKE = new SVG("/assets/oneconfig/old-icons/Keystroke.svg"); + public static final SVG PASTE = new SVG("/assets/oneconfig/old-icons/Paste.svg"); + public static final SVG POP_OUT = new SVG("/assets/oneconfig/old-icons/PopOut.svg"); + public static final SVG WARNING = new SVG("/assets/oneconfig/old-icons/Warning.svg"); } diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/Image.java b/src/main/java/cc/polyfrost/oneconfig/renderer/Image.java new file mode 100644 index 0000000..fab70a4 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/Image.java @@ -0,0 +1,14 @@ +package cc.polyfrost.oneconfig.renderer; + +/** + * Data class storing an image. + * This class is purely a data class, and does not contain any logic. It does not need to be used unless you want to + * differentiate between a String and an image. + */ +public class Image { + public final String filePath; + + public Image(String filePath) { + this.filePath = filePath; + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java index 5f8ea11..2e44980 100644 --- a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java @@ -3,7 +3,6 @@ package cc.polyfrost.oneconfig.renderer; import cc.polyfrost.oneconfig.config.data.InfoType; import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.internal.assets.Colors; -import cc.polyfrost.oneconfig.internal.assets.Images; import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.libs.universal.UGraphics; import cc.polyfrost.oneconfig.libs.universal.UResolution; @@ -377,7 +376,7 @@ public final class RenderManager { * * @see RenderManager#drawImage(long, String, float, float, float, float) */ - public static void drawImage(long vg, Images filePath, float x, float y, float width, float height) { + public static void drawImage(long vg, Image filePath, float x, float y, float width, float height) { drawImage(vg, filePath.filePath, x, y, width, height); } @@ -386,7 +385,7 @@ public final class RenderManager { * * @see RenderManager#drawImage(long, String, float, float, float, float, int) */ - public static void drawImage(long vg, Images filePath, float x, float y, float width, float height, int color) { + public static void drawImage(long vg, Image filePath, float x, float y, float width, float height, int color) { drawImage(vg, filePath.filePath, x, y, width, height, color); } @@ -419,7 +418,7 @@ public final class RenderManager { * * @see RenderManager#drawRoundImage(long, String, float, float, float, float, float) */ - public static void drawRoundImage(long vg, Images filePath, float x, float y, float width, float height, float radius) { + public static void drawRoundImage(long vg, Image filePath, float x, float y, float width, float height, float radius) { drawRoundImage(vg, filePath.filePath, x, y, width, height, radius); } @@ -610,7 +609,7 @@ public final class RenderManager { * * @see RenderManager#drawSvg(long, String, float, float, float, float) */ - public static void drawSvg(long vg, SVGs svg, float x, float y, float width, float height) { + public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height) { drawSvg(vg, svg.filePath, x, y, width, height); } @@ -619,7 +618,7 @@ public final class RenderManager { * * @see RenderManager#drawSvg(long, String, float, float, float, float, int) */ - public static void drawSvg(long vg, SVGs svg, float x, float y, float width, float height, int color) { + public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height, int color) { drawSvg(vg, svg.filePath, x, y, width, height, color); } @@ -633,7 +632,7 @@ public final class RenderManager { * @param size The diameter. */ public static void drawInfo(long vg, InfoType type, float x, float y, float size) { - SVGs icon = null; + SVG icon = null; int colorOuter = 0; int colorInner = 0; switch (type) { diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/SVG.java b/src/main/java/cc/polyfrost/oneconfig/renderer/SVG.java new file mode 100644 index 0000000..0aab043 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/SVG.java @@ -0,0 +1,14 @@ +package cc.polyfrost.oneconfig.renderer; + +/** + * Data class storing an SVG image. + * This class is purely a data class, and does not contain any logic. It does not need to be used unless you want to + * differentiate between a String and an SVG image. + */ +public class SVG { + public final String filePath; + + public SVG(String filePath) { + this.filePath = filePath; + } +} diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt index 21c33f0..2665c7f 100644 --- a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt +++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt @@ -3,8 +3,8 @@ package cc.polyfrost.oneconfig.utils.dsl import cc.polyfrost.oneconfig.config.data.InfoType import cc.polyfrost.oneconfig.renderer.RenderManager import cc.polyfrost.oneconfig.renderer.font.Font -import cc.polyfrost.oneconfig.internal.assets.Images -import cc.polyfrost.oneconfig.internal.assets.SVGs +import cc.polyfrost.oneconfig.renderer.Image +import cc.polyfrost.oneconfig.renderer.SVG import cc.polyfrost.oneconfig.utils.color.ColorUtils import org.lwjgl.nanovg.NVGColor @@ -161,16 +161,16 @@ fun Long.drawImage(filePath: String, x: Number, y: Number, width: Number, height fun VG.drawImage(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) = instance.drawImage(filePath, x, y, width, height, color) -fun Long.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number) = +fun Long.drawImage(image: Image, x: Number, y: Number, width: Number, height: Number) = RenderManager.drawImage(this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat()) -fun VG.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number) = +fun VG.drawImage(image: Image, x: Number, y: Number, width: Number, height: Number) = instance.drawImage(image, x, y, width, height) -fun Long.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number, color: Int) = +fun Long.drawImage(image: Image, x: Number, y: Number, width: Number, height: Number, color: Int) = RenderManager.drawImage(this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color) -fun VG.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number, color: Int) = +fun VG.drawImage(image: Image, x: Number, y: Number, width: Number, height: Number, color: Int) = instance.drawImage(image, x, y, width, height, color) @@ -182,12 +182,12 @@ fun Long.drawRoundedImage(filePath: String, x: Number, y: Number, width: Number, fun VG.drawRoundedImage(filePath: String, x: Number, y: Number, width: Number, height: Number, radius: Number) = instance.drawRoundedImage(filePath, x, y, width, height, radius) -fun Long.drawRoundedImage(image: Images, x: Number, y: Number, width: Number, height: Number, radius: Number) = +fun Long.drawRoundedImage(image: Image, x: Number, y: Number, width: Number, height: Number, radius: Number) = RenderManager.drawRoundImage( this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), radius.toFloat() ) -fun VG.drawRoundedImage(image: Images, x: Number, y: Number, width: Number, height: Number, radius: Number) = +fun VG.drawRoundedImage(image: Image, x: Number, y: Number, width: Number, height: Number, radius: Number) = instance.drawRoundedImage(image, x, y, width, height, radius) @@ -248,16 +248,16 @@ fun Long.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: fun VG.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) = instance.drawSVG(filePath, x, y, width, height, color) -fun Long.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number) = +fun Long.drawSVG(svg: SVG, x: Number, y: Number, width: Number, height: Number) = RenderManager.drawSvg(this, svg, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat()) -fun VG.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number) = +fun VG.drawSVG(svg: SVG, x: Number, y: Number, width: Number, height: Number) = instance.drawSVG(svg, x, y, width, height) -fun Long.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number, color: Int) = +fun Long.drawSVG(svg: SVG, x: Number, y: Number, width: Number, height: Number, color: Int) = RenderManager.drawSvg(this, svg, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color) -fun VG.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number, color: Int) = +fun VG.drawSVG(svg: SVG, x: Number, y: Number, width: Number, height: Number, color: Int) = instance.drawSVG(svg, x, y, width, height, color) |