diff options
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/image')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java | 37 | ||||
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java | 43 |
2 files changed, 43 insertions, 37 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 37466b2..1ccafaf 100644 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java +++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java @@ -1,22 +1,14 @@ 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 java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; import java.nio.ByteBuffer; import java.util.HashMap; public class ImageLoader { private final HashMap<String, Image> imageHashMap = new HashMap<>(); - private final HashMap<String, NSVGImage> NSVGImageHashMap = new HashMap<>(); public static ImageLoader INSTANCE = new ImageLoader(); public boolean loadImage(long vg, String fileName) { @@ -41,32 +33,6 @@ public class ImageLoader { return true; } - public boolean loadSVGImage(String fileName) { - if (!NSVGImageHashMap.containsKey(fileName)) { - try { - InputStream inputStream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream(); - StringBuilder resultStringBuilder = new StringBuilder(); - try (BufferedReader br - = new BufferedReader(new InputStreamReader(inputStream))) { - String line; - while ((line = br.readLine()) != null) { - resultStringBuilder.append(line); - } - } - CharSequence s = resultStringBuilder.toString(); - 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; - } - return true; - } public void removeImage(String fileName) { imageHashMap.remove(fileName); @@ -76,7 +42,4 @@ public class ImageLoader { return imageHashMap.get(fileName); } - public NSVGImage getSVG(String fileName) { - return NSVGImageHashMap.get(fileName); - } } diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java new file mode 100644 index 0000000..e09cec3 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/Images.java @@ -0,0 +1,43 @@ +package io.polyfrost.oneconfig.lwjgl.image; + +public enum Images { + CHEVRON_ARROW("/assets/oneconfig/textures/gui/general/arrows/chevron.png"), + DROPDOWN_ARROW("/assets/oneconfig/textures/gui/general/arrows/dropdown_arrow.png"), + UP_ARROW("/assets/oneconfig/textures/gui/general/arrows/up_arrow.png"), + + CHECKMARK("/assets/oneconfig/textures/gui/general/configs/checkmark.png"), + FAVORITE("/assets/oneconfig/textures/gui/general/configs/favorite_active.png"), + FAVORITE_OFF("/assets/oneconfig/textures/gui/general/configs/favorite_inactive.png"), + HIDE_EYE("/assets/oneconfig/textures/gui/general/configs/hide_eye.png"), + + // TODO color picker ones + + SHARE("/assets/oneconfig/textures/gui/general/nav/share.png"), + LAUNCH("/assets/oneconfig/textures/gui/general/nav/launch.png"), + SEARCH("/assets/oneconfig/textures/gui/general/nav/search.png"), + MINIMIZE("/assets/oneconfig/textures/gui/general/nav/minimize.png"), + CLOSE("/assets/oneconfig/textures/gui/general/nav/close.png"), + + LOGO("/assets/oneconfig/textures/gui/general/logo.png"), + + HUD("/assets/oneconfig/textures/gui/icons/hud/hud.png"), + HUD_SETTINGS("/assets/oneconfig/textures/gui/icons/hud/settings.png"), + + MOD_BOX("/assets/oneconfig/textures/gui/icons/mod/mod_box.png"), + MODS("/assets/oneconfig/textures/gui/icons/mod/mods.png"), + PERFORMANCE("/assets/oneconfig/textures/gui/icons/mod/performance.png"), + + DASHBOARD("/assets/oneconfig/textures/gui/icons/dashboard.png"), + PREFERENCES("/assets/oneconfig/textures/gui/icons/preferences.png"), + PROFILES("/assets/oneconfig/textures/gui/icons/profiles.png"), + SCREENSHOT("/assets/oneconfig/textures/gui/icons/screenshot.png"), + THEMES("/assets/oneconfig/textures/gui/icons/themes.png"), + UPDATES("/assets/oneconfig/textures/gui/icons/updates.png"), + ; + + public final String filePath; + + Images(String filePath) { + this.filePath = filePath; + } +} |