Skip to content

Commit 6c008e6

Browse files
committed
Update binding to Dear ImGui v1.77
1 parent 0fa727b commit 6c008e6

File tree

8 files changed

+272
-109
lines changed

8 files changed

+272
-109
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public void addText(final ImFont imFont, final float fontSize, final float posX,
377377
// Advanced: Channels
378378
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives)
379379
// - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end)
380-
// Prefer using your own persistent copy of ImDrawListSplitter as you can stack them.
380+
// Prefer using your own persistent instance of ImDrawListSplitter as you can stack them.
381381
// Using the ImDrawList::ChannelsXXXX you cannot stack a split over another.
382382

383383
public native void channelsSplit(int count); /*

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,18 +473,13 @@ private ByteBuffer createRgba32Pixels(final int size) {
473473
// After calling Build(), you can query the rectangle position and render your pixels.
474474
// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point),
475475
// so you can render e.g. custom colorful icons and use them as regular glyphs.
476-
// Read docs/FONTS.txt for more details about using colorful icons.
476+
// Read docs/FONTS.md for more details about using colorful icons.
477+
// Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.
477478

478-
/**
479-
* Id needs to be {@code >=} 0x110000. Id {@code >=} 0x80000000 are reserved for ImGui and ImDrawList
480-
*/
481-
public native int addCustomRectRegular(int id, int width, int height); /*
482-
return IM_FONT_ATLAS->AddCustomRectRegular((unsigned int)id, width, height);
479+
public native int addCustomRectRegular(int width, int height); /*
480+
return IM_FONT_ATLAS->AddCustomRectRegular(width, height);
483481
*/
484482

485-
/**
486-
* Id needs to be {@code <} 0x110000 to register a rectangle to map into a specific font.
487-
*/
488483
public int addCustomRectFontGlyph(final ImFont imFont, final short id, final int width, final int height, final float advanceX) {
489484
return nAddCustomRectFontGlyph(imFont.ptr, id, width, height, advanceX);
490485
}

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

