From e198b8e46f97e2949ecb813d2ba1613885f25117 Mon Sep 17 00:00:00 2001 From: Natan Date: Mon, 11 Dec 2023 22:08:55 -0300 Subject: [PATCH] add int vector --- .../base/src/main/java/imgui/ImVectorInt.java | 21 +++++++++++++++++++ .../main/cpp/cpp-source/custom/ImGuiCustom.h | 1 + imgui/generator/src/main/cpp/imgui.idl | 6 ++++++ 3 files changed, 28 insertions(+) create mode 100644 imgui/base/src/main/java/imgui/ImVectorInt.java diff --git a/imgui/base/src/main/java/imgui/ImVectorInt.java b/imgui/base/src/main/java/imgui/ImVectorInt.java new file mode 100644 index 00000000..aeb70da9 --- /dev/null +++ b/imgui/base/src/main/java/imgui/ImVectorInt.java @@ -0,0 +1,21 @@ +package imgui; + +import idl.IDLBase; + +public class ImVectorInt extends IDLBase { + + public int getData(int index) { + return getDataNATIVE(getCPointer(), index); + } + + /*[-teaVM;-NATIVE] + var jsObj = [MODULE].wrapPointer(this_addr, [MODULE].ImVectorInt); + return jsObj.getData(index); + */ + /*[-C++;-NATIVE] + ImVectorInt* nativeObject = (ImVectorInt*)this_addr; + unsigned int value = nativeObject->Data[index]; + return (jint)value; + */ + private static native int getDataNATIVE(long this_addr, int index); +} \ No newline at end of file diff --git a/imgui/generator/src/main/cpp/cpp-source/custom/ImGuiCustom.h b/imgui/generator/src/main/cpp/cpp-source/custom/ImGuiCustom.h index b710eb31..1bfdf5ab 100644 --- a/imgui/generator/src/main/cpp/cpp-source/custom/ImGuiCustom.h +++ b/imgui/generator/src/main/cpp/cpp-source/custom/ImGuiCustom.h @@ -12,6 +12,7 @@ typedef ImVector VecCmdBuffer; typedef ImVector VecIdxBuffer; typedef ImVector VecVtxBuffer; +typedef ImVector ImVectorInt; namespace im = ImGui; diff --git a/imgui/generator/src/main/cpp/imgui.idl b/imgui/generator/src/main/cpp/imgui.idl index 5698ab08..b6135bd3 100644 --- a/imgui/generator/src/main/cpp/imgui.idl +++ b/imgui/generator/src/main/cpp/imgui.idl @@ -612,6 +612,11 @@ interface VecVtxBuffer { long size(); }; +interface ImVectorInt { + [Operator="[]"] unsigned long getData(long index); + long size(); +}; + interface ImDrawCmd { [Value]attribute ImVec4 ClipRect; attribute long VtxOffset; @@ -781,6 +786,7 @@ interface ImGuiWindowClass { [NoDelete] interface ImGuiWindow { + [Value] readonly attribute ImVectorInt IDStack; [Value] readonly attribute ImGuiWindowTempData DC; attribute long ID; attribute long Flags;