From f06946c01b2c8f210b398a16610c260eca093a8b Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Thu, 21 Jul 2022 04:04:48 +0900 Subject: HUD Improvements, 1.16 port, fix NanoVG with ARM (#52) * egg 1 * separate Hud from background stuff * 1984 This reverts commit 9ae517d57bbd495d30d35cb1cbfe81a03556e6bd. * hitboxes woo!!!!! * Revert "hitboxes woo!!!!!" This reverts commit 405d32d17df3c83f2e79eddf0de853f7279767a6. * padding * allow position to go slightly off the screen * stop using ints for ABSOLUTELY EVERYTHING, DIAMOND ... fix vigilance compat not setting color * start on new pos system * some stuff * finish new position system * api momento * 1.16.2 fabric port * start on hud gui * temp remove 1.16.2 fabric since it doesn't compile * fix fabric build * hud gui stuff * apiDump * fix fabric build 2 * so true * selecting stuff * scaling + other small things * More protecting * fix nanovg not working with macOS ARM move OneConfig.preLaunch to OneConfigInit * clean up OneUIScreen make kotlin version of TestNanoVGGui * make keybinds have runnable by default * rollback keybind things * merge master into hud-improvements (#55) * Release workflow (#53) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Release workflow (#54) * release workflow * update normal version to hash * fix * fix naming * fix some stuff * fix version thing * switch to number from hash * Maybe epic fixo * gotta love those Java principles * Revert "gotta love those Java principles", wrong branch This reverts commit 333d8b2ad8941790c13c4bfe0777fbd203d463e5. * start on snapping * Finish snapping * stop including mixin by default on legacy versions this breaks builds if the mod itself does not use mixin * merge draw and drawExample * fix gradle publish * Some fixes * Api DUmpidy * Help subcommand impovments (#59) * Made the overall look of the "help" subcommand better + added the ability to change the colour for the command overall + each individual SubCommand * Made the alliases show batter + added support for to show subcommand aliasses * mr deliverer didnt reply but whatever, added a space between command/subcommand and alliasses Co-authored-by: pinkulu * fix file not overwriting toJavaColor * Fix full shadow not scaling correctly Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Co-authored-by: nxtdaydelivery <12willettsh@gmail.com> Co-authored-by: pinkulu <56201697+pinkulu@users.noreply.github.com> Co-authored-by: pinkulu --- .../oneconfig/platform/NanoVGPlatform.java | 42 ++++++++++++++++++++++ .../cc/polyfrost/oneconfig/platform/Platform.java | 13 +++++++ 2 files changed, 55 insertions(+) create mode 100644 src/main/java/cc/polyfrost/oneconfig/platform/NanoVGPlatform.java (limited to 'src/main/java/cc/polyfrost/oneconfig/platform') diff --git a/src/main/java/cc/polyfrost/oneconfig/platform/NanoVGPlatform.java b/src/main/java/cc/polyfrost/oneconfig/platform/NanoVGPlatform.java new file mode 100644 index 0000000..af269ce --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/platform/NanoVGPlatform.java @@ -0,0 +1,42 @@ +package cc.polyfrost.oneconfig.platform; + +import org.jetbrains.annotations.Nullable; +import org.lwjgl.nanovg.NVGLUFramebuffer; + +public interface NanoVGPlatform { + int NVG_ANTIALIAS = 1; + int NVG_STENCIL_STROKES = 2; + int NVG_DEBUG = 4; + int NVG_IMAGE_NODELETE = 65536; + + int nnvglCreateImageFromHandle(long var0, int var2, int var3, int var4, int var5); + + int nvglCreateImageFromHandle(long ctx, int textureId, int w, int h, int flags); + + int nnvglImageHandle(long var0, int var2); + + int nvglImageHandle(long ctx, int image); + + long nnvgCreate(int var0); + + long nvgCreate(int flags); + + void nnvgDelete(long var0); + + void nvgDelete(long ctx); + + long nnvgluCreateFramebuffer(long var0, int var2, int var3, int var4); + + @Nullable + NVGLUFramebuffer nvgluCreateFramebuffer(long ctx, int w, int h, int imageFlags); + + void nnvgluBindFramebuffer(long var0, long var2); + + void nvgluBindFramebuffer(long ctx, @Nullable NVGLUFramebuffer fb); + + void nnvgluDeleteFramebuffer(long var0, long var2); + + void nvgluDeleteFramebuffer(long ctx, NVGLUFramebuffer fb); + + void triggerStaticInitialization(); +} diff --git a/src/main/java/cc/polyfrost/oneconfig/platform/Platform.java b/src/main/java/cc/polyfrost/oneconfig/platform/Platform.java index 62e9e2a..0fc2626 100644 --- a/src/main/java/cc/polyfrost/oneconfig/platform/Platform.java +++ b/src/main/java/cc/polyfrost/oneconfig/platform/Platform.java @@ -37,10 +37,16 @@ public interface Platform { return PlatformHolder.INSTANCE.i18nPlatform; } + static NanoVGPlatform getNanoVGPlatform() { + return PlatformHolder.INSTANCE.nvgPlatform; + } + boolean isCallingFromMinecraftThread(); int getMinecraftVersion(); + Loader getLoader(); + class PlatformHolder { private PlatformHolder() { @@ -53,5 +59,12 @@ public interface Platform { GLPlatform glPlatform = ServiceLoader.load(GLPlatform.class, GLPlatform.class.getClassLoader()).iterator().next(); GuiPlatform guiPlatform = ServiceLoader.load(GuiPlatform.class, GuiPlatform.class.getClassLoader()).iterator().next(); I18nPlatform i18nPlatform = ServiceLoader.load(I18nPlatform.class, I18nPlatform.class.getClassLoader()).iterator().next(); + + NanoVGPlatform nvgPlatform = ServiceLoader.load(NanoVGPlatform.class, NanoVGPlatform.class.getClassLoader()).iterator().next(); + } + + enum Loader { + FORGE, + FABRIC } } -- cgit