diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-04-19 17:09:13 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-04-19 17:09:26 +0100 |
commit | 9986f445b89fc866265dade49b8356f87199a01e (patch) | |
tree | 43bd51d5a9519bd5943adacdfdee18871ca494f3 /src/main/java/io/polyfrost/oneconfig/lwjgl/image | |
parent | 1d20fe41ea7d25cc0322cb297760b18a60d665a7 (diff) | |
download | OneConfig-9986f445b89fc866265dade49b8356f87199a01e.tar.gz OneConfig-9986f445b89fc866265dade49b8356f87199a01e.tar.bz2 OneConfig-9986f445b89fc866265dade49b8356f87199a01e.zip |
i am so sad ive wasted an entire day and made literally no progress (plz try and fix)
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/image')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java index 4e07215..6fbd27f 100644 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java +++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java @@ -1,12 +1,19 @@ package io.polyfrost.oneconfig.lwjgl.image; import io.polyfrost.oneconfig.lwjgl.IOUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; import org.lwjgl.nanovg.NSVGImage; import org.lwjgl.nanovg.NanoSVG; import org.lwjgl.nanovg.NanoVG; import org.lwjgl.stb.STBImage; +import org.lwjgl.system.MemoryStack; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.StandardCharsets; import java.util.HashMap; public class ImageLoader { @@ -39,9 +46,14 @@ public class ImageLoader { public boolean loadSVGImage(String fileName) { if(!NSVGImageHashMap.containsKey(fileName)) { try { - NSVGImageHashMap.put(fileName, NanoSVG.nsvgParseFromFile(fileName, "px", 96f)); + CharSequence s = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream())).readLine(); + System.out.println(s); + NSVGImage image = NanoSVG.nsvgParse(s, "px", 96f); + NSVGImageHashMap.put(fileName, image); + System.out.println("Loaded SVG: " + fileName); } catch (Exception e) { // just in case System.err.println("Failed to parse SVG file"); + e.printStackTrace(); return false; } return true; |