diff --git a/imgui-binding/src/main/java/imgui/ImGuiIO.java b/imgui-binding/src/main/java/imgui/ImGuiIO.java index d42c418..420f88f 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiIO.java +++ b/imgui-binding/src/main/java/imgui/ImGuiIO.java @@ -708,6 +708,36 @@ public final class ImGuiIO { ImGui::GetIO().KeysDown[i] = keysDown[i]; */ + /** + * Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). + */ + public native void getNavInputs(float[] buff); /* + for (int i = 0; i < ImGuiNavInput_COUNT; i++) + buff[i] = ImGui::GetIO().NavInputs[i]; + */ + + /** + * Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). + */ + public native float getNavInputs(int idx); /* + return ImGui::GetIO().NavInputs[idx]; + */ + + /** + * Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). + */ + public native void setNavInputs(int idx, float input); /* + ImGui::GetIO().NavInputs[idx] = input; + */ + + /** + * Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). + */ + public native void setNavInputs(float[] navInputs); /* + for (int i = 0; i < ImGuiNavInput_COUNT; i++) + ImGui::GetIO().NavInputs[i] = navInputs[i]; + */ + //------------------------------------------------------------------ // Output - Updated by NewFrame() or EndFrame()/Render() // (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is diff --git a/imgui-binding/src/main/java/imgui/flag/ImGuiNavInput.java b/imgui-binding/src/main/java/imgui/flag/ImGuiNavInput.java index a3fb666..61b604f 100644 --- a/imgui-binding/src/main/java/imgui/flag/ImGuiNavInput.java +++ b/imgui-binding/src/main/java/imgui/flag/ImGuiNavInput.java @@ -69,4 +69,30 @@ public final class ImGuiNavInput { * e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) */ public static final int TweakFast = 15; + + // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them. + // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[]. + + /** + * Toggle menu. + */ + public static final int KeyMenu = 16; + /** + * Move left. + */ + public static final int KeyLeft = 17; + /** + * Move right. + */ + public static final int KeyRight = 18; + /** + * Move up. + */ + public static final int KeyUp = 19; + /** + * Move down. + */ + public static final int KeyDown = 20; + + public static final int COUNT = 21; }