diff --git a/imgui-binding/src/main/java/imgui/ImDouble.java b/imgui-binding/src/main/java/imgui/ImDouble.java index 8c40d7f..562e2a3 100644 --- a/imgui-binding/src/main/java/imgui/ImDouble.java +++ b/imgui-binding/src/main/java/imgui/ImDouble.java @@ -1,27 +1,40 @@ package imgui; -public final class ImDouble { - public static ImDouble TMP = new ImDouble(); +import java.util.Objects; +public final class ImDouble { double[] data = new double[]{0.0d}; public ImDouble() { } public ImDouble(double value) { - setValue(value); + set(value); } - public double getValue() { + public double get() { return this.data[0]; } - public void setValue(double value) { + public void set(double value) { this.data[0] = value; } @Override public String toString() { - return String.valueOf(getValue()); + return String.valueOf(get()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImDouble imDouble = (ImDouble) o; + return data[0] == imDouble.data[0]; + } + + @Override + public int hashCode() { + return Objects.hash(data[0]); } } diff --git a/imgui-binding/src/main/java/imgui/ImFloat.java b/imgui-binding/src/main/java/imgui/ImFloat.java index e347b56..5e46273 100644 --- a/imgui-binding/src/main/java/imgui/ImFloat.java +++ b/imgui-binding/src/main/java/imgui/ImFloat.java @@ -1,27 +1,40 @@ package imgui; -public final class ImFloat { - public static ImFloat TMP = new ImFloat(); +import java.util.Objects; +public final class ImFloat { float[] data = new float[]{0.0f}; public ImFloat() { } public ImFloat(float value) { - setValue(value); + set(value); } - public float getValue() { + public float get() { return this.data[0]; } - public void setValue(float value) { + public void set(float value) { this.data[0] = value; } @Override public String toString() { - return String.valueOf(getValue()); + return String.valueOf(get()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImFloat imFloat = (ImFloat) o; + return data[0] == imFloat.data[0]; + } + + @Override + public int hashCode() { + return Objects.hash(data[0]); } } diff --git a/imgui-binding/src/main/java/imgui/ImGui.java b/imgui-binding/src/main/java/imgui/ImGui.java index 99306e5..3cb58d5 100644 --- a/imgui-binding/src/main/java/imgui/ImGui.java +++ b/imgui-binding/src/main/java/imgui/ImGui.java @@ -2424,8 +2424,8 @@ public final class ImGui { return nInputText(label, text.data, text.data.length, 0, text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); } - public static boolean InputText(String label, ImString text, ImGuiInputTextFlags flags) { - return nInputText(label, text.data, text.data.length, flags.getValue(), text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); + public static boolean InputText(String label, ImString text, int imGuiInputTextFlags) { + return nInputText(label, text.data, text.data.length, imGuiInputTextFlags, text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); } private static native boolean nInputText(String label, byte[] buff, int maxSize, int flags, ImGuiInputTextData textInputData, int maxChar, String allowedChar, int allowedCharLength); /* @@ -2470,8 +2470,8 @@ public final class ImGui { return nInputTextMultiline(label, text.data, text.data.length, width, height, 0, text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); } - public static boolean InputTextMultiline(String label, ImString text, float width, float height, ImGuiInputTextFlags flags) { - return nInputTextMultiline(label, text.data, text.data.length, width, height, flags.getValue(), text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); + public static boolean InputTextMultiline(String label, ImString text, float width, float height, int imGuiInputTextFlags) { + return nInputTextMultiline(label, text.data, text.data.length, width, height, imGuiInputTextFlags, text.inputData, text.inputData.maxChar, text.inputData.allowedChar, text.inputData.allowedChar.length()); } private static native boolean nInputTextMultiline(String label, byte[] buff, int maxSize, float width, float height, int flags, ImGuiInputTextData textInputData, int maxChar, String allowedChar, int allowedCharLength); /* diff --git a/imgui-binding/src/main/java/imgui/ImGuiInputTextData.java b/imgui-binding/src/main/java/imgui/ImGuiInputTextData.java index f573b5a..3457de6 100644 --- a/imgui-binding/src/main/java/imgui/ImGuiInputTextData.java +++ b/imgui-binding/src/main/java/imgui/ImGuiInputTextData.java @@ -1,6 +1,6 @@ package imgui; -public final class ImGuiInputTextData { +final class ImGuiInputTextData { public int size; public int maxChar = -1; public String allowedChar = ""; diff --git a/imgui-binding/src/main/java/imgui/ImInt.java b/imgui-binding/src/main/java/imgui/ImInt.java index b46af37..4b54afe 100644 --- a/imgui-binding/src/main/java/imgui/ImInt.java +++ b/imgui-binding/src/main/java/imgui/ImInt.java @@ -1,27 +1,40 @@ package imgui; -public final class ImInt { - public static ImInt TMP = new ImInt(); +import java.util.Objects; +public final class ImInt { int[] data = new int[]{0}; public ImInt() { } public ImInt(int value) { - setValue(value); + set(value); } - public int getValue() { + public int get() { return this.data[0]; } - public void setValue(int value) { + public void set(int value) { this.data[0] = value; } @Override public String toString() { - return String.valueOf(getValue()); + return String.valueOf(get()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImInt imInt = (ImInt) o; + return data[0] == imInt.data[0]; + } + + @Override + public int hashCode() { + return Objects.hashCode(data[0]); } } diff --git a/imgui-binding/src/main/java/imgui/ImLong.java b/imgui-binding/src/main/java/imgui/ImLong.java index 6a306c7..4f04a31 100644 --- a/imgui-binding/src/main/java/imgui/ImLong.java +++ b/imgui-binding/src/main/java/imgui/ImLong.java @@ -1,5 +1,7 @@ package imgui; +import java.util.Objects; + public class ImLong { long[] data = new long[]{0}; @@ -7,19 +9,32 @@ public class ImLong { } public ImLong(long value) { - setValue(value); + set(value); } - public long getValue() { + public long get() { return this.data[0]; } - public void setValue(long value) { + public void set(long value) { this.data[0] = value; } @Override public String toString() { - return String.valueOf(getValue()); + return String.valueOf(get()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImLong imLong = (ImLong) o; + return data[0] == imLong.data[0]; + } + + @Override + public int hashCode() { + return Objects.hashCode(data[0]); } } diff --git a/imgui-binding/src/main/java/imgui/ImShort.java b/imgui-binding/src/main/java/imgui/ImShort.java index 679ff6a..855eb5c 100644 --- a/imgui-binding/src/main/java/imgui/ImShort.java +++ b/imgui-binding/src/main/java/imgui/ImShort.java @@ -1,5 +1,7 @@ package imgui; +import java.util.Objects; + public class ImShort { short[] data = new short[]{0}; @@ -7,19 +9,32 @@ public class ImShort { } public ImShort(short value) { - setValue(value); + set(value); } - public short getValue() { + public short get() { return this.data[0]; } - public void setValue(short value) { + public void set(short value) { this.data[0] = value; } @Override public String toString() { - return String.valueOf(getValue()); + return String.valueOf(get()); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImShort imShort = (ImShort) o; + return data[0] == imShort.data[0]; + } + + @Override + public int hashCode() { + return Objects.hashCode(data[0]); } } diff --git a/imgui-binding/src/main/java/imgui/ImString.java b/imgui-binding/src/main/java/imgui/ImString.java index 29b9d94..818457e 100644 --- a/imgui-binding/src/main/java/imgui/ImString.java +++ b/imgui-binding/src/main/java/imgui/ImString.java @@ -1,13 +1,16 @@ package imgui; +import java.util.Arrays; + public final class ImString { - public static ImString TMP = new ImString(); + private static final int DEFAULT_SIZE = 100; + ImGuiInputTextData inputData = new ImGuiInputTextData(); byte[] data; private String text; public ImString() { - this(100); + this(DEFAULT_SIZE); } public ImString(int size) { @@ -16,15 +19,15 @@ public final class ImString { public ImString(String text) { this(text.length()); - setValue(text); + set(text); } public ImString(String text, int size) { this(size); - setValue(text); + set(text); } - public String getValue() { + public String get() { if (inputData.isDirty) { inputData.isDirty = false; text = new String(data, 0, inputData.size); @@ -32,7 +35,7 @@ public final class ImString { return text; } - public void setValue(String value) { + public void set(String value) { inputData.size = value.length(); text = value; for (int i = 0; i < inputData.size; i++) { @@ -42,6 +45,19 @@ public final class ImString { @Override public String toString() { - return getValue(); + return get(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ImString imString = (ImString) o; + return Arrays.equals(data, imString.data); + } + + @Override + public int hashCode() { + return Arrays.hashCode(data); } } diff --git a/imgui-binding/src/main/java/imgui/enums/ImDrawCornerFlags.java b/imgui-binding/src/main/java/imgui/enums/ImDrawCornerFlags.java index 0e5abae..44e2028 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImDrawCornerFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImDrawCornerFlags.java @@ -1,28 +1,17 @@ package imgui.enums; public final class ImDrawCornerFlags { - public static ImDrawCornerFlags TopLeft = new ImDrawCornerFlags(1 << 0); - public static ImDrawCornerFlags TopRight = new ImDrawCornerFlags(1 << 1); - public static ImDrawCornerFlags BotLeft = new ImDrawCornerFlags(1 << 2); - public static ImDrawCornerFlags BotRight = new ImDrawCornerFlags(1 << 3); - public static ImDrawCornerFlags Top = new ImDrawCornerFlags(TopLeft.getValue() | TopRight.getValue()); - public static ImDrawCornerFlags Bot = new ImDrawCornerFlags(BotLeft.getValue() | BotRight.getValue()); - public static ImDrawCornerFlags Left = new ImDrawCornerFlags(TopLeft.getValue() | BotLeft.getValue()); - public static ImDrawCornerFlags Right = new ImDrawCornerFlags(TopRight.getValue() | BotRight.getValue()); - public static ImDrawCornerFlags All = new ImDrawCornerFlags(0xF); - private static ImDrawCornerFlags Custom = new ImDrawCornerFlags(0); - int value; - - private ImDrawCornerFlags(int code) { - value = code; + private ImDrawCornerFlags() { } - public ImDrawCornerFlags or(ImDrawCornerFlags otherEnum) { - ImDrawCornerFlags.Custom.value = value | otherEnum.value; - return ImDrawCornerFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int TopLeft = 1; // 0x1 + public static final int TopRight = 1 << 1; // 0x2 + public static final int BotLeft = 1 << 2; // 0x4 + public static final int BotRight = 1 << 3; // 0x8 + public static final int Top = TopLeft | TopRight; // 0x3 + public static final int Bot = BotLeft | BotRight; // 0xC + public static final int Left = TopLeft | BotLeft; // 0x5 + public static final int Right = TopRight | BotRight; // 0xA + public static final int All = 0xF; // In your function calls you may use ~0 (= all bits sets) instead of All, as a convenience } diff --git a/imgui-binding/src/main/java/imgui/enums/ImDrawListFlags.java b/imgui-binding/src/main/java/imgui/enums/ImDrawListFlags.java new file mode 100644 index 0000000..a814797 --- /dev/null +++ b/imgui-binding/src/main/java/imgui/enums/ImDrawListFlags.java @@ -0,0 +1,11 @@ +package imgui.enums; + +public final class ImDrawListFlags { + private ImDrawListFlags() { + } + + public static final int None = 0; + public static final int AntiAliasedLines = 1; // Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles) + public static final int AntiAliasedFill = 1 << 1; // Filled shapes have anti-aliased edges (*2 the number of vertices) + public static final int AllowVtxOffset = 1 << 2; // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. +} diff --git a/imgui-binding/src/main/java/imgui/enums/ImFontAtlasFlags.java b/imgui-binding/src/main/java/imgui/enums/ImFontAtlasFlags.java new file mode 100644 index 0000000..25a56ed --- /dev/null +++ b/imgui-binding/src/main/java/imgui/enums/ImFontAtlasFlags.java @@ -0,0 +1,10 @@ +package imgui.enums; + +public final class ImFontAtlasFlags { + private ImFontAtlasFlags() { + } + + public static final int None = 0; + public static final int NoPowerOfTwoHeight = 1; // Don't round the height to next power of two + public static final int NoMouseCursors = 1 << 1; // Don't build software mouse cursors into the atlas +} diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiBackendFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiBackendFlags.java index 76b3134..4332a09 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiBackendFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiBackendFlags.java @@ -4,23 +4,12 @@ package imgui.enums; * Back-end capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom back-end. */ public final class ImGuiBackendFlags { - public static ImGuiBackendFlags None = new ImGuiBackendFlags(0); - public static ImGuiBackendFlags HasGamepad = new ImGuiBackendFlags(1 << 0); - public static ImGuiBackendFlags HasMouseCursors = new ImGuiBackendFlags(1 << 1); - public static ImGuiBackendFlags HasSetMousePos = new ImGuiBackendFlags(1 << 2); - private static ImGuiBackendFlags Custom = new ImGuiBackendFlags(0); - int value; - - private ImGuiBackendFlags(int code) { - value = code; + private ImGuiBackendFlags() { } - public ImGuiBackendFlags or(ImGuiBackendFlags otherEnum) { - ImGuiBackendFlags.Custom.value = value | otherEnum.value; - return ImGuiBackendFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int HasGamepad = 1; // Back-end Platform supports gamepad and currently has one connected. + public static final int HasMouseCursors = 1 << 1; // Back-end Platform supports honoring GetMouseCursor() value to change the OS cursor shape. + public static final int HasSetMousePos = 1 << 2; // Back-end Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). + public static final int RendererHasVtxOffset = 1 << 3; // Back-end Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiCol.java b/imgui-binding/src/main/java/imgui/enums/ImGuiCol.java index 2c18d1e..05542cb 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiCol.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiCol.java @@ -1,89 +1,60 @@ package imgui.enums; -public enum ImGuiCol { - Text(0), - TextDisabled(1), - /** - * Background of normal windows - */ - WindowBg(2), - /** - * Background of child windows - */ - ChildBg(3), - /** - * Background of popups, menus, tooltips windows - */ - PopupBg(4), - Border(5), - BorderShadow(6), - /** - * Background of checkbox, radio button, plot, slider, text input - */ - FrameBg(7), - FrameBgHovered(8), - FrameBgActive(9), - TitleBg(10), - TitleBgActive(11), - TitleBgCollapsed(12), - MenuBarBg(13), - ScrollbarBg(14), - ScrollbarGrab(15), - ScrollbarGrabHovered(16), - ScrollbarGrabActive(17), - CheckMark(18), - SliderGrab(19), - SliderGrabActive(20), - Button(21), - ButtonHovered(22), - ButtonActive(23), - Header(24), - HeaderHovered(25), - HeaderActive(26), - Separator(27), - SeparatorHovered(28), - SeparatorActive(29), - ResizeGrip(30), - ResizeGripHovered(31), - ResizeGripActive(32), - Tab(33), - TabHovered(34), - TabActive(35), - TabUnfocused(36), - TabUnfocusedActive(37), - DockingPrevie(38), - DockingEmptyBg(39), - PlotLines(40), - PlotLinesHovered(41), - PlotHistogram(42), - PlotHistogramHovered(43), - TextSelectedBg(44), - DragDropTarget(45), - /** - * Gamepad/keyboard: current highlighted item - */ - NavHighlight(46), - /** - * Highlight window when using CTRL+TAB - */ - NavWindowingHighlight(47), - /** - * Darken/colorize entire screen behind the CTRL+TAB window list, when active - */ - NavWindowingDimBg(48), - /** - * Darken/colorize entire screen behind a modal window, when one is active - */ - ModalWindowDimBg(49), - COUNT(48); - - int value; - - ImGuiCol(int code) { - value = code; +/** + * Enumeration for PushStyleColor() / PopStyleColor() + */ +public final class ImGuiCol { + private ImGuiCol() { } - public int getValue() { - return value; - } + public static final int Text = 0; + public static final int TextDisabled = 1; + public static final int WindowBg = 2; // Background of normal windows + public static final int ChildBg = 3; // Background of child windows + public static final int PopupBg = 4; // Background of popups, menus, tooltips windows + public static final int Border = 5; + public static final int BorderShadow = 6; + public static final int FrameBg = 7; // Background of checkbox, radio button, plot, slider, text input + public static final int FrameBgHovered = 8; + public static final int FrameBgActive = 9; + public static final int TitleBg = 10; + public static final int TitleBgActive = 11; + public static final int TitleBgCollapsed = 12; + public static final int MenuBarBg = 13; + public static final int ScrollbarBg = 14; + public static final int ScrollbarGrab = 15; + public static final int ScrollbarGrabHovered = 16; + public static final int ScrollbarGrabActive = 17; + public static final int CheckMark = 18; + public static final int SliderGrab = 19; + public static final int SliderGrabActive = 20; + public static final int Button = 21; + public static final int ButtonHovered = 22; + public static final int ButtonActive = 23; + public static final int Header = 24; // Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem + public static final int HeaderHovered = 25; + public static final int HeaderActive = 26; + public static final int Separator = 27; + public static final int SeparatorHovered = 28; + public static final int SeparatorActive = 29; + public static final int ResizeGrip = 30; + public static final int ResizeGripHovered = 31; + public static final int ResizeGripActive = 32; + public static final int Tab = 33; + public static final int TabHovered = 34; + public static final int TabActive = 35; + public static final int TabUnfocused = 36; + public static final int TabUnfocusedActive = 37; + public static final int PlotLines = 38; + public static final int PlotLinesHovered = 39; + public static final int PlotHistogram = 40; + public static final int PlotHistogramHovered = 41; + public static final int TextSelectedBg = 42; + public static final int DragDropTarget = 43; + public static final int NavHighlight = 44; // Gamepad/keyboard: current highlighted item + public static final int NavWindowingHighlight = 45; // Highlight window when using CTRL+TAB + public static final int NavWindowingDimBg = 46; // Darken/colorize entire screen behind the CTRL+TAB window list, when active + public static final int ModalWindowDimBg = 47; // Darken/colorize entire screen behind a modal window, when one is active + public static final int COUNT = 48; + } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiColorEditFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiColorEditFlags.java index 7b27e87..5b317b4 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiColorEditFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiColorEditFlags.java @@ -1,47 +1,39 @@ package imgui.enums; /** - * Enumeration for GetMouseCursor() - * User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here + * Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() */ public final class ImGuiColorEditFlags { - public static ImGuiColorEditFlags None = new ImGuiColorEditFlags(0); - public static ImGuiColorEditFlags NoAlpha = new ImGuiColorEditFlags(1 << 1); - public static ImGuiColorEditFlags NoPicker = new ImGuiColorEditFlags(1 << 2); - public static ImGuiColorEditFlags NoOptions = new ImGuiColorEditFlags(1 << 3); - public static ImGuiColorEditFlags NoSmallPreview = new ImGuiColorEditFlags(1 << 4); - public static ImGuiColorEditFlags NoInputs = new ImGuiColorEditFlags(1 << 5); - public static ImGuiColorEditFlags NoTooltip = new ImGuiColorEditFlags(1 << 6); - public static ImGuiColorEditFlags NoLabel = new ImGuiColorEditFlags(1 << 7); - public static ImGuiColorEditFlags NoSidePreview = new ImGuiColorEditFlags(1 << 8); - public static ImGuiColorEditFlags NoDragDrop = new ImGuiColorEditFlags(1 << 9); - public static ImGuiColorEditFlags AlphaBar = new ImGuiColorEditFlags(1 << 16); - public static ImGuiColorEditFlags AlphaPreview = new ImGuiColorEditFlags(1 << 17); - public static ImGuiColorEditFlags AlphaPreviewHalf = new ImGuiColorEditFlags(1 << 18); - public static ImGuiColorEditFlags HDR = new ImGuiColorEditFlags(1 << 19); - public static ImGuiColorEditFlags DisplayRGB = new ImGuiColorEditFlags(1 << 20); - public static ImGuiColorEditFlags DisplayHSV = new ImGuiColorEditFlags(1 << 21); - public static ImGuiColorEditFlags DisplayHex = new ImGuiColorEditFlags(1 << 22); - public static ImGuiColorEditFlags Uint8 = new ImGuiColorEditFlags(1 << 23); - public static ImGuiColorEditFlags Float = new ImGuiColorEditFlags(1 << 24); - public static ImGuiColorEditFlags PickerHueBar = new ImGuiColorEditFlags(1 << 25); - public static ImGuiColorEditFlags PickerHueWheel = new ImGuiColorEditFlags(1 << 26); - public static ImGuiColorEditFlags InputRGB = new ImGuiColorEditFlags(1 << 27); - public static ImGuiColorEditFlags InputHSV = new ImGuiColorEditFlags(1 << 28); - public static ImGuiColorEditFlags OptionsDefault = new ImGuiColorEditFlags(Uint8.getValue() | DisplayRGB.getValue() | InputRGB.getValue() | PickerHueBar.getValue()); - private static ImGuiColorEditFlags Custom = new ImGuiColorEditFlags(0); - int value; - - private ImGuiColorEditFlags(int code) { - value = code; + private ImGuiColorEditFlags() { } - public ImGuiColorEditFlags or(ImGuiColorEditFlags otherEnum) { - ImGuiColorEditFlags.Custom.value = value | otherEnum.value; - return ImGuiColorEditFlags.Custom; - } + public static final int None = 0; + public static final int NoAlpha = 1 << 1; // // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer). + public static final int NoPicker = 1 << 2; // // ColorEdit: disable picker when clicking on colored square. + public static final int NoOptions = 1 << 3; // // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. + public static final int NoSmallPreview = 1 << 4; // // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs) + public static final int NoInputs = 1 << 5; // // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square). + public static final int NoTooltip = 1 << 6; // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. + public static final int NoLabel = 1 << 7; // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). + public static final int NoSidePreview = 1 << 8; // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. + public static final int NoDragDrop = 1 << 9; // // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. - public int getValue() { - return value; - } + // User Options (right-click on widget to change some of them). + public static final int AlphaBar = 1 << 16; // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. + public static final int AlphaPreview = 1 << 17; // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. + public static final int AlphaPreviewHalf = 1 << 18; // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. + public static final int HDR = 1 << 19; // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). + public static final int DisplayRGB = 1 << 20; // [Display] // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. + public static final int DisplayHSV = 1 << 21; // [Display] // " + public static final int DisplayHex = 1 << 22; // [Display] // " + public static final int Uint8 = 1 << 23; // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. + public static final int Float = 1 << 24; // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. + public static final int PickerHueBar = 1 << 25; // [Picker] // ColorPicker: bar for Hue, rectangle for Sat/Value. + public static final int PickerHueWheel = 1 << 26; // [Picker] // ColorPicker: wheel for Hue, triangle for Sat/Value. + public static final int InputRGB = 1 << 27; // [Input] // ColorEdit, ColorPicker: input and output data in RGB format. + public static final int InputHSV = 1 << 28; // [Input] // ColorEdit, ColorPicker: input and output data in HSV format. + + // Defaults Options. You can set application defaults using SetColorEditOptions(). The intent is that you probably don't want to + // override them in most of your calls. Let the user choose via the option menu and/or call SetColorEditOptions() once during startup. + public static final int OptionsDefault = Uint8 | DisplayRGB | InputRGB | PickerHueBar; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiComboFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiComboFlags.java index 1a6d8e0..a4a49ba 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiComboFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiComboFlags.java @@ -4,28 +4,16 @@ package imgui.enums; * Flags for ImGui::BeginCombo() */ public final class ImGuiComboFlags { - public static ImGuiComboFlags None = new ImGuiComboFlags(0); - public static ImGuiComboFlags PopupAlignLeft = new ImGuiComboFlags(1 << 0); - public static ImGuiComboFlags HeightSmall = new ImGuiComboFlags(1 << 1); - public static ImGuiComboFlags HeightRegular = new ImGuiComboFlags(1 << 2); - public static ImGuiComboFlags HeightLarge = new ImGuiComboFlags(1 << 3); - public static ImGuiComboFlags HeightLargest = new ImGuiComboFlags(1 << 4); - public static ImGuiComboFlags NoArrowButton = new ImGuiComboFlags(1 << 5); - public static ImGuiComboFlags NoPreview = new ImGuiComboFlags(1 << 6); - public static ImGuiComboFlags HeightMask = new ImGuiComboFlags(HeightSmall.getValue() | HeightRegular.getValue() | HeightLarge.getValue() | HeightLargest.getValue()); - private static ImGuiComboFlags Custom = new ImGuiComboFlags(0); - int value; - - private ImGuiComboFlags(int code) { - value = code; + private ImGuiComboFlags() { } - public ImGuiComboFlags or(ImGuiComboFlags otherEnum) { - ImGuiComboFlags.Custom.value = value | otherEnum.value; - return ImGuiComboFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int PopupAlignLeft = 1; // Align the popup toward the left by default + public static final int HeightSmall = 1 << 1; // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo() + public static final int HeightRegular = 1 << 2; // Max ~8 items visible (default) + public static final int HeightLarge = 1 << 3; // Max ~20 items visible + public static final int HeightLargest = 1 << 4; // As many fitting items as possible + public static final int NoArrowButton = 1 << 5; // Display on the preview box without the square arrow button + public static final int NoPreview = 1 << 6; // Display only a square arrow button + public static final int HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiCond.java b/imgui-binding/src/main/java/imgui/enums/ImGuiCond.java index 1ef2c93..b6fdb51 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiCond.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiCond.java @@ -1,28 +1,16 @@ package imgui.enums; /** - * Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions + * Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions * Represent a condition. * Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. */ public final class ImGuiCond { - public static ImGuiCond Always = new ImGuiCond(1 << 0); - public static ImGuiCond Once = new ImGuiCond(1 << 1); - public static ImGuiCond FirstUseEver = new ImGuiCond(1 << 2); - public static ImGuiCond Appearing = new ImGuiCond(1 << 3); - private static ImGuiCond Custom = new ImGuiCond(0); - int value; - - private ImGuiCond(int code) { - value = code; + private ImGuiCond() { } - public ImGuiCond or(ImGuiCond otherEnum) { - ImGuiCond.Custom.value = value | otherEnum.value; - return ImGuiCond.Custom; - } - - public int getValue() { - return value; - } + public static final int Always = 1 << 0; // Set the variable + public static final int Once = 1 << 1; // Set the variable once per runtime session (only the first call with succeed) + public static final int FirstUseEver = 1 << 2; // Set the variable if the object/window has no persistently saved data (no entry in .ini file) + public static final int Appearing = 1 << 3; // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiConfigFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiConfigFlags.java index 7b8a758..d78857a 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiConfigFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiConfigFlags.java @@ -4,29 +4,18 @@ package imgui.enums; * Configuration flags stored in io.ConfigFlags. Set by user/application. */ public final class ImGuiConfigFlags { - public static ImGuiConfigFlags None = new ImGuiConfigFlags(0); - public static ImGuiConfigFlags NavEnableKeyboard = new ImGuiConfigFlags(1 << 0); - public static ImGuiConfigFlags NavEnableGamepad = new ImGuiConfigFlags(1 << 1); - public static ImGuiConfigFlags NavEnableSetMousePos = new ImGuiConfigFlags(1 << 2); - public static ImGuiConfigFlags NavNoCaptureKeyboard = new ImGuiConfigFlags(1 << 3); - public static ImGuiConfigFlags NoMouse = new ImGuiConfigFlags(1 << 4); - public static ImGuiConfigFlags NoMouseCursorChange = new ImGuiConfigFlags(1 << 5); - public static ImGuiConfigFlags DockingEnable = new ImGuiConfigFlags(1 << 6); - public static ImGuiConfigFlags IsSRGB = new ImGuiConfigFlags(1 << 20); - public static ImGuiConfigFlags IsTouchScreen = new ImGuiConfigFlags(1 << 21); - private static ImGuiConfigFlags Custom = new ImGuiConfigFlags(0); - int value; - - private ImGuiConfigFlags(int code) { - value = code; + private ImGuiConfigFlags() { } - public ImGuiConfigFlags or(ImGuiConfigFlags otherEnum) { - ImGuiConfigFlags.Custom.value = value | otherEnum.value; - return ImGuiConfigFlags.Custom; - } + public static final int None = 0; + public static final int NavEnableKeyboard = 1; // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[]. + public static final int NavEnableGamepad = 1 << 1; // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad. + public static final int NavEnableSetMousePos = 1 << 2; // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth. + public static final int NavNoCaptureKeyboard = 1 << 3; // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. + public static final int NoMouse = 1 << 4; // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the back-end. + public static final int NoMouseCursorChange = 1 << 5; // Instruct back-end to not alter mouse cursor shape and visibility. Use if the back-end cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. - public int getValue() { - return value; - } + // User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core Dear ImGui) + public static final int IsSRGB = 1 << 20; // Application is SRGB-aware. + public static final int IsTouchScreen = 1 << 21; // Application is using a touch screen instead of a mouse. } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiDataType.java b/imgui-binding/src/main/java/imgui/enums/ImGuiDataType.java index f4083e3..2d4d68b 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiDataType.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiDataType.java @@ -3,26 +3,19 @@ package imgui.enums; /** * A primary data type */ -public enum ImGuiDataType { - S8(0), - U8(1), - S16(2), - U16(3), - S32(4), - U32(5), - S64(6), - U64(7), - Float(8), - Double(9), - COUNT(10); - - int value; - - ImGuiDataType(int code) { - value = code; +public final class ImGuiDataType { + private ImGuiDataType() { } - public int getValue() { - return value; - } + public static final int S8 = 0; // signed char / char (with sensible compilers) + public static final int U8 = 1; // unsigned char + public static final int S16 = 2; // short + public static final int U16 = 3; // unsigned short + public static final int S32 = 4; // int + public static final int U32 = 5; // unsigned int + public static final int S64 = 6; // long long / __int64 + public static final int U64 = 7; // unsigned long long / unsigned __int64 + public static final int Float = 8; // float + public static final int Double = 9; // double + public static final int COUNT = 10; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiDir.java b/imgui-binding/src/main/java/imgui/enums/ImGuiDir.java index b07ad48..0d7d3ce 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiDir.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiDir.java @@ -1,20 +1,16 @@ package imgui.enums; -public enum ImGuiDir { - None(-1), - Left(0), - Right(1), - Up(2), - Down(3), - COUNT(4); - - private int code; - - ImGuiDir(int code) { - this.code = code; +/** + * A cardinal direction + */ +public final class ImGuiDir { + private ImGuiDir() { } - public int toInt() { - return code; - } + public static final int None = -1; + public static final int Left = 0; + public static final int Right = 1; + public static final int Up = 2; + public static final int Down = 3; + public static final int COUNT = 5; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiDockNodeFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiDockNodeFlags.java deleted file mode 100644 index d972963..0000000 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiDockNodeFlags.java +++ /dev/null @@ -1,25 +0,0 @@ -package imgui.enums; - -public final class ImGuiDockNodeFlags { - public static ImGuiDockNodeFlags KeepAliveOnly = new ImGuiDockNodeFlags(1 << 0); - public static ImGuiDockNodeFlags NoDockingInCentralNode = new ImGuiDockNodeFlags(1 << 2); - public static ImGuiDockNodeFlags PassthruCentralNode = new ImGuiDockNodeFlags(1 << 3); - public static ImGuiDockNodeFlags NoSplit = new ImGuiDockNodeFlags(1 << 4); - public static ImGuiDockNodeFlags NoResize = new ImGuiDockNodeFlags(1 << 5); - public static ImGuiDockNodeFlags AutoHideTabBar = new ImGuiDockNodeFlags(1 << 6); - private static ImGuiDockNodeFlags Custom = new ImGuiDockNodeFlags(0); - int value; - - private ImGuiDockNodeFlags(int code) { - value = code; - } - - public ImGuiDockNodeFlags or(ImGuiDockNodeFlags otherEnum) { - ImGuiDockNodeFlags.Custom.value = value | otherEnum.value; - return ImGuiDockNodeFlags.Custom; - } - - public int getValue() { - return value; - } -} diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiDragDropFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiDragDropFlags.java index 3740f40..a4d166e 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiDragDropFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiDragDropFlags.java @@ -1,37 +1,23 @@ package imgui.enums; /** - * Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() - * Note: if you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that. Please read the FAQ! - * Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls. + * Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() */ public final class ImGuiDragDropFlags { - public static ImGuiDragDropFlags None = new ImGuiDragDropFlags(0); + private ImGuiDragDropFlags() { + } + + public static final int None = 0; // BeginDragDropSource() flags - public static ImGuiDragDropFlags SourceNoPreviewTooltip = new ImGuiDragDropFlags(1 << 0); - public static ImGuiDragDropFlags SourceNoDisableHover = new ImGuiDragDropFlags(1 << 1); - public static ImGuiDragDropFlags SourceNoHoldToOpenOthers = new ImGuiDragDropFlags(1 << 2); - public static ImGuiDragDropFlags SourceAllowNullID = new ImGuiDragDropFlags(1 << 3); - public static ImGuiDragDropFlags SourceExtern = new ImGuiDragDropFlags(1 << 4); - public static ImGuiDragDropFlags SourceAutoExpirePayload = new ImGuiDragDropFlags(1 << 5); + public static final int SourceNoPreviewTooltip = 1; // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. + public static final int SourceNoDisableHover = 1 << 1; // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. + public static final int SourceNoHoldToOpenOthers = 1 << 2; // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. + public static final int SourceAllowNullID = 1 << 3; // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. + public static final int SourceExtern = 1 << 4; // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. + public static final int SourceAutoExpirePayload = 1 << 5; // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged) // AcceptDragDropPayload() flags - public static ImGuiDragDropFlags AcceptBeforeDelivery = new ImGuiDragDropFlags(1 << 10); - public static ImGuiDragDropFlags AcceptNoDrawDefaultRect = new ImGuiDragDropFlags(1 << 11); - public static ImGuiDragDropFlags AcceptNoPreviewTooltip = new ImGuiDragDropFlags(1 << 12); - public static ImGuiDragDropFlags AcceptPeekOnly = new ImGuiDragDropFlags(AcceptBeforeDelivery.getValue() | AcceptNoDrawDefaultRect.getValue()); - private static ImGuiDragDropFlags Custom = new ImGuiDragDropFlags(0); - int value; - - private ImGuiDragDropFlags(int code) { - value = code; - } - - public ImGuiDragDropFlags or(ImGuiDragDropFlags otherEnum) { - ImGuiDragDropFlags.Custom.value = value | otherEnum.value; - return ImGuiDragDropFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int AcceptBeforeDelivery = 1 << 10; // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. + public static final int AcceptNoDrawDefaultRect = 1 << 11; // Do not draw the default highlight rectangle when hovering over target. + public static final int AcceptNoPreviewTooltip = 1 << 12; // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site. + public static final int AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect; // For peeking ahead and inspecting the payload before delivery. } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiFocusedFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiFocusedFlags.java index 937bf85..d8b41c3 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiFocusedFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiFocusedFlags.java @@ -4,24 +4,12 @@ package imgui.enums; * Flags for ImGui::IsWindowFocused() */ public final class ImGuiFocusedFlags { - public static ImGuiFocusedFlags None = new ImGuiFocusedFlags(0); - public static ImGuiFocusedFlags ChildWindows = new ImGuiFocusedFlags(1 << 0); - public static ImGuiFocusedFlags RootWindow = new ImGuiFocusedFlags(1 << 1); - public static ImGuiFocusedFlags AnyWindow = new ImGuiFocusedFlags(1 << 2); - public static ImGuiFocusedFlags RootAndChildWindows = new ImGuiFocusedFlags(RootWindow.getValue() | ChildWindows.getValue()); - private static ImGuiFocusedFlags Custom = new ImGuiFocusedFlags(0); - int value; - - private ImGuiFocusedFlags(int code) { - value = code; + private ImGuiFocusedFlags() { } - public ImGuiFocusedFlags or(ImGuiFocusedFlags otherEnum) { - ImGuiFocusedFlags.Custom.value = value | otherEnum.value; - return ImGuiFocusedFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int ChildWindows = 1; // IsWindowFocused(): Return true if any children of the window is focused + public static final int RootWindow = 1 << 1; // IsWindowFocused(): Test from root window (top most parent of the current hierarchy) + public static final int AnyWindow = 1 << 2; // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use ImGui::GetIO().WantCaptureMouse instead. + public static final int RootAndChildWindows = RootWindow | ChildWindows; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiHoveredFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiHoveredFlags.java index 27c6207..4083b5a 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiHoveredFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiHoveredFlags.java @@ -6,30 +6,18 @@ package imgui.enums; * Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls. */ public final class ImGuiHoveredFlags { - public static ImGuiHoveredFlags None = new ImGuiHoveredFlags(0); - public static ImGuiHoveredFlags ChildWindows = new ImGuiHoveredFlags(1 << 0); - public static ImGuiHoveredFlags RootWindow = new ImGuiHoveredFlags(1 << 1); - public static ImGuiHoveredFlags AnyWindow = new ImGuiHoveredFlags(1 << 2); - public static ImGuiHoveredFlags AllowWhenBlockedByPopup = new ImGuiHoveredFlags(1 << 3); - // public static ImGuiHoveredFlags AllowWhenBlockedByModal = new ImGuiHoveredFlags(1 << 4); - public static ImGuiHoveredFlags AllowWhenBlockedByActiveItem = new ImGuiHoveredFlags(1 << 5); - public static ImGuiHoveredFlags AllowWhenOverlapped = new ImGuiHoveredFlags(1 << 6); - public static ImGuiHoveredFlags AllowWhenDisabled = new ImGuiHoveredFlags(1 << 7); - public static ImGuiHoveredFlags RectOnly = new ImGuiHoveredFlags(AllowWhenBlockedByPopup.getValue() | AllowWhenBlockedByActiveItem.getValue() | AllowWhenOverlapped.getValue()); - public static ImGuiHoveredFlags RootAndChildWindows = new ImGuiHoveredFlags(RootWindow.getValue() | ChildWindows.getValue()); - private static ImGuiHoveredFlags Custom = new ImGuiHoveredFlags(0); - int value; - - private ImGuiHoveredFlags(int code) { - value = code; + private ImGuiHoveredFlags() { } - public ImGuiHoveredFlags or(ImGuiHoveredFlags otherEnum) { - ImGuiHoveredFlags.Custom.value = value | otherEnum.value; - return ImGuiHoveredFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. + public static final int ChildWindows = 1; // IsWindowHovered() only: Return true if any children of the window is hovered + public static final int RootWindow = 1 << 1; // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) + public static final int AnyWindow = 1 << 2; // IsWindowHovered() only: Return true if any window is hovered + public static final int AllowWhenBlockedByPopup = 1 << 3; // Return true even if a popup window is normally blocking access to this item/window + //ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. + public static final int AllowWhenBlockedByActiveItem = 1 << 5; // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. + public static final int AllowWhenOverlapped = 1 << 6; // Return true even if the position is obstructed or overlapped by another window + public static final int AllowWhenDisabled = 1 << 7; // Return true even if the item is disabled + public static final int RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped; + public static final int RootAndChildWindows = RootWindow | ChildWindows; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiInputTextFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiInputTextFlags.java index 696630b..9031d6e 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiInputTextFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiInputTextFlags.java @@ -4,96 +4,27 @@ package imgui.enums; * Flags for ImGui::InputText() */ public final class ImGuiInputTextFlags { - public static ImGuiInputTextFlags None = new ImGuiInputTextFlags(0); - /** - * Allow 0123456789.+-* - */ - public static ImGuiInputTextFlags CharsDecimal = new ImGuiInputTextFlags(1 << 0); - /** - * Allow 0123456789ABCDEFabcdef - */ - public static ImGuiInputTextFlags CharsHexadecimal = new ImGuiInputTextFlags(1 << 1); - /** - * Turn a..z into A..Z - */ - public static ImGuiInputTextFlags CharsUppercase = new ImGuiInputTextFlags(1 << 2); - /** - * Filter out spaces, tabs - */ - public static ImGuiInputTextFlags CharsNoBlank = new ImGuiInputTextFlags(1 << 3); - /** - * Select entire text when first taking mouse focus - */ - public static ImGuiInputTextFlags AutoSelectAll = new ImGuiInputTextFlags(1 << 4); - /** - * Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function. - */ - public static ImGuiInputTextFlags EnterReturnsTrue = new ImGuiInputTextFlags(1 << 5); - /** - * Callback on pressing TAB (for completion handling) - */ - public static ImGuiInputTextFlags CallbackCompletion = new ImGuiInputTextFlags(1 << 6); - /** - * Callback on pressing Up/Down arrows (for history handling) - */ - public static ImGuiInputTextFlags CallbackHistory = new ImGuiInputTextFlags(1 << 7); - /** - * Callback on each iteration. User code may query cursor position, modify text buffer. - */ - public static ImGuiInputTextFlags CallbackAlways = new ImGuiInputTextFlags(1 << 8); - /** - * Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. - */ - public static ImGuiInputTextFlags CallbackCharFilter = new ImGuiInputTextFlags(1 << 9); - /** - * Pressing TAB input a '\t' character into the text field - */ - public static ImGuiInputTextFlags AllowTabInput = new ImGuiInputTextFlags(1 << 10); - /** - * In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). - */ - public static ImGuiInputTextFlags CtrlEnterForNewLine = new ImGuiInputTextFlags(1 << 11); - /** - * Disable following the cursor horizontally - */ - public static ImGuiInputTextFlags NoHorizontalScroll = new ImGuiInputTextFlags(1 << 12); - /** - * Insert mode - */ - public static ImGuiInputTextFlags AlwaysInsertMode = new ImGuiInputTextFlags(1 << 13); - /** - * Read-only mode - */ - public static ImGuiInputTextFlags ReadOnly = new ImGuiInputTextFlags(1 << 14); - /** - * Password mode, display all characters as '*' - */ - public static ImGuiInputTextFlags Password = new ImGuiInputTextFlags(1 << 15); - /** - * Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). - */ - public static ImGuiInputTextFlags NoUndoRedo = new ImGuiInputTextFlags(1 << 16); - /** - * Allow 0123456789.+-*\\/eE (Scientific notation input) - */ - public static ImGuiInputTextFlags CharsScientific = new ImGuiInputTextFlags(1 << 17); - /** - * Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) - */ - public static ImGuiInputTextFlags CallbackResize = new ImGuiInputTextFlags(1 << 18); - private static ImGuiInputTextFlags Custom = new ImGuiInputTextFlags(0); - public int data; - - private ImGuiInputTextFlags(int code) { - data = code; + private ImGuiInputTextFlags() { } - public ImGuiInputTextFlags or(ImGuiInputTextFlags otherEnum) { - ImGuiInputTextFlags.Custom.data = data | otherEnum.data; - return ImGuiInputTextFlags.Custom; - } - - public int getValue() { - return data; - } + public static final int None = 0; + public static final int CharsDecimal = 1; // Allow 0123456789.+-*/ + public static final int CharsHexadecimal = 1 << 1; // Allow 0123456789ABCDEFabcdef + public static final int CharsUppercase = 1 << 2; // Turn a..z into A..Z + public static final int CharsNoBlank = 1 << 3; // Filter out spaces, tabs + public static final int AutoSelectAll = 1 << 4; // Select entire text when first taking mouse focus + public static final int EnterReturnsTrue = 1 << 5; // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function. + public static final int CallbackCompletion = 1 << 6; // Callback on pressing TAB (for completion handling) + public static final int CallbackHistory = 1 << 7; // Callback on pressing Up/Down arrows (for history handling) + public static final int CallbackAlways = 1 << 8; // Callback on each iteration. User code may query cursor position, modify text buffer. + public static final int CallbackCharFilter = 1 << 9; // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. + public static final int AllowTabInput = 1 << 1; // Pressing TAB input a '\t' character into the text field + public static final int CtrlEnterForNewLine = 1 << 1; // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). + public static final int NoHorizontalScroll = 1 << 1; // Disable following the cursor horizontally + public static final int AlwaysInsertMode = 1 << 1; // Insert mode + public static final int ReadOnly = 1 << 1; // Read-only mode + public static final int Password = 1 << 1; // Password mode, display all characters as '*' + public static final int NoUndoRedo = 1 << 1; // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). + public static final int CharsScientific = 1 << 1; // Allow 0123456789.+-*/eE (Scientific notation input) + public static final int CallbackResize = 1 << 1; // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiKey.java b/imgui-binding/src/main/java/imgui/enums/ImGuiKey.java index e408384..9ea13aa 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiKey.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiKey.java @@ -3,30 +3,31 @@ package imgui.enums; /** * User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array */ -public enum ImGuiKey { - Tab, - LeftArrow, - RightArrow, - UpArrow, - DownArrow, - PageUp, - PageDown, - Home, - End, - Insert, - Delete, - Backspace, - Space, - Enter, - Escape, - KeyPadEnter, - A, - C, - V, - X, - Y, - Z, - COUNT; +public final class ImGuiKey { + private ImGuiKey() { + } - public int code = ordinal(); + public static final int Tab = 0; + public static final int LeftArrow = 1; + public static final int RightArrow = 2; + public static final int UpArrow = 3; + public static final int DownArrow = 4; + public static final int PageUp = 5; + public static final int PageDown = 6; + public static final int Home = 7; + public static final int End = 8; + public static final int Insert = 9; + public static final int Delete = 10; + public static final int Backspace = 11; + public static final int Space = 12; + public static final int Enter = 13; + public static final int Escape = 14; + public static final int KeyPadEnter = 15; + public static final int A = 16; // for text edit CTRL+A: select all + public static final int C = 17; // for text edit CTRL+C: copy + public static final int V = 18; // for text edit CTRL+V: paste + public static final int X = 19; // for text edit CTRL+X: cut + public static final int Y = 20; // for text edit CTRL+Y: redo + public static final int Z = 21; // for text edit CTRL+Z: undo + public static final int COUNT = 22; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiMouseCursor.java b/imgui-binding/src/main/java/imgui/enums/ImGuiMouseCursor.java index 613983a..4cc5c1d 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiMouseCursor.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiMouseCursor.java @@ -4,34 +4,18 @@ package imgui.enums; * Enumeration for GetMouseCursor() * User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here */ -public enum ImGuiMouseCursor { - None(-1), - Arrow(0), - TextInput(1), - ResizeAll(2), - ResizeNS(3), - ResizeEW(4), - ResizeNESW(5), - ResizeNWSE(6), - Hand(7), - COUNT(8); - - int value; - - ImGuiMouseCursor(int code) { - value = code; +public final class ImGuiMouseCursor { + private ImGuiMouseCursor() { } - public static ImGuiMouseCursor valueOf(int value) { - for (ImGuiMouseCursor cursor : values()) { - if (cursor.value == value) { - return cursor; - } - } - throw new IllegalArgumentException("Invalid cursor value: " + value); - } - - public int getValue() { - return value; - } + public static final int None = -1; + public static final int Arrow = 0; + public static final int TextInput = 1; // When hovering over InputText, etc. + public static final int ResizeAll = 2; // (Unused by Dear ImGui functions) + public static final int ResizeNS = 3; // When hovering over an horizontal border + public static final int ResizeEW = 4; // When hovering over a vertical border or a column + public static final int ResizeNESW = 5; // When hovering over the bottom-left corner of a window + public static final int ResizeNWSE = 6; // When hovering over the bottom-right corner of a window + public static final int Hand = 7; // (Unused by Dear ImGui functions. Use for e.g. hyperlinks) + public static final int COUNT = 8; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiNavInput.java b/imgui-binding/src/main/java/imgui/enums/ImGuiNavInput.java index b1e0fb5..65193a7 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiNavInput.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiNavInput.java @@ -2,36 +2,31 @@ package imgui.enums; /** * Gamepad/Keyboard directional navigation - * Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. - * Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Back-end: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). + * Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. + * NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. + * Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. + * Back-end: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). + * Note that io.NavInputs[] is cleared by EndFrame(). * Read instructions in imgui.cpp for more details. Download PNG/PSD at http://goo.gl/9LgVZW. - **/ -public enum ImGuiNavInput { - Activate(0), - Cancel(1), - Input(2), - Menu(3), - DpadLeft(4), - DpadRight(5), - DpadUp(6), - DpadDown(7), - LStickLeft(8), - LStickRight(9), - LStickUp(10), - LStickDown(11), - FocusPrev(12), - FocusNext(13), - TweakSlow(14), - TweakFast(15), - COUNT(16); - - private int code; - - ImGuiNavInput(int code) { - this.code = code; + */ +public final class ImGuiNavInput { + private ImGuiNavInput() { } - public int toInt() { - return code; - } + public static final int Activate = 0; // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) + public static final int Cancel = 1; // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) + public static final int Input = 2; // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) + public static final int Menu = 3; // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) + public static final int DpadLeft = 4; // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) + public static final int DpadRight = 5; + public static final int DpadUp = 6; + public static final int DpadDown = 7; + public static final int LStickLeft = 8; // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down + public static final int LStickRight = 9; // + public static final int LStickUp = 10; // + public static final int LStickDown = 11; // + public static final int FocusPrev = 12; // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + public static final int FocusNext = 13; // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) + public static final int TweakSlow = 14; // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + public static final int TweakFast = 15; // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiSelectableFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiSelectableFlags.java index b8dfdcf..a191d94 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiSelectableFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiSelectableFlags.java @@ -4,24 +4,13 @@ package imgui.enums; * Flags for ImGui::Selectable() */ public final class ImGuiSelectableFlags { - public static ImGuiSelectableFlags None = new ImGuiSelectableFlags(0); - public static ImGuiSelectableFlags DontClosePopups = new ImGuiSelectableFlags(1 << 0); - public static ImGuiSelectableFlags SpanAllColumns = new ImGuiSelectableFlags(1 << 1); - public static ImGuiSelectableFlags AllowDoubleClick = new ImGuiSelectableFlags(1 << 2); - public static ImGuiSelectableFlags Disabled = new ImGuiSelectableFlags(1 << 3); - private static ImGuiSelectableFlags Custom = new ImGuiSelectableFlags(0); - int value; - - private ImGuiSelectableFlags(int code) { - value = code; + private ImGuiSelectableFlags() { } - public ImGuiSelectableFlags or(ImGuiSelectableFlags otherEnum) { - ImGuiSelectableFlags.Custom.value = value | otherEnum.value; - return ImGuiSelectableFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int DontClosePopups = 1; // Clicking this don't close parent popup window + public static final int SpanAllColumns = 1 << 1; // Selectable frame can span all columns (text will still fit in current column) + public static final int AllowDoubleClick = 1 << 2; // Generate press events on double clicks too + public static final int Disabled = 1 << 3; // Cannot be selected, display grayed out text + public static final int AllowItemOverlap = 1 << 4; // (WIP) Hit testing to allow subsequent widgets to overlap this one } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiStyleVar.java b/imgui-binding/src/main/java/imgui/enums/ImGuiStyleVar.java index 4f60eb1..2e0ee7d 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiStyleVar.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiStyleVar.java @@ -1,38 +1,36 @@ package imgui.enums; -public enum ImGuiStyleVar { - Alpha(0), - WindowPadding(1), - WindowRounding(2), - WindowBorderSize(3), - WindowMinSize(4), - WindowTitleAlign(5), - ChildRounding(6), - ChildBorderSize(7), - PopupRounding(8), - PopupBorderSize(9), - FramePadding(10), - FrameRounding(11), - ImGuiStyleVar_FrameBorderSize(12), - ItemSpacing(13), - ItemInnerSpacing(14), - IndentSpacing(15), - ScrollbarSize(16), - ScrollbarRounding(17), - GrabMinSize(18), - GrabRounding(19), - TabRounding(20), - ButtonTextAlign(21), - SelectableTextAlign(22), - COUNT(23); - - int value; - - ImGuiStyleVar(int code) { - value = code; +/** + * Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure. + * NB: the enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. During initialization, feel free to just poke into ImGuiStyle directly. + * NB: if changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. + */ +public final class ImGuiStyleVar { + private ImGuiStyleVar() { } - public int getValue() { - return value; - } + public static final int Alpha = 0; // float Alpha + public static final int WindowPadding = 1; // ImVec2 WindowPadding + public static final int WindowRounding = 2; // float WindowRounding + public static final int WindowBorderSize = 3; // float WindowBorderSize + public static final int WindowMinSize = 4; // ImVec2 WindowMinSize + public static final int WindowTitleAlign = 5; // ImVec2 WindowTitleAlign + public static final int ChildRounding = 6; // float ChildRounding + public static final int ChildBorderSize = 7; // float ChildBorderSize + public static final int PopupRounding = 8; // float PopupRounding + public static final int PopupBorderSize = 9; // float PopupBorderSize + public static final int FramePadding = 10; // ImVec2 FramePadding + public static final int FrameRounding = 11; // float FrameRounding + public static final int FrameBorderSize = 12; // float FrameBorderSize + public static final int ItemSpacing = 13; // ImVec2 ItemSpacing + public static final int ItemInnerSpacing = 14; // ImVec2 ItemInnerSpacing + public static final int IndentSpacing = 15; // float IndentSpacing + public static final int ScrollbarSize = 16; // float ScrollbarSize + public static final int ScrollbarRounding = 17; // float ScrollbarRounding + public static final int GrabMinSize = 18; // float GrabMinSize + public static final int GrabRounding = 19; // float GrabRounding + public static final int TabRounding = 20; // float TabRounding + public static final int ButtonTextAlign = 21; // ImVec2 ButtonTextAlign + public static final int SelectableTextAlign = 22; // ImVec2 SelectableTextAlign + public static final int COUNT = 23; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiTabBarFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiTabBarFlags.java index 5072a43..2ec1ccc 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiTabBarFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiTabBarFlags.java @@ -4,30 +4,18 @@ package imgui.enums; * Flags for ImGui::BeginTabBar() */ public final class ImGuiTabBarFlags { - public static ImGuiTabBarFlags None = new ImGuiTabBarFlags(0); - public static ImGuiTabBarFlags Reorderable = new ImGuiTabBarFlags(1 << 0); - public static ImGuiTabBarFlags AutoSelectNewTabs = new ImGuiTabBarFlags(1 << 1); - public static ImGuiTabBarFlags TabListPopupButton = new ImGuiTabBarFlags(1 << 2); - public static ImGuiTabBarFlags NoCloseWithMiddleMouseButton = new ImGuiTabBarFlags(1 << 3); - public static ImGuiTabBarFlags NoTabListScrollingButtons = new ImGuiTabBarFlags(1 << 4); - public static ImGuiTabBarFlags NoTooltip = new ImGuiTabBarFlags(1 << 5); - public static ImGuiTabBarFlags FittingPolicyResizeDown = new ImGuiTabBarFlags(1 << 6); - public static ImGuiTabBarFlags FittingPolicyScroll = new ImGuiTabBarFlags(1 << 7); - public static ImGuiTabBarFlags FittingPolicyMask = new ImGuiTabBarFlags(FittingPolicyResizeDown.getValue() | FittingPolicyScroll.getValue()); - public static ImGuiTabBarFlags FittingPolicyDefault = new ImGuiTabBarFlags(FittingPolicyResizeDown.getValue()); - private static ImGuiTabBarFlags Custom = new ImGuiTabBarFlags(0); - int value; - - private ImGuiTabBarFlags(int code) { - value = code; + private ImGuiTabBarFlags() { } - public ImGuiTabBarFlags or(ImGuiTabBarFlags otherEnum) { - ImGuiTabBarFlags.Custom.value = value | otherEnum.value; - return ImGuiTabBarFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int Reorderable = 1; // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list + public static final int AutoSelectNewTabs = 1 << 1; // Automatically select new tabs when they appear + public static final int TabListPopupButton = 1 << 2; // Disable buttons to open the tab list popup + public static final int NoCloseWithMiddleMouseButton = 1 << 3; // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. + public static final int NoTabListScrollingButtons = 1 << 4; // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) + public static final int NoTooltip = 1 << 5; // Disable tooltips when hovering a tab + public static final int FittingPolicyResizeDown = 1 << 6; // Resize tabs when they don't fit + public static final int FittingPolicyScroll = 1 << 7; // Add scroll buttons when tabs don't fit + public static final int FittingPolicyMask_ = FittingPolicyResizeDown | FittingPolicyScroll; + public static final int FittingPolicyDefault_ = FittingPolicyResizeDown; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiTabItemFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiTabItemFlags.java index abfc2ef..8eb79fb 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiTabItemFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiTabItemFlags.java @@ -4,24 +4,12 @@ package imgui.enums; * Flags for ImGui::BeginTabItem() */ public final class ImGuiTabItemFlags { - public static ImGuiTabItemFlags None = new ImGuiTabItemFlags(0); - public static ImGuiTabItemFlags UnsavedDocument = new ImGuiTabItemFlags(1 << 0); - public static ImGuiTabItemFlags SetSelected = new ImGuiTabItemFlags(1 << 1); - public static ImGuiTabItemFlags NoCloseWithMiddleMouseButton = new ImGuiTabItemFlags(1 << 2); - public static ImGuiTabItemFlags NoPushId = new ImGuiTabItemFlags(1 << 3); - private static ImGuiTabItemFlags Custom = new ImGuiTabItemFlags(0); - int value; - - private ImGuiTabItemFlags(int code) { - value = code; + private ImGuiTabItemFlags() { } - public ImGuiTabItemFlags or(ImGuiTabItemFlags otherEnum) { - ImGuiTabItemFlags.Custom.value = value | otherEnum.value; - return ImGuiTabItemFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int UnsavedDocument = 1; // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker. + public static final int SetSelected = 1 << 1; // Trigger flag to programmatically make the tab selected when calling BeginTabItem() + public static final int NoCloseWithMiddleMouseButton = 1 << 2; // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. + public static final int NoPushId = 1 << 3; // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiTreeNodeFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiTreeNodeFlags.java index 4f68276..51418b8 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiTreeNodeFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiTreeNodeFlags.java @@ -4,35 +4,24 @@ package imgui.enums; * Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() */ public final class ImGuiTreeNodeFlags { - public static ImGuiTreeNodeFlags None = new ImGuiTreeNodeFlags(0); - public static ImGuiTreeNodeFlags Selected = new ImGuiTreeNodeFlags(1 << 0); - public static ImGuiTreeNodeFlags Framed = new ImGuiTreeNodeFlags(1 << 1); - public static ImGuiTreeNodeFlags AllowItemOverlap = new ImGuiTreeNodeFlags(1 << 2); - public static ImGuiTreeNodeFlags NoTreePushOnOpen = new ImGuiTreeNodeFlags(1 << 3); - public static ImGuiTreeNodeFlags NoAutoOpenOnLog = new ImGuiTreeNodeFlags(1 << 4); - public static ImGuiTreeNodeFlags DefaultOpen = new ImGuiTreeNodeFlags(1 << 5); - public static ImGuiTreeNodeFlags OpenOnDoubleClick = new ImGuiTreeNodeFlags(1 << 6); - public static ImGuiTreeNodeFlags OpenOnArrow = new ImGuiTreeNodeFlags(1 << 7); - public static ImGuiTreeNodeFlags Leaf = new ImGuiTreeNodeFlags(1 << 8); - public static ImGuiTreeNodeFlags Bullet = new ImGuiTreeNodeFlags(1 << 9); - public static ImGuiTreeNodeFlags FramePadding = new ImGuiTreeNodeFlags(1 << 10); - // public static ImGuiTreeNodeFlags SpanAllAvailWidth = new ImGuiTreeNodeFlags(1 << 11); -// public static ImGuiTreeNodeFlags NoScrollOnOpen = new ImGuiTreeNodeFlags(1 << 12); - public static ImGuiTreeNodeFlags NavLeftJumpsBackHere = new ImGuiTreeNodeFlags(1 << 13); - public static ImGuiTreeNodeFlags CollapsingHeader = new ImGuiTreeNodeFlags(Framed.getValue() | NoTreePushOnOpen.getValue() | NoAutoOpenOnLog.getValue()); - private static ImGuiTreeNodeFlags Custom = new ImGuiTreeNodeFlags(0); - int value; - - private ImGuiTreeNodeFlags(int value) { - this.value = value; + private ImGuiTreeNodeFlags() { } - public int getValue() { - return value; - } - - public ImGuiTreeNodeFlags or(ImGuiTreeNodeFlags otherEnum) { - ImGuiTreeNodeFlags.Custom.value = value | otherEnum.value; - return ImGuiTreeNodeFlags.Custom; - } + public static final int None = 0; + public static final int Selected = 1; // Draw as selected + public static final int Framed = 1 << 1; // Full colored frame (e.g. for CollapsingHeader) + public static final int AllowItemOverlap = 1 << 2; // Hit testing to allow subsequent widgets to overlap this one + public static final int NoTreePushOnOpen = 1 << 3; // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + public static final int NoAutoOpenOnLog = 1 << 4; // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) + public static final int DefaultOpen = 1 << 5; // Default node to be open + public static final int OpenOnDoubleClick = 1 << 6; // Need double-click to open node + public static final int OpenOnArrow = 1 << 7; // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. + public static final int Leaf = 1 << 8; // No collapsing, no arrow (use as a convenience for leaf nodes). + public static final int Bullet = 1 << 9; // Display a bullet instead of arrow + public static final int FramePadding = 1 << 1; // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). + public static final int SpanAvailWidth = 1 << 1; // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. + public static final int SpanFullWidth = 1 << 1; // Extend hit box to the left-most and right-most edges (bypass the indented area). + public static final int NavLeftJumpsBackHere = 1 << 1; // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) + //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14; // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible + public static final int CollapsingHeader = Framed | NoTreePushOnOpen | NoAutoOpenOnLog; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImGuiWindowFlags.java b/imgui-binding/src/main/java/imgui/enums/ImGuiWindowFlags.java index ea58c08..4e4b27c 100644 --- a/imgui-binding/src/main/java/imgui/enums/ImGuiWindowFlags.java +++ b/imgui-binding/src/main/java/imgui/enums/ImGuiWindowFlags.java @@ -4,44 +4,31 @@ package imgui.enums; * Flags for ImGui::Begin() */ public final class ImGuiWindowFlags { - public static ImGuiWindowFlags None = new ImGuiWindowFlags(0); - public static ImGuiWindowFlags NoTitleBar = new ImGuiWindowFlags(1 << 0); - public static ImGuiWindowFlags NoResize = new ImGuiWindowFlags(1 << 1); - public static ImGuiWindowFlags NoMove = new ImGuiWindowFlags(1 << 2); - public static ImGuiWindowFlags NoScrollbar = new ImGuiWindowFlags(1 << 3); - public static ImGuiWindowFlags NoScrollWithMouse = new ImGuiWindowFlags(1 << 4); - public static ImGuiWindowFlags NoCollapse = new ImGuiWindowFlags(1 << 5); - public static ImGuiWindowFlags AlwaysAutoResize = new ImGuiWindowFlags(1 << 6); - public static ImGuiWindowFlags NoBackground = new ImGuiWindowFlags(1 << 7); - public static ImGuiWindowFlags NoSavedSettings = new ImGuiWindowFlags(1 << 8); - public static ImGuiWindowFlags NoMouseInputs = new ImGuiWindowFlags(1 << 9); - public static ImGuiWindowFlags MenuBar = new ImGuiWindowFlags(1 << 10); - public static ImGuiWindowFlags HorizontalScrollbar = new ImGuiWindowFlags(1 << 11); - public static ImGuiWindowFlags NoFocusOnAppearing = new ImGuiWindowFlags(1 << 12); - public static ImGuiWindowFlags NoBringToFrontOnFocus = new ImGuiWindowFlags(1 << 13); - public static ImGuiWindowFlags AlwaysVerticalScrollbar = new ImGuiWindowFlags(1 << 14); - public static ImGuiWindowFlags AlwaysHorizontalScrollbar = new ImGuiWindowFlags(1 << 15); - public static ImGuiWindowFlags AlwaysUseWindowPadding = new ImGuiWindowFlags(1 << 16); - public static ImGuiWindowFlags NoNavInputs = new ImGuiWindowFlags(1 << 18); - public static ImGuiWindowFlags NoNavFocus = new ImGuiWindowFlags(1 << 19); - public static ImGuiWindowFlags UnsavedDocument = new ImGuiWindowFlags(1 << 20); - public static ImGuiWindowFlags NoDocking = new ImGuiWindowFlags(1 << 21); - public static ImGuiWindowFlags NoNav = new ImGuiWindowFlags(NoNavInputs.getValue() | NoNavFocus.getValue()); - public static ImGuiWindowFlags NoDecoration = new ImGuiWindowFlags(NoTitleBar.getValue() | NoResize.getValue() | NoScrollbar.getValue() | NoCollapse.getValue()); - public static ImGuiWindowFlags NoInputs = new ImGuiWindowFlags(NoMouseInputs.getValue() | NoNavInputs.getValue() | NoNavFocus.getValue()); - private static ImGuiWindowFlags Custom = new ImGuiWindowFlags(0); - int value; - - private ImGuiWindowFlags(int code) { - value = code; + private ImGuiWindowFlags() { } - public ImGuiWindowFlags or(ImGuiWindowFlags otherEnum) { - ImGuiWindowFlags.Custom.value = value | otherEnum.value; - return ImGuiWindowFlags.Custom; - } - - public int getValue() { - return value; - } + public static final int None = 0; + public static final int NoTitleBar = 1; // Disable title-bar + public static final int NoResize = 1 << 1; // Disable user resizing with the lower-right grip + public static final int NoMove = 1 << 2; // Disable user moving the window + public static final int NoScrollbar = 1 << 3; // Disable scrollbars (window can still scroll with mouse or programmatically) + public static final int NoScrollWithMouse = 1 << 4; // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. + public static final int NoCollapse = 1 << 5; // Disable user collapsing window by double-clicking on it + public static final int AlwaysAutoResize = 1 << 6; // Resize every window to its content every frame + public static final int NoBackground = 1 << 7; // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). + public static final int NoSavedSettings = 1 << 8; // Never load/save settings in .ini file + public static final int NoMouseInputs = 1 << 9; // Disable catching mouse, hovering test with pass through. + public static final int MenuBar = 1 << 1; // Has a menu-bar + public static final int HorizontalScrollbar = 1 << 1; // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. + public static final int NoFocusOnAppearing = 1 << 1; // Disable taking focus when transitioning from hidden to visible state + public static final int NoBringToFrontOnFocus = 1 << 1; // Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) + public static final int AlwaysVerticalScrollbar = 1 << 1; // Always show vertical scrollbar (even if ContentSize.y < Size.y) + public static final int AlwaysHorizontalScrollbar = 1 << 1; // Always show horizontal scrollbar (even if ContentSize.x < Size.x) + public static final int AlwaysUseWindowPadding = 1 << 1; // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) + public static final int NoNavInputs = 1 << 1; // No gamepad/keyboard navigation within the window + public static final int NoNavFocus = 1 << 1; // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) + public static final int UnsavedDocument = 1 << 2; // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker. + public static final int NoNav = NoNavInputs | NoNavFocus; + public static final int NoDecoration = NoTitleBar | NoResize | NoScrollbar | NoCollapse; + public static final int NoInputs = NoMouseInputs | NoNavInputs | NoNavFocus; } diff --git a/imgui-binding/src/main/java/imgui/enums/ImLayout.java b/imgui-binding/src/main/java/imgui/enums/ImLayout.java deleted file mode 100644 index 4b4079c..0000000 --- a/imgui-binding/src/main/java/imgui/enums/ImLayout.java +++ /dev/null @@ -1,6 +0,0 @@ -package imgui.enums; - -public final class ImLayout { - public static float MATCH_PARENT = -0.1f; - public static float WRAP_PARENT = 0.0f; -} diff --git a/imgui-lwjgl3/src/test/java/ImGuiGlfwExample.java b/imgui-lwjgl3/src/test/java/ImGuiGlfwExample.java index 78ef3db..dab8551 100644 --- a/imgui-lwjgl3/src/test/java/ImGuiGlfwExample.java +++ b/imgui-lwjgl3/src/test/java/ImGuiGlfwExample.java @@ -42,7 +42,7 @@ public final class ImGuiGlfwExample { private final double[] mousePosY = new double[1]; // Mouse cursors provided by GLFW - private final long[] mouseCursors = new long[ImGuiMouseCursor.COUNT.getValue()]; + private final long[] mouseCursors = new long[ImGuiMouseCursor.COUNT]; private final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3(); @@ -131,46 +131,46 @@ public final class ImGuiGlfwExample { final ImGuiIO io = ImGui.GetIO(); io.setIniFilename(null); - io.setConfigFlags(ImGuiConfigFlags.NavEnableKeyboard.getValue()); - io.setBackendFlags(ImGuiBackendFlags.HasMouseCursors.getValue()); + io.setConfigFlags(ImGuiConfigFlags.NavEnableKeyboard); + io.setBackendFlags(ImGuiBackendFlags.HasMouseCursors); io.setBackendPlatformName("imgui_java_impl_glfw"); io.setBackendRendererName("imgui_java_impl_lwjgl"); // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array. - final int[] keyMap = new int[ImGuiKey.COUNT.code]; - keyMap[ImGuiKey.Tab.code] = GLFW_KEY_TAB; - keyMap[ImGuiKey.LeftArrow.code] = GLFW_KEY_LEFT; - keyMap[ImGuiKey.RightArrow.code] = GLFW_KEY_RIGHT; - keyMap[ImGuiKey.UpArrow.code] = GLFW_KEY_UP; - keyMap[ImGuiKey.DownArrow.code] = GLFW_KEY_DOWN; - keyMap[ImGuiKey.PageUp.code] = GLFW_KEY_PAGE_UP; - keyMap[ImGuiKey.PageDown.code] = GLFW_KEY_PAGE_DOWN; - keyMap[ImGuiKey.Home.code] = GLFW_KEY_HOME; - keyMap[ImGuiKey.End.code] = GLFW_KEY_END; - keyMap[ImGuiKey.Insert.code] = GLFW_KEY_INSERT; - keyMap[ImGuiKey.Delete.code] = GLFW_KEY_DELETE; - keyMap[ImGuiKey.Backspace.code] = GLFW_KEY_BACKSPACE; - keyMap[ImGuiKey.Space.code] = GLFW_KEY_SPACE; - keyMap[ImGuiKey.Enter.code] = GLFW_KEY_ENTER; - keyMap[ImGuiKey.Escape.code] = GLFW_KEY_ESCAPE; - keyMap[ImGuiKey.KeyPadEnter.code] = GLFW_KEY_KP_ENTER; - keyMap[ImGuiKey.A.code] = GLFW_KEY_A; - keyMap[ImGuiKey.C.code] = GLFW_KEY_C; - keyMap[ImGuiKey.V.code] = GLFW_KEY_V; - keyMap[ImGuiKey.X.code] = GLFW_KEY_X; - keyMap[ImGuiKey.Y.code] = GLFW_KEY_Y; - keyMap[ImGuiKey.Z.code] = GLFW_KEY_Z; + final int[] keyMap = new int[ImGuiKey.COUNT]; + keyMap[ImGuiKey.Tab] = GLFW_KEY_TAB; + keyMap[ImGuiKey.LeftArrow] = GLFW_KEY_LEFT; + keyMap[ImGuiKey.RightArrow] = GLFW_KEY_RIGHT; + keyMap[ImGuiKey.UpArrow] = GLFW_KEY_UP; + keyMap[ImGuiKey.DownArrow] = GLFW_KEY_DOWN; + keyMap[ImGuiKey.PageUp] = GLFW_KEY_PAGE_UP; + keyMap[ImGuiKey.PageDown] = GLFW_KEY_PAGE_DOWN; + keyMap[ImGuiKey.Home] = GLFW_KEY_HOME; + keyMap[ImGuiKey.End] = GLFW_KEY_END; + keyMap[ImGuiKey.Insert] = GLFW_KEY_INSERT; + keyMap[ImGuiKey.Delete] = GLFW_KEY_DELETE; + keyMap[ImGuiKey.Backspace] = GLFW_KEY_BACKSPACE; + keyMap[ImGuiKey.Space] = GLFW_KEY_SPACE; + keyMap[ImGuiKey.Enter] = GLFW_KEY_ENTER; + keyMap[ImGuiKey.Escape] = GLFW_KEY_ESCAPE; + keyMap[ImGuiKey.KeyPadEnter] = GLFW_KEY_KP_ENTER; + keyMap[ImGuiKey.A] = GLFW_KEY_A; + keyMap[ImGuiKey.C] = GLFW_KEY_C; + keyMap[ImGuiKey.V] = GLFW_KEY_V; + keyMap[ImGuiKey.X] = GLFW_KEY_X; + keyMap[ImGuiKey.Y] = GLFW_KEY_Y; + keyMap[ImGuiKey.Z] = GLFW_KEY_Z; io.setKeyMap(keyMap); // Mouse cursors mapping - mouseCursors[ImGuiMouseCursor.Arrow.getValue()] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); - mouseCursors[ImGuiMouseCursor.TextInput.getValue()] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); - mouseCursors[ImGuiMouseCursor.ResizeAll.getValue()] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); - mouseCursors[ImGuiMouseCursor.ResizeNS.getValue()] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR); - mouseCursors[ImGuiMouseCursor.ResizeEW.getValue()] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR); - mouseCursors[ImGuiMouseCursor.ResizeNESW.getValue()] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); - mouseCursors[ImGuiMouseCursor.ResizeNWSE.getValue()] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); - mouseCursors[ImGuiMouseCursor.Hand.getValue()] = glfwCreateStandardCursor(GLFW_HAND_CURSOR); + mouseCursors[ImGuiMouseCursor.Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); + mouseCursors[ImGuiMouseCursor.TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); + mouseCursors[ImGuiMouseCursor.ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); + mouseCursors[ImGuiMouseCursor.ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR); + mouseCursors[ImGuiMouseCursor.ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR); + mouseCursors[ImGuiMouseCursor.ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); + mouseCursors[ImGuiMouseCursor.ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); + mouseCursors[ImGuiMouseCursor.Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR); // Here goes GLFW callbacks to update user input stuff in ImGui glfwSetKeyCallback(window, (w, key, scancode, action, mods) -> { @@ -273,8 +273,8 @@ public final class ImGuiGlfwExample { } private void showUi() { - ImGui.SetNextWindowSize(600, 210, ImGuiCond.Once.getValue()); - ImGui.SetNextWindowPos(10, 10, ImGuiCond.FirstUseEver.getValue()); + ImGui.SetNextWindowSize(600, 210, ImGuiCond.Once); + ImGui.SetNextWindowPos(10, 10, ImGuiCond.FirstUseEver); ImGui.Begin("Custom window"); ImGui.Text("Hello from Java!"); @@ -297,12 +297,12 @@ public final class ImGuiGlfwExample { ImGui.AlignTextToFramePadding(); ImGui.Text("Background color:"); ImGui.SameLine(); - ImGui.ColorEdit3("##click_counter_col", backgroundColor, ImGuiColorEditFlags.NoInputs.or(ImGuiColorEditFlags.NoDragDrop).getValue()); + ImGui.ColorEdit3("##click_counter_col", backgroundColor, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.NoDragDrop); if (ImGui.Button("Click")) { clickCount++; } if (ImGui.IsItemHovered()) { - ImGui.SetMouseCursor(ImGuiMouseCursor.Hand.getValue()); + ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); } ImGui.SameLine(); ImGui.Text("Count: " + clickCount); @@ -314,7 +314,7 @@ public final class ImGuiGlfwExample { ImGui.SetNextItemWidth(500); ImGui.InputText("##input_to_copy_link", imguiDemoLink, ImGuiInputTextFlags.ReadOnly); if (ImGui.IsItemHovered()) { - ImGui.SetMouseCursor(ImGuiMouseCursor.TextInput.getValue()); + ImGui.SetMouseCursor(ImGuiMouseCursor.TextInput); } ImGui.SameLine(); ImGui.Text("(?)");