Skip to content

Commit b4df8d8

Browse files
committed
[API] Dear ImGui v1.83
1 parent e5a30ab commit b4df8d8

File tree

6 files changed

+36
-33
lines changed

6 files changed

+36
-33
lines changed

example/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ repositories {
88

99
application {
1010
mainClass = 'Main'
11-
if (libPath) {
12-
applicationDefaultJvmArgs = ["-Dimgui.library.path=$libPath"]
11+
try {
12+
if (libPath) {
13+
applicationDefaultJvmArgs = ["-Dimgui.library.path=$libPath"]
14+
}
15+
} catch (ignored) {
16+
// ignore
1317
}
1418
}
1519

imgui-binding/src/main/java/imgui/ImDrawData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public ImVec4 getCmdListCmdBufferClipRect(final int cmdListIdx, final int cmdBuf
7171
* Ignore if never using images or multiple fonts atlas.
7272
*/
7373
public native int getCmdListCmdBufferTextureId(int cmdListIdx, int cmdBufferIdx); /*
74-
return (intptr_t)IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].TextureId;
74+
return (intptr_t)IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
7575
*/
7676

7777
/**

imgui-binding/src/main/java/imgui/ImGui.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4718,24 +4718,24 @@ public static boolean beginTabItem(String label, ImBoolean pOpen, int imGuiTabIt
47184718
// - Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details.
47194719
// - DockSpace() needs to be submitted _before_ any window they can host. If you use a dockspace, submit it early in your app.
47204720

4721-
public static void dockSpace(int imGuiID) {
4722-
nDockSpace(imGuiID, 0, 0, 0, 0);
4721+
public static int dockSpace(int imGuiID) {
4722+
return nDockSpace(imGuiID, 0, 0, 0, 0);
47234723
}
47244724

4725-
public static void dockSpace(int imGuiID, float sizeX, float sizeY) {
4726-
nDockSpace(imGuiID, sizeX, sizeY, 0, 0);
4725+
public static int dockSpace(int imGuiID, float sizeX, float sizeY) {
4726+
return nDockSpace(imGuiID, sizeX, sizeY, 0, 0);
47274727
}
47284728

4729-
public static void dockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags) {
4730-
nDockSpace(imGuiID, sizeX, sizeY, imGuiDockNodeFlags, 0);
4729+
public static int dockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags) {
4730+
return nDockSpace(imGuiID, sizeX, sizeY, imGuiDockNodeFlags, 0);
47314731
}
47324732

4733-
public static void dockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags, ImGuiWindowClass imGuiWindowClass) {
4734-
nDockSpace(imGuiID, sizeX, sizeY, imGuiDockNodeFlags, imGuiWindowClass.ptr);
4733+
public static int dockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags, ImGuiWindowClass imGuiWindowClass) {
4734+
return nDockSpace(imGuiID, sizeX, sizeY, imGuiDockNodeFlags, imGuiWindowClass.ptr);
47354735
}
47364736

4737-
private static native void nDockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags, long windowClassPtr); /*
4738-
ImGui::DockSpace(imGuiID, ImVec2(sizeX, sizeY), imGuiDockNodeFlags, windowClassPtr != 0 ? (ImGuiWindowClass*)windowClassPtr : NULL);
4737+
private static native int nDockSpace(int imGuiID, float sizeX, float sizeY, int imGuiDockNodeFlags, long windowClassPtr); /*
4738+
return ImGui::DockSpace(imGuiID, ImVec2(sizeX, sizeY), imGuiDockNodeFlags, windowClassPtr != 0 ? (ImGuiWindowClass*)windowClassPtr : NULL);
47394739
*/
47404740

47414741
public static int dockSpaceOverViewport() {

imgui-binding/src/main/java/imgui/ImGuiIO.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -593,20 +593,6 @@ public ImVec2 getDisplayFramebufferScale() {
593593
IO->ConfigDockingNoSplit = value;
594594
*/
595595

596-
/**
597-
* Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space)
598-
*/
599-
public native boolean getConfigDockingWithShift(); /*
600-
return IO->ConfigDockingWithShift;
601-
*/
602-
603-
/**
604-
* Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space)
605-
*/
606-
public native void setConfigDockingWithShift(boolean value); /*
607-
IO->ConfigDockingWithShift = value;
608-
*/
609-
610596
/**
611597
* [BETA] [FIXME: This currently creates regression with auto-sizing and general overhead]
612598
* Make every single floating window display within a docking node.

imgui-lwjgl3/src/main/java/imgui/glfw/ImGuiImplGlfw.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class ImGuiImplGlfw {
6868

6969
// Mouse cursors provided by GLFW
7070
private final long[] mouseCursors = new long[ImGuiMouseCursor.COUNT];
71+
private final long[] keyOwnerWindows = new long[512];
7172

7273
// Empty array to fill ImGuiIO.NavInputs with zeroes
7374
private final float[] emptyNavInputs = new float[ImGuiNavInput.COUNT];
@@ -139,10 +140,14 @@ public void keyCallback(final long windowId, final int key, final int scancode,
139140

140141
final ImGuiIO io = ImGui.getIO();
141142

142-
if (action == GLFW_PRESS) {
143-
io.setKeysDown(key, true);
144-
} else if (action == GLFW_RELEASE) {
145-
io.setKeysDown(key, false);
143+
if (key >= 0 && key < keyOwnerWindows.length) {
144+
if (action == GLFW_PRESS) {
145+
io.setKeysDown(key, true);
146+
keyOwnerWindows[key] = windowId;
147+
} else if (action == GLFW_RELEASE) {
148+
io.setKeysDown(key, false);
149+
keyOwnerWindows[key] = 0;
150+
}
146151
}
147152

148153
io.setKeyCtrl(io.getKeysDown(GLFW_KEY_LEFT_CONTROL) || io.getKeysDown(GLFW_KEY_RIGHT_CONTROL));
@@ -603,12 +608,20 @@ public void accept(final ImGuiViewport vp) {
603608
}
604609
}
605610

606-
private static final class DestroyWindowFunction extends ImPlatformFuncViewport {
611+
private final class DestroyWindowFunction extends ImPlatformFuncViewport {
607612
@Override
608613
public void accept(final ImGuiViewport vp) {
609614
final ImGuiViewportDataGlfw data = (ImGuiViewportDataGlfw) vp.getPlatformUserData();
610615

611616
if (data != null && data.windowOwned) {
617+
// Release any keys that were pressed in the window being destroyed and are still held down,
618+
// because we will not receive any release events after window is destroyed.
619+
for (int i = 0; i < keyOwnerWindows.length; i++) {
620+
if (keyOwnerWindows[i] == data.window) {
621+
keyCallback(data.window, i, 0, GLFW_RELEASE, 0); // Later params are only used for main viewport, on which this function is never called.
622+
}
623+
}
624+
612625
glfwDestroyWindow(data.window);
613626
}
614627

include/imgui

Submodule imgui updated 57 files

0 commit comments

Comments
 (0)