Skip to content

Commit

Permalink
add int vector
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Dec 12, 2023
1 parent 540a3c8 commit e198b8e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions imgui/base/src/main/java/imgui/ImVectorInt.java
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
typedef ImVector<ImDrawCmd> VecCmdBuffer;
typedef ImVector<ImDrawIdx> VecIdxBuffer;
typedef ImVector<ImDrawVert> VecVtxBuffer;
typedef ImVector<unsigned int> ImVectorInt;

namespace im = ImGui;

Expand Down
6 changes: 6 additions & 0 deletions imgui/generator/src/main/cpp/imgui.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e198b8e

Please sign in to comment.