diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-05 17:43:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 17:43:23 +0200 |
commit | ab7256dff5d6d37488081ba7a01b36d3ee9ef563 (patch) | |
tree | 8207341e6c402848cdbe7b2f2297f5f975e0e083 /src/main/java/cc/polyfrost/oneconfig/lwjgl/font | |
parent | a903cfc4d3f76cf3db24749b65156d126fa714e7 (diff) | |
download | OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.gz OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.bz2 OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.zip |
refactor (#36)
* refactor
* fix vig compat
* fix nanovg thingy
* e
* finalize
* gui utils package thingy
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl/font')
3 files changed, 0 insertions, 87 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Font.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Font.java deleted file mode 100644 index 8267ba7..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Font.java +++ /dev/null @@ -1,41 +0,0 @@ -package cc.polyfrost.oneconfig.lwjgl.font; - -import java.nio.ByteBuffer; - -public class Font { - private final String fileName; - private final String name; - private boolean loaded = false; - private ByteBuffer buffer = null; - - public Font(String name, String fileName) { - this.name = name; - this.fileName = fileName; - } - - public String getName() { - return name; - } - - public String getFileName() { - return fileName; - } - - public boolean isLoaded() { - return loaded; - } - - void setLoaded(boolean loaded) { - this.loaded = loaded; - } - - public ByteBuffer getBuffer() { - return buffer; - } - - void setBuffer(ByteBuffer buffer) { - this.buffer = buffer; - } - -} - diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/FontManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/FontManager.java deleted file mode 100644 index 534795b..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/FontManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package cc.polyfrost.oneconfig.lwjgl.font; - -import cc.polyfrost.oneconfig.utils.IOUtils; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import static org.lwjgl.nanovg.NanoVG.nvgCreateFontMem; - -public class FontManager { - public static FontManager INSTANCE = new FontManager(); - - public void initialize(long vg) { - for (Fonts fonts : Fonts.values()) { - Font font = fonts.font; - int loaded = -1; - try { - ByteBuffer buffer = IOUtils.resourceToByteBuffer(font.getFileName()); - loaded = nvgCreateFontMem(vg, font.getName(), buffer, 0); - font.setBuffer(buffer); - } catch (IOException e) { - e.printStackTrace(); - } - if (loaded == -1) { - throw new RuntimeException("Failed to initialize font " + font.getName()); - } else { - font.setLoaded(true); - } - } - } -} diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java deleted file mode 100644 index 74d7828..0000000 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java +++ /dev/null @@ -1,15 +0,0 @@ -package cc.polyfrost.oneconfig.lwjgl.font; - -public enum Fonts { - BOLD(new Font("inter-bold", "/assets/oneconfig/font/Bold.otf")), - SEMIBOLD(new Font("inter-semibold", "/assets/oneconfig/font/SemiBold.otf")), - MEDIUM(new Font("inter-medium", "/assets/oneconfig/font/Medium.otf")), - REGULAR(new Font("inter-regular", "/assets/oneconfig/font/Regular.otf")), - MINECRAFT_REGULAR(new Font("mc-regular", "/assets/oneconfig/font/Minecraft-Regular.otf")), - MINECRAFT_BOLD(new Font("mc-bold", "/assets/oneconfig/font/Minecraft-Bold.otf")); - public final Font font; - - Fonts(Font font) { - this.font = font; - } -} |