From 045ca00486e62c89a4da5f880f6f52016e4dd14a Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Mon, 25 Jul 2022 22:01:01 +0900 Subject: fix: stop using internal asset classes everywhere (#69) * fix: stop using internal asset classes everywhere new: add wrapper classes for NanoVG rendering and rename original Image wrapper to OneImage * I love regex Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> --- src/main/java/cc/polyfrost/oneconfig/renderer/Image.java | 14 ++++++++++++++ .../cc/polyfrost/oneconfig/renderer/RenderManager.java | 13 ++++++------- src/main/java/cc/polyfrost/oneconfig/renderer/SVG.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 src/main/java/cc/polyfrost/oneconfig/renderer/Image.java create mode 100644 src/main/java/cc/polyfrost/oneconfig/renderer/SVG.java (limited to 'src/main/java/cc/polyfrost/oneconfig/renderer') 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; + } +} -- cgit