Add new icon and methods for key presses and character input
This commit is contained in:
parent
70fdddf399
commit
e219bd4644
7 changed files with 50 additions and 6 deletions
14
README.md
14
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:<VERSION>"
|
||||
```
|
||||
|
||||
You can then add `Renderables` to `ImGuiQuilt.renderstack` for them to be rendered.
|
||||
|
||||
Use ImGui methods in `render()` of the `Renderables` interface.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 18 KiB |
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue