Skip to content

Commit 0b4aa25

Browse files
committed
[API] Add API for Dear ImGui v1.78
1 parent 8c367ec commit 0b4aa25

File tree

13 files changed

+278
-168
lines changed

13 files changed

+278
-168
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ If you're using native libs directly, you'll need to provide a VM option: `imgui
225225
**You are ready to use imgui-java binding!**
226226

227227
## Using Multi-Viewports and Docking
228-
Binding based on the Dear ImGui [docking](https://github.com/ocornut/imgui/tree/docking) branch, commit: [90ea7e2f2f3c4096a58b8bd14c274d80ae63e1ce](https://github.com/ocornut/imgui/tree/90ea7e2f2f3c4096a58b8bd14c274d80ae63e1ce).
228+
Binding based on the Dear ImGui [docking](https://github.com/ocornut/imgui/tree/docking) branch, commit: [05bc204dbd80dfebb3dab1511caf1cb980620c76](https://github.com/ocornut/imgui/tree/05bc204dbd80dfebb3dab1511caf1cb980620c76).
229229
That branch contains two important features: [multi-viewports](https://github.com/ocornut/imgui/issues/1542) and [docking](https://github.com/ocornut/imgui/issues/2109).
230230
See an official documentation about how to work with them.
231231

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public boolean hasImDrawListFlags(final int flags) {
123123
// Primitives
124124
// - For rectangular primitives, "pMin" and "pMax" represent the upper-left and lower-right corners.
125125
// - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred).
126+
// In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12.
126127
// In future versions we will use textures to provide cheaper and higher-quality circles.
127128
// Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides.
128129

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

Lines changed: 167 additions & 153 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* </pre>
1717
* - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor).
1818
* - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element.
19-
* - (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.)
19+
* - (Step 2: empty step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.)
2020
* - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.
2121
* <p>
2222
* BINDING NOTICE:

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

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,20 @@ protected long create() {
466466
IMGUI_STYLE->GrabRounding = grabRounding;
467467
*/
468468

469+
/**
470+
* The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
471+
*/
472+
public native float getLogSliderDeadzone(); /*
473+
return IMGUI_STYLE->LogSliderDeadzone;
474+
*/
475+
476+
/**
477+
* The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero.
478+
*/
479+
public native void setLogSliderDeadzone(float logSliderDeadzone); /*
480+
IMGUI_STYLE->LogSliderDeadzone = logSliderDeadzone;
481+
*/
482+
469483
/**
470484
* Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
471485
*/
@@ -663,28 +677,48 @@ protected long create() {
663677
*/
664678

665679
/**
666-
* Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
680+
* Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
667681
*/
668682
public native boolean getAntiAliasedLines(); /*
669683
return IMGUI_STYLE->AntiAliasedLines;
670684
*/
671685

672686
/**
673-
* Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.
687+
* Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
674688
*/
675689
public native void setAntiAliasedLines(boolean antiAliasedLines); /*
676690
IMGUI_STYLE->AntiAliasedLines = antiAliasedLines;
677691
*/
678692

679693
/**
680-
* Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
694+
* Enable anti-aliased lines/borders using textures where possible.
695+
* Require back-end to render with bilinear filtering.
696+
* Latched at the beginning of the frame (copied to ImDrawList).
697+
*/
698+
public native boolean getAntiAliasedLinesUseTex(); /*
699+
return IMGUI_STYLE->AntiAliasedLinesUseTex;
700+
*/
701+
702+
/**
703+
* Enable anti-aliased lines/borders using textures where possible.
704+
* Require back-end to render with bilinear filtering.
705+
* Latched at the beginning of the frame (copied to ImDrawList).
706+
*/
707+
public native void setAntiAliasedLinesUseTex(boolean antiAliasedLinesUseTex); /*
708+
IMGUI_STYLE->AntiAliasedLinesUseTex = antiAliasedLinesUseTex;
709+
*/
710+
711+
/**
712+
* Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.).
713+
* Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
681714
*/
682715
public native boolean getAntiAliasedFill(); /*
683716
return IMGUI_STYLE->AntiAliasedFill;
684717
*/
685718

686719
/**
687-
* Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
720+
* Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.).
721+
* Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
688722
*/
689723
public native void setAntiAliasedFill(boolean antiAliasedFill); /*
690724
IMGUI_STYLE->AntiAliasedFill = antiAliasedFill;
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
package imgui.flag;
22

3+
/**
4+
* Flags for ImDrawList. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
5+
* It is however possible to temporarily alter flags between calls to ImDrawList:: functions.
6+
*/
37
public final class ImDrawListFlags {
48
private ImDrawListFlags() {
59
}
610

711
public static final int None = 0;
8-
912
/**
10-
* Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles)
13+
* Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)
1114
*/
1215
public static final int AntiAliasedLines = 1;
1316
/**
14-
* Filled shapes have anti-aliased edges (*2 the number of vertices)
17+
* Enable anti-aliased lines/borders using textures when possible. Require back-end to render with bilinear filtering.
18+
*/
19+
public static final int AntiAliasedLinesUseTex = 1 << 1;
20+
/**
21+
* Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
1522
*/
16-
public static final int AntiAliasedFill = 1 << 1;
23+
public static final int AntiAliasedFill = 1 << 2;
1724
/**
18-
* Can emit 'VtxOffset {@code >} 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
25+
* Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
1926
*/
20-
public static final int AllowVtxOffset = 1 << 2;
27+
public static final int AllowVtxOffset = 1 << 3;
2128
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package imgui.flag;
22

3+
/**
4+
* Flags for ImFontAtlas build
5+
*/
36
public final class ImFontAtlasFlags {
47
private ImFontAtlasFlags() {
58
}
@@ -13,4 +16,9 @@ private ImFontAtlasFlags() {
1316
* Don't build software mouse cursors into the atlas
1417
*/
1518
public static final int NoMouseCursors = 1 << 1;
19+
/**
20+
* Don't build thick line textures into the atlas (save a little texture memory).
21+
* The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
22+
*/
23+
public static final int NoBakedLines = 1 << 2;
1624
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package imgui.flag;
2+
3+
public final class ImGuiButtonFlags {
4+
private ImGuiButtonFlags() {
5+
}
6+
7+
public static final int None = 0;
8+
/**
9+
* React on left mouse button (default).
10+
*/
11+
public static final int MouseButtonLeft = 0;
12+
/**
13+
* React on right mouse button.
14+
*/
15+
public static final int MouseButtonRight = 1 << 1;
16+
/**
17+
* React on center mouse button.
18+
*/
19+
public static final int MouseButtonMiddle = 1 << 2;
20+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags.
77
* It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags.
88
* - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0.
9+
* - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later).
910
*/
1011
public final class ImGuiPopupFlags {
1112
private ImGuiPopupFlags() {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package imgui.flag;
2+
3+
public final class ImGuiSliderFlags {
4+
private ImGuiSliderFlags() {
5+
}
6+
7+
public static final int None = 0;
8+
/**
9+
* Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
10+
*/
11+
public static final int ClampOnInput = 1 << 4;
12+
/**
13+
* Make the widget logarithmic (linear otherwise).
14+
* Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
15+
*/
16+
public static final int Logarithmic = 1 << 5;
17+
/**
18+
* Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits).
19+
*/
20+
public static final int NoRoundToFormat = 1 << 6;
21+
/**
22+
* Disable CTRL+Click or Enter key allowing to input text directly into the widget
23+
*/
24+
public static final int NoInput = 1 << 7;
25+
}

0 commit comments

Comments
 (0)