diff --git a/README.md b/README.md index cd4dd30..47e3ce8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,19 @@ Quilt interface for [imgui-java](https://github.com/SpaiR/imgui-java), an updated version of [imgui-mc](https://github.com/mjwells2002/imgui-mc). ## Quick Usage -Add `Renderables` to `ImGuiQuilt.renderstack` for them to be rendered. +Add the Maven repository and the modImplementation to your `build.gradle` + +``` +maven { + url "https://maven.eviee.gay/imgui-quilt" +} +``` + +``` +implementation "gay.eviee:imgui-quilt:" +``` + +You can then add `Renderables` to `ImGuiQuilt.renderstack` for them to be rendered. Use ImGui methods in `render()` of the `Renderables` interface. diff --git a/gradle.properties b/gradle.properties index 8f4fcc2..899b741 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx1G org.gradle.parallel = true # Mod Properties -version = 1.0.0+1.19 +version = 1.0.2+1.19 maven_group = gay.eviee archives_base_name = imguiquilt diff --git a/src/main/java/gay/eviee/imguiquilt/ImGuiQuilt.java b/src/main/java/gay/eviee/imguiquilt/ImGuiQuilt.java index 7347a8b..3662fc6 100644 --- a/src/main/java/gay/eviee/imguiquilt/ImGuiQuilt.java +++ b/src/main/java/gay/eviee/imguiquilt/ImGuiQuilt.java @@ -22,6 +22,11 @@ public class ImGuiQuilt implements ClientModInitializer { } + /** + * Add a Renderable to the render stack + * @param renderable Object to add to the stack + * @return + */ public static Renderable pushRenderable(Renderable renderable) { renderstack.add(renderable); return renderable; diff --git a/src/main/java/gay/eviee/imguiquilt/imgui/ImguiLoader.java b/src/main/java/gay/eviee/imguiquilt/imgui/ImguiLoader.java index 1171e93..913c2d8 100644 --- a/src/main/java/gay/eviee/imguiquilt/imgui/ImguiLoader.java +++ b/src/main/java/gay/eviee/imguiquilt/imgui/ImguiLoader.java @@ -52,6 +52,35 @@ public class ImguiLoader { endFrame(windowHandle); } + public static boolean charTyped(char chr, int keyCode) { + final ImGuiIO io = ImGui.getIO(); + + if (io.getWantTextInput()) { + io.addInputCharacter(chr); + } + return true; + } + public static boolean keyPressed(int keyCode, int scanCode, int modifiers) { + final ImGuiIO io = ImGui.getIO(); + + if (io.getWantCaptureKeyboard()) { + if (io.getKeysDown(keyCode)) { + io.setKeysDown(new boolean[]{ true }); + } + } + return true; + } + public static boolean keyReleased(int keyCode, int scanCode, int modifiers) { + final ImGuiIO io = ImGui.getIO(); + + if (io.getWantCaptureKeyboard()) { + if (io.getKeysDown(keyCode)) { + io.setKeysDown(new boolean[] { false }); + } + } + return true; + } + private static void initializeImGui(long glHandle) { ImGui.createContext(); diff --git a/src/main/java/gay/eviee/imguiquilt/mixin/GLFWInitMixin.java b/src/main/java/gay/eviee/imguiquilt/mixin/GLFWInitMixin.java index 39a0874..fe8f40d 100644 --- a/src/main/java/gay/eviee/imguiquilt/mixin/GLFWInitMixin.java +++ b/src/main/java/gay/eviee/imguiquilt/mixin/GLFWInitMixin.java @@ -4,11 +4,7 @@ import com.mojang.blaze3d.glfw.Window; import com.mojang.blaze3d.glfw.WindowEventHandler; import com.mojang.blaze3d.glfw.WindowSettings; import com.mojang.blaze3d.glfw.monitor.MonitorTracker; -import gay.eviee.imguiquilt.ImGuiQuilt; import gay.eviee.imguiquilt.imgui.ImguiLoader; -import gay.eviee.imguiquilt.interfaces.Renderable; -import gay.eviee.imguiquilt.interfaces.Theme; -import imgui.ImGui; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; diff --git a/src/main/resources/assets/imguiquilt/icon.png b/src/main/resources/assets/imguiquilt/icon.png index da48188..7e6ff90 100644 Binary files a/src/main/resources/assets/imguiquilt/icon.png and b/src/main/resources/assets/imguiquilt/icon.png differ diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json index c6e79ec..62989ee 100644 --- a/src/main/resources/quilt.mod.json +++ b/src/main/resources/quilt.mod.json @@ -12,6 +12,8 @@ "Evie Viau": "Author" }, "contact": { + "homepage": "https://sr.ht/~eviee/imgui-quilt/", + "issues": "https://todo.sr.ht/~eviee/imgui-quilt", "sources": "https://git.sr.ht/~eviee/imgui-quilt" }, "icon": "assets/imguiquilt/icon.png"