Lines changed: 187 additions & 91 deletions
Large diffs are not rendered by default.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,22 +546,22 @@ void setClipboardTextStub(void* userData, const char* text) {
546546
*/
547547

548548
/**
549-
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
549+
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
550550
*/
551551
public native void getMousePos(ImVec2 dstImVec2); /*
552552
Jni::ImVec2Cpy(env, &ImGui::GetIO().MousePos, dstImVec2);
553553
*/
554554

555555
/**
556-
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
556+
* Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
557557
*/
558558
public native void setMousePos(float x, float y); /*
559559
ImGui::GetIO().MousePos.x = x;
560560
ImGui::GetIO().MousePos.y = y;
561561
*/
562562

563563
/**
564-
* Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
564+
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
565565
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
566566
*/
567567
public native void getMouseDown(boolean[] buff); /*
@@ -570,23 +570,23 @@ void setClipboardTextStub(void* userData, const char* text) {
570570
*/
571571

572572
/**
573-
* Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
573+
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
574574
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
575575
*/
576576
public native boolean getMouseDown(int idx); /*
577577
return ImGui::GetIO().MouseDown[idx];
578578
*/
579579

580580
/**
581-
* Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
581+
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
582582
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
583583
*/
584584
public native void setMouseDown(int idx, boolean down); /*
585585
ImGui::GetIO().MouseDown[idx] = down;
586586
*/
587587

588588
/**
589-
* Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
589+
* Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons.
590590
* Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
591591
*/
592592
public native void setMouseDown(boolean[] mouseDown); /*

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ public void destroy() {
8181

8282
/**
8383
* Radius of window corners rounding. Set to 0.0f to have rectangular windows.
84+
* Large values tend to lead to variety of artifacts and are not recommended.
8485
*/
8586
public native float getWindowRounding(); /*
8687
return IMGUI_STYLE->WindowRounding;
8788
*/
8889

8990
/**
9091
* Radius of window corners rounding. Set to 0.0f to have rectangular windows.
92+
* Large values tend to lead to variety of artifacts and are not recommended.
9193
*/
9294
public native void setWindowRounding(float windowRounding); /*
9395
IMGUI_STYLE->WindowRounding = windowRounding;
@@ -409,6 +411,22 @@ public void destroy() {
409411
IMGUI_STYLE->TabBorderSize = tabBorderSize;
410412
*/
411413

414+
/**
415+
* Minimum width for close button to appears on an unselected tab when hovered.
416+
* Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
417+
*/
418+
public native float getTabMinWidthForUnselectedCloseButton(); /*
419+
return IMGUI_STYLE->TabMinWidthForUnselectedCloseButton;
420+
*/
421+
422+
/**
423+
* Minimum width for close button to appears on an unselected tab when hovered.
424+
* Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected.
425+
*/
426+
public native void setTabMinWidthForUnselectedCloseButton(float tabMinWidthForUnselectedCloseButton); /*
427+
IMGUI_STYLE->TabMinWidthForUnselectedCloseButton = tabMinWidthForUnselectedCloseButton;
428+
*/
429+
412430
/**
413431
* Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
414432
*/

imgui-binding/src/main/java/imgui/flag/ImGuiCond.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ private ImGuiCond() {
1010
}
1111

1212
/**
13-
* Set the variable
13+
* No condition (always set the variable), same as Always.
14+
*/
15+
public static final int None = 0;
16+
/**
17+
* No condition (always set the variable)
1418
*/
1519
public static final int Always = 1;
1620
/**
17-
* Set the variable once per runtime session (only the first call with succeed)
21+
* Set the variable once per runtime session (only the first call will succeed)
1822
*/
1923
public static final int Once = 1 << 1;
2024
/**
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package imgui.flag;
2+
3+
/**
4+
* Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions.
5+
* - To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat
6+
* small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags.
7+
* It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.
8+
* - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.
9+
*/
10+
public final class ImGuiPopupFlags {
11+
private ImGuiPopupFlags() {
12+
}
13+
14+
public static final int None = 0;
15+
/**
16+
* For BeginPopupContext*(): open on Left Mouse release. Guaranted to always be == 0 (same as ImGuiMouseButton_Left)
17+
*/
18+
public static final int MouseButtonLeft = 0;
19+
/**
20+
* For BeginPopupContext*(): open on Right Mouse release. Guaranted to always be == 1 (same as ImGuiMouseButton_Right)
21+
*/
22+
public static final int MouseButtonRight = 1;
23+
/**
24+
* For BeginPopupContext*(): open on Middle Mouse release. Guaranted to always be == 2 (same as ImGuiMouseButton_Middle)
25+
*/
26+
public static final int MouseButtonMiddle = 2;
27+
public static final int MouseButtonMask = 0x1F;
28+
public static final int MouseButtonDefault = 1;
29+
/**
30+
* For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack
31+
*/
32+
public static final int NoOpenOverExistingPopup = 1 << 5;
33+
/**
34+
* For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space
35+
*/
36+
public static final int NoOpenOverItems = 1 << 6;
37+
/**
38+
* For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup.
39+
*/
40+
public static final int AnyPopupId = 1 << 7;
41+
/**
42+
* For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level)
43+
*/
44+
public static final int AnyPopupLevel = 1 << 8;
45+
public static final int AnyPopup = AnyPopupId | AnyPopupLevel;
46+
}

imgui-binding/src/main/java/imgui/flag/ImGuiTabItemFlags.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ private ImGuiTabItemFlags() {
2626
* Don't call PushID(tab.ID)/PopID() on BeginTabItem()/EndTabItem()
2727
*/
2828
public static final int NoPushId = 1 << 3;
29+
/**
30+
* Disable tooltip for the given tab
31+
*/
32+
public static final int NoTooltip = 1 << 4;
2933
}

0 commit comments

Comments
 (0)