feat: introduce binding generator

A squash of hundreds of commits with a binding API generator.

The API generator works with a hybrid model:
1. We define methods and fields in the code.
2. Mark them with API annotations.
3. For specific use cases, we use the old approach with JNI generation comments.

There is also an API to generate an AST tree, which is saved to JSON.
This JSON can be used for full API generation by declaring only field/method names.
Currently, it is used to generate constants.

By eyeballing, 95% of the API has been converted to the new approach.
This is sufficient for the current moment. Only edge cases with specific API calls are left.

fix: ambiguous call for ImGui::GetColorU32

build: disable checkstyle for imgui-binding module

Since the module is heavily generated, checkstyle for it doesn't make sense.

build: make buildSrc to use JDK 11

build: make generateApi optional when compiling project

Initially generated module was not included to the project VCS.
Since it's now in the separate src folder, we don't need to call generator every time.
Only when a new generation result is required.
This commit is contained in:
SpaiR committed 2024-08-08 14:46:23 +03:00
1 parent e64df5a433
commit 8a8cd22ed6
323 files changed
+113518 -15318

No files matched your search

+43 -130
View File
@@ -1,6 +1,9 @@
package imgui;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -13,24 +16,18 @@ import java.nio.ByteOrder;
* BINDING NOTICE: Since it's impossible to do a 1:1 mapping with JNI, current class provides "getCmdList*()" methods.
* Those are used to get the data needed to do a rendering.
*/
@BindingSource
public final class ImDrawData extends ImGuiStruct {
public static final int SIZEOF_IM_DRAW_IDX = 2;
public static final int SIZEOF_IM_DRAW_VERT = 20;
private static final int RESIZE_FACTOR = 5_000;
private static ByteBuffer dataBuffer = ByteBuffer.allocateDirect(25_000).order(ByteOrder.nativeOrder());
private static final ImGuiViewport OWNER_VIEWPORT = new ImGuiViewport(0);
public ImDrawData(final long ptr) {
super(ptr);
}
/*JNI
#include "_common.h"
#define IM_DRAW_DATA ((ImDrawData*)STRUCT_PTR)
#define THIS ((ImDrawData*)STRUCT_PTR)
*/
///////// Start of Render Methods | Binding
@@ -39,7 +36,7 @@ public final class ImDrawData extends ImGuiStruct {
* Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.
*/
public native int getCmdListCmdBufferSize(int cmdListIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer.Size;
return THIS->CmdLists[cmdListIdx]->CmdBuffer.Size;
*/
/**
@@ -47,23 +44,23 @@ public final class ImDrawData extends ImGuiStruct {
* Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
*/
public native int getCmdListCmdBufferElemCount(int cmdListIdx, int cmdBufferIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].ElemCount;
return THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].ElemCount;
*/
/**
* Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData.DisplayPos to get clipping rectangle in "viewport" coordinates
*/
public ImVec4 getCmdListCmdBufferClipRect(final int cmdListIdx, final int cmdBufferIdx) {
final ImVec4 value = new ImVec4();
getCmdListCmdBufferClipRect(cmdListIdx, cmdBufferIdx, value);
return value;
final ImVec4 dst = new ImVec4();
getCmdListCmdBufferClipRect(dst, cmdListIdx, cmdBufferIdx);
return dst;
}
/**
* Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData.DisplayPos to get clipping rectangle in "viewport" coordinates
*/
public native void getCmdListCmdBufferClipRect(int cmdListIdx, int cmdBufferIdx, ImVec4 dstImVec4); /*
Jni::ImVec4Cpy(env, &IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].ClipRect, dstImVec4);
public native void getCmdListCmdBufferClipRect(ImVec4 dst, int cmdListIdx, int cmdBufferIdx); /*
Jni::ImVec4Cpy(env, &THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].ClipRect, dst);
*/
/**
@@ -71,7 +68,7 @@ public final class ImDrawData extends ImGuiStruct {
* Ignore if never using images or multiple fonts atlas.
*/
public native int getCmdListCmdBufferTextureId(int cmdListIdx, int cmdBufferIdx); /*
return (intptr_t)IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
return (intptr_t)THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
*/
/**
@@ -79,21 +76,21 @@ public final class ImDrawData extends ImGuiStruct {
* With ImGuiBackendFlags_RendererHasVtxOffset: may be {@code >}0 to support meshes larger than 64K vertices with 16-bit indices.
*/
public native int getCmdListCmdBufferVtxOffset(int cmdListIdx, int cmdBufferIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].VtxOffset;
return THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].VtxOffset;
*/
/**
* Start offset in index buffer. Always equal to sum of ElemCount drawn so far.
*/
public native int getCmdListCmdBufferIdxOffset(int cmdListIdx, int cmdBufferIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].IdxOffset;
return THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].IdxOffset;
*/
/**
* Index buffer. Each command consume ImDrawCmd::ElemCount of those
*/
public native int getCmdListIdxBufferSize(int cmdListIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->IdxBuffer.Size;
return THIS->CmdLists[cmdListIdx]->IdxBuffer.Size;
*/
public ByteBuffer getCmdListIdxBufferData(final int cmdListIdx) {
@@ -112,14 +109,14 @@ public final class ImDrawData extends ImGuiStruct {
}
private native void nGetCmdListIdxBufferData(int cmdListIdx, ByteBuffer idxBuffer, int idxBufferCapacity); /*
memcpy(idxBuffer, IM_DRAW_DATA->CmdLists[cmdListIdx]->IdxBuffer.Data, idxBufferCapacity);
memcpy(idxBuffer, THIS->CmdLists[cmdListIdx]->IdxBuffer.Data, idxBufferCapacity);
*/
/**
* Vertex buffer.
*/
public native int getCmdListVtxBufferSize(int cmdListIdx); /*
return IM_DRAW_DATA->CmdLists[cmdListIdx]->VtxBuffer.Size;
return THIS->CmdLists[cmdListIdx]->VtxBuffer.Size;
*/
public ByteBuffer getCmdListVtxBufferData(final int cmdListIdx) {
@@ -138,7 +135,7 @@ public final class ImDrawData extends ImGuiStruct {
}
private native void nGetCmdListVtxBufferData(int cmdListIdx, ByteBuffer vtxBuffer, int vtxBufferCapacity); /*
memcpy(vtxBuffer, IM_DRAW_DATA->CmdLists[cmdListIdx]->VtxBuffer.Data, vtxBufferCapacity);
memcpy(vtxBuffer, THIS->CmdLists[cmdListIdx]->VtxBuffer.Data, vtxBufferCapacity);
*/
public static native int sizeOfImDrawVert(); /*
@@ -154,136 +151,51 @@ public final class ImDrawData extends ImGuiStruct {
/**
* Only valid after Render() is called and before the next NewFrame() is called.
*/
public native boolean getValid(); /*
return IM_DRAW_DATA->Valid;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public boolean Valid;
/**
* Number of ImDrawList* to render
*/
public native int getCmdListsCount(); /*
return IM_DRAW_DATA->CmdListsCount;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public int CmdListsCount;
/**
* For convenience, sum of all ImDrawList's IdxBuffer.Size
*/
public native int getTotalIdxCount(); /*
return IM_DRAW_DATA->TotalIdxCount;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public int TotalIdxCount;
/**
* For convenience, sum of all ImDrawList's VtxBuffer.Size
*/
public native int getTotalVtxCount(); /*
return IM_DRAW_DATA->TotalVtxCount;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public int TotalVtxCount;
/**
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
*/
public ImVec2 getDisplayPos() {
final ImVec2 value = new ImVec2();
getDisplayPos(value);
return value;
}
/**
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
*/
public native void getDisplayPos(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplayPos, dstImVec2);
*/
/**
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
*/
public native float getDisplayPosX(); /*
return IM_DRAW_DATA->DisplayPos.x;
*/
/**
* Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use)
*/
public native float getDisplayPosY(); /*
return IM_DRAW_DATA->DisplayPos.y;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public ImVec2 DisplayPos;
/**
* Size of the viewport to render (== io.DisplaySize for the main viewport)
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
*/
public ImVec2 getDisplaySize() {
final ImVec2 value = new ImVec2();
getDisplaySize(value);
return value;
}
/**
* Size of the viewport to render (== io.DisplaySize for the main viewport)
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
*/
public native void getDisplaySize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->DisplaySize, dstImVec2);
*/
/**
* Size of the viewport to render (== io.DisplaySize for the main viewport)
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
*/
public native float getDisplaySizeX(); /*
return IM_DRAW_DATA->DisplaySize.x;
*/
/**
* Size of the viewport to render (== io.DisplaySize for the main viewport)
* (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use)
*/
public native float getDisplaySizeY(); /*
return IM_DRAW_DATA->DisplaySize.y;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public ImVec2 DisplaySize;
/**
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
*/
public ImVec2 getFramebufferScale() {
final ImVec2 value = new ImVec2();
getFramebufferScale(value);
return value;
}
/**
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
*/
public native void getFramebufferScale(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_DRAW_DATA->FramebufferScale, dstImVec2);
*/
/**
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
*/
public native float getFramebufferScaleX(); /*
return IM_DRAW_DATA->FramebufferScale.x;
*/
/**
* Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display.
*/
public native float getFramebufferScaleY(); /*
return IM_DRAW_DATA->FramebufferScale.y;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public ImVec2 FramebufferScale;
/**
* Viewport carrying the ImDrawData instance, might be of use to the renderer (generally not).
*/
public ImGuiViewport getOwnerViewport() {
OWNER_VIEWPORT.ptr = nGetOwnerViewport();
return OWNER_VIEWPORT;
}
private native long nGetOwnerViewport(); /*
return (intptr_t)IM_DRAW_DATA->OwnerViewport;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public ImGuiViewport OwnerViewport;
// Functions
@@ -291,16 +203,17 @@ public final class ImDrawData extends ImGuiStruct {
* Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources.
* Always prefer indexed rendering!
*/
public native void deIndexAllBuffers(); /*
IM_DRAW_DATA->DeIndexAllBuffers();
*/
@BindingMethod
public native void DeIndexAllBuffers();
/**
* Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects,
* or if there is a difference between your window resolution and framebuffer resolution.
*/
public native void scaleClipRects(float fbScaleX, float fbScaleY); /*
const ImVec2 fbScale = ImVec2(fbScaleX, fbScaleY);
IM_DRAW_DATA->ScaleClipRects(fbScale);
*/
@BindingMethod
public native void ScaleClipRects(ImVec2 fbScale);
/*JNI
#undef THIS
*/
}
+130 -393
View File
@@ -1,6 +1,11 @@
package imgui;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
/**
* Draw command list
@@ -13,6 +18,7 @@ import imgui.binding.ImGuiStruct;
* but you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)
* Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
*/
@BindingSource
public final class ImDrawList extends ImGuiStruct {
public ImDrawList(final long ptr) {
super(ptr);
@@ -20,114 +26,40 @@ public final class ImDrawList extends ImGuiStruct {
/*JNI
#include "_common.h"
#define IM_DRAW_LIST ((ImDrawList*)STRUCT_PTR)
#define THIS ((ImDrawList*)STRUCT_PTR)
*/
/**
* Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
*/
public native int getImDrawListFlags(); /*
return IM_DRAW_LIST->Flags;
*/
/**
* Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
*/
public native void setImDrawListFlags(int imDrawListFlags); /*
IM_DRAW_LIST->Flags = imDrawListFlags;
*/
/**
* Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
*/
public void addImDrawListFlags(final int flags) {
setImDrawListFlags(getImDrawListFlags() | flags);
}
/**
* Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
*/
public void removeImDrawListFlags(final int flags) {
setImDrawListFlags(getImDrawListFlags() & ~(flags));
}
/**
* Flags, you may poke into these to adjust anti-aliasing settings per-primitive.
*/
public boolean hasImDrawListFlags(final int flags) {
return (getImDrawListFlags() & flags) != 0;
}
@BindingField(isFlag = true)
public int Flags;
/**
* Render-level scissoring.
* This is passed down to your render function but not used for CPU-side coarse clipping.
* Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
*/
public native void pushClipRect(float clipRectMinX, float clipRectMinY, float clipRectMaxX, float clipRectMaxY); /*
IM_DRAW_LIST->PushClipRect(ImVec2(clipRectMinX, clipRectMinY), ImVec2(clipRectMaxX, clipRectMaxY));
*/
@BindingMethod
public native void PushClipRect(ImVec2 clipRectMin, ImVec2 clipRectMax, @OptArg boolean intersectWithCurrentClipRect);
/**
* Render-level scissoring.
* This is passed down to your render function but not used for CPU-side coarse clipping.
* Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
*/
public native void pushClipRect(float clipRectMinX, float clipRectMinY, float clipRectMaxX, float clipRectMaxY, boolean intersectWithCurrentClipRect); /*
IM_DRAW_LIST->PushClipRect(ImVec2(clipRectMinX, clipRectMinY), ImVec2(clipRectMaxX, clipRectMaxY), intersectWithCurrentClipRect);
*/
@BindingMethod
public native void PushClipRectFullScreen();
public native void pushClipRectFullScreen(); /*
IM_DRAW_LIST->PushClipRectFullScreen();
*/
@BindingMethod
public native void PopClipRect();
public native void popClipRect(); /*
IM_DRAW_LIST->PopClipRect();
*/
@BindingMethod
public native void PushTextureID(@ArgValue(callPrefix = "(ImTextureID)(intptr_t)") int textureId);
public native void pushTextureId(int textureId); /*
IM_DRAW_LIST->PushTextureID((ImTextureID)(intptr_t)textureId);
*/
@BindingMethod
public native void PopTextureID();
public native void popTextureId(); /*
IM_DRAW_LIST->PopTextureID();
*/
@BindingMethod
public native ImVec2 GetClipRectMin();
public ImVec2 getClipRectMin() {
final ImVec2 value = new ImVec2();
getClipRectMin(value);
return value;
}
public native void getClipRectMin(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IM_DRAW_LIST->GetClipRectMin(), dstImVec2);
*/
public native float getClipRectMinX(); /*
return IM_DRAW_LIST->GetClipRectMin().x;
*/
public native float getClipRectMinY(); /*
return IM_DRAW_LIST->GetClipRectMin().y;
*/
public ImVec2 getClipRectMax() {
final ImVec2 value = new ImVec2();
getClipRectMax(value);
return value;
}
public native void getClipRectMax(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IM_DRAW_LIST->GetClipRectMax(), dstImVec2);
*/
public native float getClipRectMaxX(); /*
return IM_DRAW_LIST->GetClipRectMax().x;
*/
public native float getClipRectMaxY(); /*
return IM_DRAW_LIST->GetClipRectMax().y;
*/
@BindingMethod
public native ImVec2 GetClipRectMax();
// Primitives
// - For rectangular primitives, "pMin" and "pMax" represent the upper-left and lower-right corners.
@@ -136,318 +68,126 @@ public final class ImDrawList extends ImGuiStruct {
// In future versions we will use textures to provide cheaper and higher-quality circles.
// Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides.
public native void addLine(float p1X, float p1Y, float p2X, float p2Y, int col); /*
IM_DRAW_LIST->AddLine(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), col);
*/
@BindingMethod
public native void AddLine(ImVec2 p1, ImVec2 p2, int col, @OptArg float thickness);
public native void addLine(float p1X, float p1Y, float p2X, float p2Y, int col, float thickness); /*
IM_DRAW_LIST->AddLine(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), col, thickness);
*/
@BindingMethod
public native void AddRect(ImVec2 pMin, ImVec2 pMax, int col, @OptArg(callValue = "0.0f") float rounding, @OptArg(callValue = "0") int flags, @OptArg float thickness);
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, int col); /*
IM_DRAW_LIST->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col);
@BindingMethod
public native void AddRectFilled(ImVec2 pMin, ImVec2 pMax, int col, @OptArg(callValue = "0.0f") float rounding, @OptArg int flags);
@BindingMethod
public native void AddRectFilledMultiColor(ImVec2 pMin, ImVec2 pMax, int colUprLeft, int colUprRight, int colBotRight, int colBotLeft);
@BindingMethod
public native void AddQuad(ImVec2 p1, ImVec2 p2, ImVec2 p3, ImVec2 p4, int col, @OptArg float thickness);
@BindingMethod
public native void AddQuadFilled(ImVec2 p1, ImVec2 p2, ImVec2 p3, ImVec2 p4, int col);
@BindingMethod
public native void AddTriangle(ImVec2 p1, ImVec2 p2, ImVec2 p3, int col, @OptArg float thickness);
@BindingMethod
public native void AddTriangleFilled(ImVec2 p1, ImVec2 p2, ImVec2 p3, int col);
@BindingMethod
public native void AddCircle(ImVec2 center, float radius, int col, @OptArg(callValue = "0") int numSegments, @OptArg float thickness);
@BindingMethod
public native void AddCircleFilled(ImVec2 center, float radius, int col, @OptArg int numSegments);
@BindingMethod
public native void AddNgon(ImVec2 center, float radius, int col, int num_segments, @OptArg float thickness);
@BindingMethod
public native void AddNgonFilled(ImVec2 center, float radius, int col, int num_segments);
@BindingMethod
public native void AddText(ImVec2 pos, int col, String textBegin, @OptArg String textEnd);
@BindingMethod
public native void AddText(ImFont font, int fontSize, ImVec2 pos, int col, String textBegin, @OptArg(callValue = "NULL") String textEnd, @OptArg(callValue = "0.0f") float wrapWidth, @OptArg @ArgValue(callPrefix = "&") ImVec4 cpuFineClipRect);
@BindingMethod
public native void AddPolyline(ImVec2[] points, int numPoint, int col, int imDrawFlags, float thickness);
/**
* Note: Anti-aliased filling requires points to be in clockwise order.
*/
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, int col, float rounding); /*
IM_DRAW_LIST->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding);
*/
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, int col, float rounding, int imDrawFlags); /*
IM_DRAW_LIST->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, imDrawFlags);
*/
public native void addRect(float pMinX, float pMinY, float pMaxX, float pMaxY, int col, float rounding, int imDrawFlags, float thickness); /*
IM_DRAW_LIST->AddRect(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, imDrawFlags, thickness);
*/
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, int col); /*
IM_DRAW_LIST->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col);
*/
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, int col, float rounding); /*
IM_DRAW_LIST->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding);
*/
public native void addRectFilled(float pMinX, float pMinY, float pMaxX, float pMaxY, int col, float rounding, int imDrawFlags); /*
IM_DRAW_LIST->AddRectFilled(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), col, rounding, imDrawFlags);
*/
public native void addRectFilledMultiColor(float pMinX, float pMinY, float pMaxX, float pMaxY, long colUprLeft, long colUprRight, long colBotRight, long colBotLeft); /*
IM_DRAW_LIST->AddRectFilledMultiColor(ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), colUprLeft, colUprRight, colBotRight, colBotLeft);
*/
public native void addQuad(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col); /*
IM_DRAW_LIST->AddQuad(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col);
*/
public native void addQuad(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness); /*
IM_DRAW_LIST->AddQuad(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col, thickness);
*/
public native void addQuadFilled(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col); /*
IM_DRAW_LIST->AddQuadFilled(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col);
*/
public native void addTriangle(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col); /*
IM_DRAW_LIST->AddTriangle(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col);
*/
public native void addTriangle(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness); /*
IM_DRAW_LIST->AddTriangle(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col, thickness);
*/
public native void addTriangleFilled(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col); /*
IM_DRAW_LIST->AddTriangleFilled(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col);
*/
public native void addCircle(float centreX, float centreY, float radius, int col); /*
IM_DRAW_LIST->AddCircle(ImVec2(centreX, centreY), radius, col);
*/
public native void addCircle(float centreX, float centreY, float radius, int col, int numSegments); /*
IM_DRAW_LIST->AddCircle(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void addCircle(float centreX, float centreY, float radius, int col, int numSegments, float thickness); /*
IM_DRAW_LIST->AddCircle(ImVec2(centreX, centreY), radius, col, numSegments, thickness);
*/
public native void addCircleFilled(float centreX, float centreY, float radius, int col); /*
IM_DRAW_LIST->AddCircleFilled(ImVec2(centreX, centreY), radius, col);
*/
public native void addCircleFilled(float centreX, float centreY, float radius, int col, int numSegments); /*
IM_DRAW_LIST->AddCircleFilled(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void addNgon(float centreX, float centreY, float radius, int col, int numSegments); /*
IM_DRAW_LIST->AddNgon(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void addNgon(float centreX, float centreY, float radius, int col, int numSegments, float thickness); /*
IM_DRAW_LIST->AddNgon(ImVec2(centreX, centreY), radius, col, numSegments, thickness);
*/
public native void addNgonFilled(float centreX, float centreY, float radius, int col, int numSegments); /*
IM_DRAW_LIST->AddNgonFilled(ImVec2(centreX, centreY), radius, col, numSegments);
*/
public native void addText(float posX, float posY, int col, String text); /*
IM_DRAW_LIST->AddText(ImVec2(posX, posY), col, text);
*/
public void addText(final ImFont imFont, final float fontSize, final float posX, final float posY, final int col, final String text) {
nAddText(imFont.ptr, fontSize, posX, posY, col, text);
}
private native void nAddText(long imFontPtr, float fontSize, float posX, float posY, int col, String text); /*
IM_DRAW_LIST->AddText((ImFont*)imFontPtr, fontSize, ImVec2(posX, posY), col, text);
*/
public void addText(final ImFont imFont, final float fontSize, final float posX, final float posY, final int col, final String text, final float wrapWidth) {
nAddText(imFont.ptr, fontSize, posX, posY, col, text, wrapWidth);
}
private native void nAddText(long imFontPtr, float fontSize, float posX, float posY, int col, String text, float wrapWidth); /*
IM_DRAW_LIST->AddText((ImFont*)imFontPtr, fontSize, ImVec2(posX, posY), col, text, NULL, wrapWidth);
*/
public void addText(final ImFont imFont, final float fontSize, final float posX, final float posY, final int col, final String text, final float wrapWidth, final float cpuFineClipRectX, final float cpuFineClipRectY, final float cpuFineClipRectZ, final float cpuFineClipRectV) {
nAddText(imFont.ptr, fontSize, posX, posY, col, text, wrapWidth, cpuFineClipRectX, cpuFineClipRectY, cpuFineClipRectZ, cpuFineClipRectV);
}
private native void nAddText(long imFontPtr, float fontSize, float posX, float posY, int col, String text, float wrapWidth, float cpuFineClipRectX, float cpuFineClipRectY, float cpuFineClipRectZ, float cpuFineClipRectV); /*
ImVec4 cpuFineClipRect = ImVec4(cpuFineClipRectX, cpuFineClipRectY, cpuFineClipRectZ, cpuFineClipRectV);
IM_DRAW_LIST->AddText((ImFont*)imFontPtr, fontSize, ImVec2(posX, posY), col, text, NULL, wrapWidth, &cpuFineClipRect);
*/
public native void addPolyline(ImVec2[] points, int numPoints, int col, int imDrawFlags, float thickness); /*
int points_num = env->GetArrayLength(points);
ImVec2 _points[points_num];
for (int i = 0; i < points_num; i++) {
jobject jImVec2 = env->GetObjectArrayElement(points, i);
ImVec2 dst;
Jni::ImVec2Cpy(env, jImVec2, &dst);
_points[i] = dst;
}
IM_DRAW_LIST->AddPolyline(_points, numPoints, col, imDrawFlags, thickness);
*/
// Note: Anti-aliased filling requires points to be in clockwise order.
public native void addConvexPolyFilled(ImVec2[] points, int numPoints, int col); /*
int points_num = env->GetArrayLength(points);
ImVec2 _points[points_num];
for (int i = 0; i < points_num; i++) {
jobject jImVec2 = env->GetObjectArrayElement(points, i);
ImVec2 dst;
Jni::ImVec2Cpy(env, jImVec2, &dst);
_points[i] = dst;
}
IM_DRAW_LIST->AddConvexPolyFilled(_points, numPoints, col);
*/
@BindingMethod
public native void AddConvexPolyFilled(ImVec2[] points, int numPoints, int col);
/**
* Cubic Bezier (4 control points)
*/
public native void addBezierCubic(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness); /*
IM_DRAW_LIST->AddBezierCubic(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col, thickness);
*/
/**
* Cubic Bezier (4 control points)
*/
public native void addBezierCubic(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int col, float thickness, int numSegments); /*
IM_DRAW_LIST->AddBezierCubic(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), col, thickness, numSegments);
*/
@BindingMethod
public native void AddBezierCubic(ImVec2 p1, ImVec2 p2, ImVec2 p3, ImVec2 p4, int col, float thickness, @OptArg int numSegments);
/**
* Quadratic Bezier (3 control points)
*/
public native void addBezierQuadratic(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness); /*
IM_DRAW_LIST->AddBezierQuadratic(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col, thickness);
*/
/**
* Quadratic Bezier (3 control points)
*/
public native void addBezierQuadratic(float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, int col, float thickness, int numSegments); /*
IM_DRAW_LIST->AddBezierQuadratic(ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), col, thickness, numSegments);
*/
@BindingMethod
public native void AddBezierQuadratic(ImVec2 p1, ImVec2 p2, ImVec2 p3, int col, float thickness, @OptArg int numSegments);
// Image primitives
// - Read FAQ to understand what ImTextureID is.
// - "pMin" and "pMax" represent the upper-left and lower-right corners of the rectangle.
// - "uvMin" and "uvMax" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture.
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY); /*
IM_DRAW_LIST->AddImage((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY));
*/
@BindingMethod
public native void AddImage(@ArgValue(callPrefix = "(ImTextureID)(intptr_t)") int textureID, ImVec2 pMin, ImVec2 pMax, @OptArg ImVec2 uvMin, @OptArg ImVec2 uvMax, @OptArg int col);
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY); /*
IM_DRAW_LIST->AddImage((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY));
*/
@BindingMethod
public native void AddImageQuad(@ArgValue(callPrefix = "(ImTextureID)(intptr_t)") int textureID, ImVec2 p1, ImVec2 p2, ImVec2 p3, ImVec2 p4, @OptArg ImVec2 uv1, @OptArg ImVec2 uv2, @OptArg ImVec2 uv3, @OptArg ImVec2 uv4, @OptArg int col);
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY); /*
IM_DRAW_LIST->AddImage((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY));
*/
public native void addImage(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, int col); /*
IM_DRAW_LIST->AddImage((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col);
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y));
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y));
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y));
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y));
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y, float uv4X, float uv4Y); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y), ImVec2(uv4X, uv4Y));
*/
public native void addImageQuad(int textureID, float p1X, float p1Y, float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, float uv1X, float uv1Y, float uv2X, float uv2Y, float uv3X, float uv3Y, float uv4X, float uv4Y, int col); /*
IM_DRAW_LIST->AddImageQuad((ImTextureID)(intptr_t)textureID, ImVec2(p1X, p1Y), ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), ImVec2(uv1X, uv1Y), ImVec2(uv2X, uv2Y), ImVec2(uv3X, uv3Y), ImVec2(uv4X, uv4Y), col);
*/
public native void addImageRounded(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, int col, float rounding); /*
IM_DRAW_LIST->AddImageRounded((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col, rounding);
*/
public native void addImageRounded(int textureID, float pMinX, float pMinY, float pMaxX, float pMaxY, float uvMinX, float uvMinY, float uvMaxX, float uvMaxY, int col, float rounding, int imDrawFlags); /*
IM_DRAW_LIST->AddImageRounded((ImTextureID)(intptr_t)textureID, ImVec2(pMinX, pMinY), ImVec2(pMaxX, pMaxY), ImVec2(uvMinX, uvMinY), ImVec2(uvMaxX, uvMaxY), col, rounding, imDrawFlags);
*/
@BindingMethod
public native void AddImageRounded(@ArgValue(callPrefix = "(ImTextureID)(intptr_t)") int textureID, ImVec2 pMin, ImVec2 pMax, ImVec2 uvMin, ImVec2 uvMax, int col, float rounding, @OptArg int imDrawFlags);
// Stateful path API, add points then finish with PathFillConvex() or PathStroke()
public native void pathClear(); /*
IM_DRAW_LIST->PathClear();
*/
@BindingMethod
public native void PathClear();
public native void pathLineTo(float posX, float posY); /*
IM_DRAW_LIST->PathLineTo(ImVec2(posX, posY));
*/
@BindingMethod
public native void PathLineTo(ImVec2 pos);
public native void pathLineToMergeDuplicate(float posX, float posY); /*
IM_DRAW_LIST->PathLineToMergeDuplicate(ImVec2(posX, posY));
*/
@BindingMethod
public native void PathLineToMergeDuplicate(ImVec2 pos);
// Note: Anti-aliased filling requires points to be in clockwise order.
public native void pathFillConvex(int col); /*
IM_DRAW_LIST->PathFillConvex(col);
*/
/**
* Note: Anti-aliased filling requires points to be in clockwise order.
*/
@BindingMethod
public native void PathFillConvex(int col);
public native void pathStroke(int col, int imDrawFlags); /*
IM_DRAW_LIST->PathStroke(col, imDrawFlags);
*/
@BindingMethod
public native void PathStroke(int col, @OptArg(callValue = "0") int imDrawFlags, @OptArg float thickness);
public native void pathStroke(int col, int imDrawFlags, float thickness); /*
IM_DRAW_LIST->PathStroke(col, imDrawFlags, thickness);
*/
public native void pathArcTo(float centerX, float centerY, float radius, float aMin, float aMax); /*
IM_DRAW_LIST->PathArcTo(ImVec2(centerX, centerY), radius, aMin, aMax);
*/
public native void pathArcTo(float centerX, float centerY, float radius, float aMin, float aMax, int numSegments); /*
IM_DRAW_LIST->PathArcTo(ImVec2(centerX, centerY), radius, aMin, aMax, numSegments);
*/
@BindingMethod
public native void PathArcTo(ImVec2 center, float radius, float aMin, float aMax, @OptArg int numSegments);
/**
* Use precomputed angles for a 12 steps circle
*/
public native void pathArcToFast(float centerX, float centerY, float radius, int aMinOf12, int aMaxOf12); /*
IM_DRAW_LIST->PathArcToFast(ImVec2(centerX, centerY), radius, aMinOf12, aMaxOf12);
*/
@BindingMethod
public native void PathArcToFast(ImVec2 center, float radius, int aMinOf12, int aMaxOf12);
/**
* Cubic Bezier (4 control points)
*/
public native void pathBezierCubicCurveTo(float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y); /*
IM_DRAW_LIST->PathBezierCubicCurveTo(ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y));
*/
/**
* Cubic Bezier (4 control points)
*/
public native void pathBezierCubicCurveTo(float p2X, float p2Y, float p3X, float p3Y, float p4X, float p4Y, int numSegments); /*
IM_DRAW_LIST->PathBezierCubicCurveTo(ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), ImVec2(p4X, p4Y), numSegments);
*/
@BindingMethod
public native void PathBezierCubicCurveTo(ImVec2 p2, ImVec2 p3, ImVec2 p4, @OptArg int numSegments);
/**
* Quadratic Bezier (3 control points)
*/
public native void pathBezierQuadraticCurveTo(float p2X, float p2Y, float p3X, float p3Y); /*
IM_DRAW_LIST->PathBezierQuadraticCurveTo(ImVec2(p2X, p2Y), ImVec2(p3X, p3Y));
*/
@BindingMethod
public native void PathBezierQuadraticCurveTo(ImVec2 p2, ImVec2 p3, @OptArg int numSegments);
/**
* Quadratic Bezier (3 control points)
*/
public native void pathBezierQuadraticCurveTo(float p2X, float p2Y, float p3X, float p3Y, int numSegments); /*
IM_DRAW_LIST->PathBezierQuadraticCurveTo(ImVec2(p2X, p2Y), ImVec2(p3X, p3Y), numSegments);
*/
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY); /*
IM_DRAW_LIST->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY));
*/
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY, float rounding); /*
IM_DRAW_LIST->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY), rounding);
*/
public native void pathRect(float rectMinX, float rectMinY, float rectMaxX, float rectMaxY, float rounding, int imDrawFlags); /*
IM_DRAW_LIST->PathRect(ImVec2(rectMinX, rectMinY), ImVec2(rectMaxX, rectMaxY), rounding, imDrawFlags);
*/
@BindingMethod
public native void PathRect(ImVec2 rectMin, ImVec2 rectMax, @OptArg(callValue = "0.0f") float rounding, @OptArg int imDrawFlags);
// Advanced: Channels
// - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives)
@@ -455,47 +195,44 @@ public final class ImDrawList extends ImGuiStruct {
// Prefer using your own persistent instance of ImDrawListSplitter as you can stack them.
// Using the ImDrawList::ChannelsXXXX you cannot stack a split over another.
public native void channelsSplit(int count); /*
IM_DRAW_LIST->ChannelsSplit(count);
*/
@BindingMethod
public native void ChannelsSplit(int count);
public native void channelsMerge(); /*
IM_DRAW_LIST->ChannelsMerge();
*/
@BindingMethod
public native void ChannelsMerge();
public native void channelsSetCurrent(int n); /*
IM_DRAW_LIST->ChannelsSetCurrent(n);
*/
@BindingMethod
public native void ChannelsSetCurrent(int n);
// Advanced: Primitives allocations
// - We render triangles (three vertices)
// - All primitives needs to be reserved via PrimReserve() beforehand.
public native void primReserve(int idxCount, int vtxCount); /*
IM_DRAW_LIST->PrimReserve(idxCount, vtxCount);
*/
@BindingMethod
public native void PrimReserve(int idxCount, int vtxCount);
public native void primUnreserve(int idxCount, int vtxCount); /*
IM_DRAW_LIST->PrimUnreserve(idxCount, vtxCount);
*/
@BindingMethod
public native void PrimUnreserve(int idxCount, int vtxCount);
public native void primRect(float ax, float ay, float bx, float by, int col); /*
IM_DRAW_LIST->PrimRect(ImVec2(ax, ay), ImVec2(bx, by), col);
*/
@BindingMethod
public native void PrimRect(ImVec2 a, ImVec2 b, int col);
public native void primRectUV(float ax, float ay, float bx, float by, float uvAx, float uvAy, float uvBx, float uvBy, int col); /*
IM_DRAW_LIST->PrimRectUV(ImVec2(ax, ay), ImVec2(bx, by), ImVec2(uvAx, uvAy), ImVec2(uvBx, uvBy), col);
*/
@BindingMethod
public native void PrimRectUV(ImVec2 a, ImVec2 b, ImVec2 uvA, ImVec2 uvB, int col);
public native void primQuadUV(float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy, float uvAx, float uvAy, float uvBx, float uvBy, float uvCx, float uvCy, float uvDx, float uvDy, int col); /*
IM_DRAW_LIST->PrimQuadUV(ImVec2(ax, ay), ImVec2(bx, by), ImVec2(cx, cy), ImVec2(dx, dy), ImVec2(uvAx, uvAy), ImVec2(uvBx, uvBy), ImVec2(uvCx, uvCy), ImVec2(uvDx, uvDy), col);
*/
@BindingMethod
public native void PrimQuadUV(ImVec2 a, ImVec2 b, ImVec2 c, ImVec2 d, ImVec2 uvA, ImVec2 uvB, ImVec2 uvC, ImVec2 uvD, int col);
public native void primWriteVtx(float posX, float posY, float uvX, float uvY, int col); /*
IM_DRAW_LIST->PrimWriteVtx(ImVec2(posX, posY), ImVec2(uvX, uvY), col);
*/
@BindingMethod
public native void PrimWriteVtx(ImVec2 pos, ImVec2 uv, int col);
public native void primVtx(float posX, float posY, float uvX, float uvY, int col); /*
IM_DRAW_LIST->PrimVtx(ImVec2(posX, posY), ImVec2(uvX, uvY), col);
*/
@BindingMethod
public native void PrimWriteIdx(@ArgValue(callPrefix = "(ImDrawIdx)") int idx);
@BindingMethod
public native void PrimVtx(ImVec2 pos, ImVec2 uv, int col);
/*JNI
#undef THIS
*/
}
+58 -186
View File
@@ -1,15 +1,19 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
/**
* Font runtime data and rendering
* ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
*/
@BindingSource
public final class ImFont extends ImGuiStructDestroyable {
private final ImFontGlyph fallbackGlyph = new ImFontGlyph(0);
private final ImFontGlyph foundGlyph = new ImFontGlyph(0);
public ImFont() {
}
@@ -17,17 +21,16 @@ public final class ImFont extends ImGuiStructDestroyable {
super(ptr);
}
/*JNI
#include "_common.h"
#define IM_FONT ((ImFont*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImFont*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImFont());
*/
@@ -37,37 +40,23 @@ public final class ImFont extends ImGuiStructDestroyable {
/**
* = FallbackGlyph.AdvanceX
*/
public native float getFallbackAdvanceX(); /*
return IM_FONT->FallbackAdvanceX;
*/
/**
* = FallbackGlyph.AdvanceX
*/
public native void setFallbackAdvanceX(float fallbackAdvanceX); /*
IM_FONT->FallbackAdvanceX = fallbackAdvanceX;
*/
@BindingField
public float FallbackAdvanceX;
/**
* Height of characters/line, set during loading (don't change after loading)
*/
public native float getFontSize(); /*
return IM_FONT->FontSize;
*/
@BindingField
public float FontSize;
// TODO IndexLookup, Glyphs
/**
* = FindGlyph(FontFallbackChar)
*/
public ImFontGlyph getFallbackGlyph() {
fallbackGlyph.ptr = nGetFallbackGlyphPtr();
return fallbackGlyph;
}
private native long nGetFallbackGlyphPtr(); /*
return (intptr_t)IM_FONT->FallbackGlyph;
*/
@BindingField
@ReturnValue(isStatic = true)
public ImFontGlyph FallbackGlyph;
// TODO ContainerAtlas, ConfigData
@@ -75,196 +64,79 @@ public final class ImFont extends ImGuiStructDestroyable {
* Number of ImFontConfig involved in creating this font.
* Bigger than 1 when merging multiple font sources into one ImFont.
*/
public native short getConfigDataCount(); /*
return IM_FONT->ConfigDataCount;
*/
/**
* Replacement character if a glyph isn't found.
*/
public native short getFallbackChar(); /*
return IM_FONT->FallbackChar;
*/
@BindingField
public short ConfigDataCount;
/**
* Character used for ellipsis rendering.
*/
public native short getEllipsisChar(); /*
return IM_FONT->EllipsisChar;
*/
/**
* Character used for ellipsis rendering.
*/
public native void setEllipsisChar(int ellipsisChar); /*
IM_FONT->EllipsisChar = (ImWchar)ellipsisChar;
*/
@BindingField
public short EllipsisChar;
/**
* Character used for ellipsis rendering (if a single '...' character isn't found)
*/
public native short getDotChar(); /*
return IM_FONT->DotChar;
*/
@BindingField
public short DotChar;
/**
* Character used for ellipsis rendering (if a single '...' character isn't found)
*/
public native void setDotChar(int dotChar); /*
IM_FONT->DotChar = (ImWchar)dotChar;
*/
public native boolean getDirtyLookupTables(); /*
return IM_FONT->DirtyLookupTables;
*/
public native void setDirtyLookupTables(boolean dirtyLookupTables); /*
IM_FONT->DirtyLookupTables = dirtyLookupTables;
*/
@BindingField
public boolean DirtyLookupTables;
/**
* Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
*/
public native float getScale(); /*
return IM_FONT->Scale;
*/
/**
* Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
*/
public native void setScale(float scale); /*
IM_FONT->Scale = scale;
*/
@BindingField
public float Scale;
/**
* Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
*/
public native float getAscent(); /*
return IM_FONT->Ascent;
*/
@BindingField
public float Ascent;
/**
* Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
*/
public native void setAscent(float ascent); /*
IM_FONT->Ascent = ascent;
*/
/**
* Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
*/
public native float getDescent(); /*
return IM_FONT->Descent;
*/
/**
* Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
*/
public native void setDescent(float descent); /*
IM_FONT->Descent = descent;
*/
@BindingField
public float Descent;
/**
* Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
*/
public native int getMetricsTotalSurface(); /*
return IM_FONT->MetricsTotalSurface;
*/
/**
* Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
*/
public native void setMetricsTotalSurface(int metricsTotalSurface); /*
IM_FONT->MetricsTotalSurface = metricsTotalSurface;
*/
@BindingField
public int MetricsTotalSurface;
// Methods
public ImFontGlyph findGlyph(final int c) {
foundGlyph.ptr = nFindGlyph(c);
return foundGlyph;
}
@BindingMethod
public native ImFontGlyph FindGlyph(@ArgValue(callPrefix = "(ImWchar)") int c);
private native long nFindGlyph(int c); /*
return (intptr_t)IM_FONT->FindGlyph((ImWchar)c);
*/
@BindingMethod
public native ImFontGlyph FindGlyphNoFallback(@ArgValue(callPrefix = "(ImWchar)") int c);
public ImFontGlyph findGlyphNoFallback(final int c) {
foundGlyph.ptr = nFindGlyphNoFallback(c);
return foundGlyph;
}
@BindingMethod
public native float GetCharAdvance(@ArgValue(callPrefix = "(ImWchar)") int c);
private native long nFindGlyphNoFallback(int c); /*
return (intptr_t)IM_FONT->FindGlyphNoFallback((ImWchar)c);
*/
@BindingMethod
public native boolean IsLoaded();
public native float getCharAdvance(int c); /*
return IM_FONT->GetCharAdvance((ImWchar)c);
*/
public native boolean isLoaded(); /*
return IM_FONT->IsLoaded();
*/
public native String getDebugName(); /*
return env->NewStringUTF(IM_FONT->GetDebugName());
*/
public ImVec2 calcTextSizeA(final float size, final float maxWidth, final float wrapWidth, final String text) {
final ImVec2 value = new ImVec2();
calcTextSizeA(value, size, maxWidth, wrapWidth, text);
return value;
}
@BindingMethod
public native String GetDebugName();
/**
* 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
* 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
*/
public native void calcTextSizeA(ImVec2 dstImVec2, float size, float maxWidth, float wrapWidth, String text); /*
Jni::ImVec2Cpy(env, IM_FONT->CalcTextSizeA(size, maxWidth, wrapWidth, text), dstImVec2);
*/
@BindingMethod
public native ImVec2 CalcTextSizeA(float size, float maxWidth, float wrapWidth, String textBegin, @OptArg String textEnd);
/**
* 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
* 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
@BindingMethod
public native String CalcWordWrapPositionA(float scale, String text, String textEnd, float wrapWidth);
@BindingMethod
public native void RenderChar(ImDrawList drawList, float size, ImVec2 pos, int col, @ArgValue(callPrefix = "(ImWchar)") int c);
@BindingMethod
public native void RenderText(ImDrawList drawList, float size, ImVec2 pos, int col, ImVec4 clipRect, String textBegin, String textEnd, @OptArg(callValue = "0.0f") float wrapWidth, @OptArg boolean cpuFineClip);
/*JNI
#undef THIS
*/
public native float calcTextSizeAX(float size, float maxWidth, float wrapWidth, String text); /*
return IM_FONT->CalcTextSizeA(size, maxWidth, wrapWidth, text).x;
*/
/**
* 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
* 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
*/
public native float calcTextSizeAY(float size, float maxWidth, float wrapWidth, String text); /*
return IM_FONT->CalcTextSizeA(size, maxWidth, wrapWidth, text).y;
*/
public native String calcWordWrapPositionA(float scale, String text, String textEnd, float wrapWidth); /*
return env->NewStringUTF(IM_FONT->CalcWordWrapPositionA(scale, text, textEnd, wrapWidth));
*/
public void renderChar(final ImDrawList drawList, final float size, final float posX, final float posY, final int col, final int c) {
nRenderChar(drawList.ptr, size, posX, posY, col, c);
}
private native void nRenderChar(long drawListPtr, float size, float posX, float posY, int col, int c); /*
IM_FONT->RenderChar((ImDrawList*)drawListPtr, size, ImVec2(posX, posY), col, (ImWchar)c);
*/
public void renderText(final ImDrawList drawList, final float size, final float posX, final float posY, final int col, final float clipRectX, final float clipRectY, final float clipRectW, final float clipRectZ, final String text, final String textEnd) {
nRenderText(drawList.ptr, size, posX, posY, col, clipRectX, clipRectY, clipRectW, clipRectZ, text, textEnd, 0, false);
}
public void renderText(final ImDrawList drawList, final float size, final float posX, final float posY, final int col, final float clipRectX, final float clipRectY, final float clipRectW, final float clipRectZ, final String text, final String textEnd, final float wrapWidth) {
nRenderText(drawList.ptr, size, posX, posY, col, clipRectX, clipRectY, clipRectW, clipRectZ, text, textEnd, wrapWidth, false);
}
public void renderText(final ImDrawList drawList, final float size, final float posX, final float posY, final int col, final float clipRectX, final float clipRectY, final float clipRectW, final float clipRectZ, final String text, final String textEnd, final float wrapWidth, final boolean cpuFineClip) {
nRenderText(drawList.ptr, size, posX, posY, col, clipRectX, clipRectY, clipRectW, clipRectZ, text, textEnd, wrapWidth, cpuFineClip);
}
private native void nRenderText(long drawListPtr, float size, float posX, float posY, int col, float clipRectX, float clipRectY, float clipRectW, float clipRectZ, String text, String textEnd, float wrapWidth, boolean cpuFineClip); /*
IM_FONT->RenderText((ImDrawList*)drawListPtr, size, ImVec2(posX, posY), col, ImVec4(clipRectX, clipRectY, clipRectW, clipRectZ), text, textEnd, wrapWidth, cpuFineClip);
*/
}
@@ -1,6 +1,11 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.type.ImInt;
import java.nio.ByteBuffer;
@@ -25,6 +30,7 @@ import java.nio.ByteOrder;
* - Even though many functions are suffixed with "TTF", OTF data is supported just as well.
* - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future!
*/
@BindingSource
public final class ImFontAtlas extends ImGuiStructDestroyable {
private ByteBuffer alpha8pixels = null;
private ByteBuffer rgba32pixels = null;
@@ -36,10 +42,14 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define IM_FONT_ATLAS ((ImFontAtlas*)STRUCT_PTR)
#define THIS ((ImFontAtlas*)STRUCT_PTR)
jmethodID jImFontAtlasCreateAlpha8PixelsMID;
jmethodID jImFontAtlasCreateRgba32PixelsMID;
@@ -47,240 +57,78 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
static native void nInit(); /*
jclass jImFontAtlasClass = env->FindClass("imgui/ImFontAtlas");
jImFontAtlasCreateAlpha8PixelsMID = env->GetMethodID(jImFontAtlasClass, "createAlpha8Pixels", "(I)Ljava/nio/ByteBuffer;");
jImFontAtlasCreateRgba32PixelsMID = env->GetMethodID(jImFontAtlasClass, "createRgba32Pixels", "(I)Ljava/nio/ByteBuffer;");
*/
@Override
protected long create() {
return nCreate();
}
private native long nCreate(); /*
return (intptr_t)(new ImFontConfig());
*/
public ImFont addFont(final ImFontConfig imFontConfig) {
return new ImFont(nAddFont(imFontConfig.ptr));
}
@BindingMethod
public native ImFont AddFont(ImFontConfig imFontConfig);
private native long nAddFont(long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFont((ImFontConfig*)imFontConfigPtr);
*/
@BindingMethod
public native ImFont AddFontDefault(@OptArg ImFontConfig imFontConfig);
public ImFont addFontDefault() {
return new ImFont(nAddFontDefault());
}
private native long nAddFontDefault(); /*
return (intptr_t)IM_FONT_ATLAS->AddFontDefault();
*/
public ImFont addFontDefault(final ImFontConfig imFontConfig) {
return new ImFont(nAddFontDefault(imFontConfig.ptr));
}
private native long nAddFontDefault(long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFontDefault((ImFontConfig*)imFontConfigPtr);
*/
public ImFont addFontFromFileTTF(final String filename, final float sizePixels) {
return new ImFont(nAddFontFromFileTTF(filename, sizePixels));
}
private native long nAddFontFromFileTTF(String filename, float sizePixels); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromFileTTF(filename, sizePixels);
*/
public ImFont addFontFromFileTTF(final String filename, final float sizePixels, final ImFontConfig imFontConfig) {
return new ImFont(nAddFontFromFileTTF(filename, sizePixels, imFontConfig.ptr));
}
private native long nAddFontFromFileTTF(String filename, float sizePixels, long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromFileTTF(filename, sizePixels, (ImFontConfig*)imFontConfigPtr);
*/
public ImFont addFontFromFileTTF(final String filename, final float sizePixels, final short[] glyphRanges) {
return new ImFont(nAddFontFromFileTTF(filename, sizePixels, glyphRanges));
}
private native long nAddFontFromFileTTF(String filename, float sizePixels, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromFileTTF(filename, sizePixels, NULL, (ImWchar*)&glyphRanges[0]);
*/
public ImFont addFontFromFileTTF(final String filename, final float sizePixels, final ImFontConfig imFontConfig, final short[] glyphRanges) {
return new ImFont(nAddFontFromFileTTF(filename, sizePixels, imFontConfig.ptr, glyphRanges));
}
private native long nAddFontFromFileTTF(String filename, float sizePixels, long imFontConfigPtr, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromFileTTF(filename, sizePixels, (ImFontConfig*)imFontConfigPtr, (ImWchar*)&glyphRanges[0]);
*/
@BindingMethod
public native ImFont AddFontFromFileTTF(String filename, float sizePixels, @OptArg(callValue = "NULL") ImFontConfig fontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas.
* Set font_cfg.FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.
*/
public ImFont addFontFromMemoryTTF(final byte[] fontData, final float sizePixels) {
return new ImFont(nAddFontFromMemoryTTF(fontData, fontData.length, sizePixels));
}
private native long nAddFontFromMemoryTTF(byte[] fontData, int fontSize, float sizePixels); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryTTF(&fontData[0], fontSize, sizePixels);
*/
@BindingMethod
public native ImFont AddFontFromMemoryTTF(byte[] fontData, @ArgValue(callValue = "(int)env->GetArrayLength(obj_fontData)") Void fontSize, float sizePixels, @OptArg(callValue = "NULL") ImFontConfig fontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas.
* Set font_cfg.FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.
*/
public ImFont addFontFromMemoryTTF(final byte[] fontData, final float sizePixels, final ImFontConfig imFontConfig) {
return new ImFont(nAddFontFromMemoryTTF(fontData, fontData.length, sizePixels, imFontConfig.ptr));
}
private native long nAddFontFromMemoryTTF(byte[] fontData, int fontSize, float sizePixels, long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryTTF(&fontData[0], fontSize, sizePixels, (ImFontConfig*)imFontConfigPtr);
*/
/**
* Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas.
* Set font_cfg.FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.
*/
public ImFont addFontFromMemoryTTF(final byte[] fontData, final float sizePixels, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryTTF(fontData, fontData.length, sizePixels, glyphRanges));
}
private native long nAddFontFromMemoryTTF(byte[] fontData, int fontSize, float sizePixels, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryTTF(&fontData[0], fontSize, sizePixels, NULL, (ImWchar*)&glyphRanges[0]);
*/
/**
* Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas.
* Set font_cfg.FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.
*/
public ImFont addFontFromMemoryTTF(final byte[] fontData, final float sizePixels, final ImFontConfig imFontConfig, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryTTF(fontData, fontData.length, sizePixels, imFontConfig.ptr, glyphRanges));
}
private native long nAddFontFromMemoryTTF(byte[] fontData, int fontSize, float sizePixels, long imFontConfigPtr, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryTTF(&fontData[0], fontSize, sizePixels, (ImFontConfig*)imFontConfigPtr, (ImWchar*)&glyphRanges[0]);
*/
@BindingMethod
public native ImFont AddFontFromMemoryTTF(byte[] fontData, int fontSize, float sizePixels, @OptArg(callValue = "NULL") ImFontConfig fontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
*/
public ImFont addFontFromMemoryCompressedTTF(final byte[] compressedFontData, final float sizePixels) {
return new ImFont(nAddFontFromMemoryCompressedTTF(compressedFontData, compressedFontData.length, sizePixels));
}
private native long nAddFontFromMemoryCompressedTTF(byte[] compressedFontData, int fontSize, float sizePixels); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedTTF(&compressedFontData[0], fontSize, sizePixels);
*/
@BindingMethod
public native ImFont AddFontFromMemoryCompressedTTF(byte[] compressedFontData, @ArgValue(callValue = "(int)env->GetArrayLength(obj_compressedFontData)") Void compressedFontSize, float sizePixels, @OptArg(callValue = "NULL") ImFontConfig imFontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
*/
public ImFont addFontFromMemoryCompressedTTF(final byte[] compressedFontData, final float sizePixels, final ImFontConfig imFontConfig) {
return new ImFont(nAddFontFromMemoryCompressedTTF(compressedFontData, compressedFontData.length, sizePixels, imFontConfig.ptr));
}
private native long nAddFontFromMemoryCompressedTTF(byte[] compressedFontData, int fontSize, float sizePixels, long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedTTF(&compressedFontData[0], fontSize, sizePixels, (ImFontConfig*)imFontConfigPtr);
*/
/**
* 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
*/
public ImFont addFontFromMemoryCompressedTTF(final byte[] compressedFontData, final float sizePixels, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryCompressedTTF(compressedFontData, compressedFontData.length, sizePixels, glyphRanges));
}
private native long nAddFontFromMemoryCompressedTTF(byte[] compressedFontData, int fontSize, float sizePixels, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedTTF(&compressedFontData[0], fontSize, sizePixels, NULL, (ImWchar*)&glyphRanges[0]);
*/
/**
* 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
*/
public ImFont addFontFromMemoryCompressedTTF(final byte[] compressedFontData, final float sizePixels, final ImFontConfig imFontConfig, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryCompressedTTF(compressedFontData, compressedFontData.length, sizePixels, imFontConfig.ptr, glyphRanges));
}
private native long nAddFontFromMemoryCompressedTTF(byte[] compressedFontData, int fontSize, float sizePixels, long imFontConfigPtr, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedTTF(&compressedFontData[0], fontSize, sizePixels, (ImFontConfig*)imFontConfigPtr, (ImWchar*)&glyphRanges[0]);
*/
@BindingMethod
public native ImFont AddFontFromMemoryCompressedTTF(byte[] compressedFontData, int compressedFontSize, float sizePixels, @OptArg(callValue = "NULL") ImFontConfig imFontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
*/
public ImFont addFontFromMemoryCompressedBase85TTF(final String compressedFontDataBase85, final float sizePixels) {
return new ImFont(nAddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels));
}
private native long nAddFontFromMemoryCompressedBase85TTF(String compressedFontDataBase85, float sizePixels); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels);
*/
/**
* 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
*/
public ImFont addFontFromMemoryCompressedBase85TTF(final String compressedFontDataBase85, final float sizePixels, final ImFontConfig imFontConfig) {
return new ImFont(nAddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, imFontConfig.ptr));
}
private native long nAddFontFromMemoryCompressedBase85TTF(String compressedFontDataBase85, float sizePixels, long imFontConfigPtr); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, (ImFontConfig*)imFontConfigPtr);
*/
/**
* 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
*/
public ImFont addFontFromMemoryCompressedBase85TTF(final String compressedFontDataBase85, final float sizePixels, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, glyphRanges));
}
private native long nAddFontFromMemoryCompressedBase85TTF(String compressedFontDataBase85, float sizePixels, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, NULL, (ImWchar*)&glyphRanges[0]);
*/
/**
* 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
*/
public ImFont addFontFromMemoryCompressedBase85TTF(final String compressedFontDataBase85, final float sizePixels, final ImFontConfig imFontConfig, final short[] glyphRanges) {
return new ImFont(nAddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, imFontConfig.ptr, glyphRanges));
}
private native long nAddFontFromMemoryCompressedBase85TTF(String compressedFontDataBase85, float sizePixels, long imFontConfigPtr, short[] glyphRanges); /*
return (intptr_t)IM_FONT_ATLAS->AddFontFromMemoryCompressedBase85TTF(compressedFontDataBase85, sizePixels, (ImFontConfig*)imFontConfigPtr, (ImWchar*)&glyphRanges[0]);
*/
@BindingMethod
public native ImFont AddFontFromMemoryCompressedBase85TTF(String compressedFontDataBase85, float sizePixels, ImFontConfig fontConfig, @OptArg @ArgValue(callPrefix = "(ImWchar*)") short[] glyphRanges);
/**
* Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.
*/
public native void clearInputData(); /*
IM_FONT_ATLAS->ClearInputData();
*/
@BindingMethod
public native void ClearInputData();
/**
* Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.
*/
public native void clearTexData(); /*
IM_FONT_ATLAS->ClearTexData();
*/
@BindingMethod
public native void ClearTexData();
/**
* Clear output font data (glyphs storage, UV coordinates).
*/
public native void clearFonts(); /*
IM_FONT_ATLAS->ClearFonts();
*/
@BindingMethod
public native void ClearFonts();
/**
* Clear all input and output.
*/
public native void clear(); /*
IM_FONT_ATLAS->Clear();
*/
@BindingMethod
public native void Clear();
// Build atlas, retrieve pixel data.
// User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID().
@@ -291,9 +139,8 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
/**
* Build pixels data. This is called automatically for you by the GetTexData*** functions.
*/
public native boolean build(); /*
return IM_FONT_ATLAS->Build();
*/
@BindingMethod
public native boolean Build();
/**
* 1 byte-per-pixel
@@ -316,19 +163,15 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
} else {
alpha8pixels.clear();
}
return alpha8pixels;
}
private native void getTexDataAsAlpha8(int[] outWidth, int[] outHeight, int[] outBytesPerPixel); /*
unsigned char* pixels;
IM_FONT_ATLAS->GetTexDataAsAlpha8(&pixels, &outWidth[0], &outHeight[0], &outBytesPerPixel[0]);
THIS->GetTexDataAsAlpha8(&pixels, &outWidth[0], &outHeight[0], &outBytesPerPixel[0]);
int size = outWidth[0] * outHeight[0] * outBytesPerPixel[0];
jobject jBuffer = env->CallObjectMethod(object, jImFontAtlasCreateAlpha8PixelsMID, size);
char* buffer = (char*)env->GetDirectBufferAddress(jBuffer);
memcpy(buffer, pixels, size);
*/
@@ -353,29 +196,27 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
} else {
rgba32pixels.clear();
}
return rgba32pixels;
}
private native void nGetTexDataAsRGBA32(int[] outWidth, int[] outHeight, int[] outBytesPerPixel); /*
unsigned char* pixels;
IM_FONT_ATLAS->GetTexDataAsRGBA32(&pixels, &outWidth[0], &outHeight[0], &outBytesPerPixel[0]);
THIS->GetTexDataAsRGBA32(&pixels, &outWidth[0], &outHeight[0], &outBytesPerPixel[0]);
int size = outWidth[0] * outHeight[0] * outBytesPerPixel[0];
jobject jBuffer = env->CallObjectMethod(object, jImFontAtlasCreateRgba32PixelsMID, size);
char* buffer = (char*)env->GetDirectBufferAddress(jBuffer);
memcpy(buffer, pixels, size);
*/
public native boolean isBuilt(); /*
return IM_FONT_ATLAS->IsBuilt();
*/
@BindingMethod
public native boolean IsBuilt();
public native void setTexID(int textureID); /*
IM_FONT_ATLAS->SetTexID((ImTextureID)(intptr_t)textureID);
*/
/**
* User data to refer to the texture once it has been uploaded to user's graphic systems.
* It is passed back to you during rendering via the ImDrawCmd structure.
*/
@BindingMethod
public native void SetTexID(@ArgValue(callPrefix = "(ImTextureID)(intptr_t)") int textureID);
//-------------------------------------------
// Glyph Ranges
@@ -400,58 +241,62 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
* Basic Latin, Extended Latin
*/
public native short[] getGlyphRangesDefault(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesDefault());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesDefault());
*/
/**
* Default + Korean characters
*/
public native short[] getGlyphRangesKorean(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesKorean());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesKorean());
*/
/**
* Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs
*/
public native short[] getGlyphRangesJapanese(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesJapanese());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesJapanese());
*/
/**
* Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs
*/
public native short[] getGlyphRangesChineseFull(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesChineseFull());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesChineseFull());
*/
/**
* Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese
*/
public native short[] getGlyphRangesChineseSimplifiedCommon(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesChineseSimplifiedCommon());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesChineseSimplifiedCommon());
*/
/**
* Default + about 400 Cyrillic characters
*/
public native short[] getGlyphRangesCyrillic(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesCyrillic());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesCyrillic());
*/
/**
* Default + Thai characters
*/
public native short[] getGlyphRangesThai(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesThai());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesThai());
*/
/**
* Default + Vietnamese characters
*/
public native short[] getGlyphRangesVietnamese(); /*
RETURN_GLYPH_2_SHORT(IM_FONT_ATLAS->GetGlyphRangesVietnamese());
RETURN_GLYPH_2_SHORT(THIS->GetGlyphRangesVietnamese());
*/
/*JNI
#undef RETURN_GLYPH_2_SHORT
*/
//-------------------------------------------
// [BETA] Custom Rectangles/Glyphs API
//-------------------------------------------
@@ -463,28 +308,14 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
// Read docs/FONTS.md for more details about using colorful icons.
// Note: this API may be redesigned later in order to support multi-monitor varying DPI settings.
public native int addCustomRectRegular(int width, int height); /*
return IM_FONT_ATLAS->AddCustomRectRegular(width, height);
*/
public int addCustomRectFontGlyph(final ImFont imFont, final short id, final int width, final int height, final float advanceX) {
return nAddCustomRectFontGlyph(imFont.ptr, id, width, height, advanceX);
}
private native int nAddCustomRectFontGlyph(long imFontPtr, short id, int width, int height, float advanceX); /*
return IM_FONT_ATLAS->AddCustomRectFontGlyph((ImFont*)imFontPtr, id, width, height, advanceX);
*/
@BindingMethod
public native int AddCustomRectRegular(int width, int height);
/**
* Id needs to be {@code <} 0x110000 to register a rectangle to map into a specific font.
*/
public int addCustomRectFontGlyph(final ImFont imFont, final short id, final int width, final int height, final float advanceX, final float offsetX, final float offsetY) {
return nAddCustomRectFontGlyph(imFont.ptr, id, width, height, advanceX, offsetX, offsetY);
}
private native int nAddCustomRectFontGlyph(long imFontPtr, short id, int width, int height, float advanceX, float offsetX, float offsetY); /*
return IM_FONT_ATLAS->AddCustomRectFontGlyph((ImFont*)imFontPtr, id, width, height, advanceX, ImVec2(offsetX, offsetY));
*/
@BindingMethod
public native int AddCustomRectFontGlyph(ImFont imFont, @ArgValue(callPrefix = "(ImWchar)") short id, int width, int height, float advanceX, @OptArg ImVec2 offset);
// TODO GetCustomRectByIndex
@@ -492,92 +323,35 @@ public final class ImFontAtlas extends ImGuiStructDestroyable {
// Members
//-------------------------------------------
/**
* Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
*/
public native boolean getLocked(); /*
return IM_FONT_ATLAS->Locked;
*/
/**
* Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
*/
public native void setLocked(boolean locked); /*
IM_FONT_ATLAS->Locked = locked;
*/
/**
* Build flags (see {@link imgui.flag.ImFontAtlasFlags})
*/
public native int getFlags(); /*
return IM_FONT_ATLAS->Flags;
*/
@BindingField(isFlag = true)
public int Flags;
/**
* Build flags (see {@link imgui.flag.ImFontAtlasFlags})
*/
public native void setFlags(int imFontAtlasFlags); /*
IM_FONT_ATLAS->Flags = imFontAtlasFlags;
*/
/**
* Build flags (see {@link imgui.flag.ImFontAtlasFlags})
*/
public void addFlags(final int flags) {
setFlags(getFlags() | flags);
}
/**
* Build flags (see {@link imgui.flag.ImFontAtlasFlags})
*/
public void removeFlags(final int flags) {
setFlags(getFlags() & ~(flags));
}
/**
* Build flags (see {@link imgui.flag.ImFontAtlasFlags})
*/
public boolean hasFlags(final int flags) {
return (getFlags() & flags) != 0;
}
/**
* User data to refer to the texture once it has been uploaded to user's graphic systems.
* It is passed back to you during rendering via the ImDrawCmd structure.
*/
public native int getTexID(); /*
return (int)(intptr_t)(void*)IM_FONT_ATLAS->TexID;
*/
// TexID implemented as SetTexID function
/**
* Texture width desired by user before Build(). Must be a power-of-two.
* If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
*/
public native int getTexDesiredWidth(); /*
return IM_FONT_ATLAS->TexDesiredWidth;
*/
/**
* Texture width desired by user before Build(). Must be a power-of-two.
* If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
*/
public native void setTexDesiredWidth(int texDesiredWidth); /*
IM_FONT_ATLAS->TexDesiredWidth = texDesiredWidth;
*/
@BindingField
public int TexDesiredWidth;
/**
* Padding between glyphs within texture in pixels. Defaults to 1.
* If your rendering method doesn't rely on bilinear filtering you may set this to 0.
*/
public native int getTexGlyphPadding(); /*
return IM_FONT_ATLAS->TexGlyphPadding;
*/
@BindingField
public int TexGlyphPadding;
/**
* Padding between glyphs within texture in pixels. Defaults to 1.
* If your rendering method doesn't rely on bilinear filtering you may set this to 0.
* Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.
*/
@BindingField
public boolean Locked;
/*JNI
#undef THIS
*/
public native void setTexGlyphPadding(int texGlyphPadding); /*
IM_FONT_ATLAS->TexGlyphPadding = texGlyphPadding;
*/
}
@@ -1,348 +1,133 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImFontConfig extends ImGuiStructDestroyable {
private short[] glyphRanges;
/**
* This class will create a native structure.
* Call {@link #destroy()} method to manually free used memory.
*/
public ImFontConfig() {
super();
setFontDataOwnedByAtlas(false); // Read method javadoc
}
ImFontConfig(final long ptr) {
super(ptr);
setFontDataOwnedByAtlas(false); // Read method javadoc
}
/*JNI
#include "_common.h"
#define IM_FONT_CONFIG ((ImFontConfig*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImFontConfig*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImFontConfig());
ImFontConfig* cfg = new ImFontConfig();
cfg->FontDataOwnedByAtlas = false;
return (intptr_t)cfg;
*/
/**
* TTF/OTF data
*/
public native byte[] getFontData(); /*
int size = IM_FONT_CONFIG->FontDataSize;
jbyteArray jBytes = env->NewByteArray(size);
env->SetByteArrayRegion(jBytes, 0, size, (jbyte*)IM_FONT_CONFIG->FontData);
return jBytes;
*/
/**
* TTF/OTF data
*/
public native void setFontData(byte[] fontData); /*
IM_FONT_CONFIG->FontData = &fontData[0];
*/
// TODO: FontData
/**
* TTF/OTF data size
*/
public native int getFontDataSize(); /*
return IM_FONT_CONFIG->FontDataSize;
*/
/**
* TTF/OTF data size
*/
public native void setFontDataSize(int fontDataSize); /*
IM_FONT_CONFIG->FontDataSize = fontDataSize;
*/
@BindingField
public int FontDataSize;
/**
* TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
*/
public native boolean getFontDataOwnedByAtlas(); /*
return IM_FONT_CONFIG->FontDataOwnedByAtlas;
*/
/**
* TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
* <p>
* BINDING NOTICE: By default binding will set this value to <b>false</b>.
* If this is not done, Dear ImGui will try to free memory allocated by JVM to store fonts data while running {@link ImGui#destroyContext()}.
* This will result into a native exception, since JVM by itself controls it's own resources.
*/
public native void setFontDataOwnedByAtlas(boolean isFontDataOwnedByAtlas); /*
IM_FONT_CONFIG->FontDataOwnedByAtlas = isFontDataOwnedByAtlas;
*/
@BindingField
public boolean FontDataOwnedByAtlas;
/**
* Index of font within TTF/OTF file
*/
public native int getFontNo(); /*
return IM_FONT_CONFIG->FontNo;
*/
/**
* Index of font within TTF/OTF file
*/
public native void setFontNo(int fontNo); /*
IM_FONT_CONFIG->FontNo = fontNo;
*/
@BindingField
public int FontNo;
/**
* Size in pixels for rasterizer (more or less maps to the resulting font height).
*/
public native float getSizePixels(); /*
return IM_FONT_CONFIG->SizePixels;
*/
/**
* Size in pixels for rasterizer (more or less maps to the resulting font height).
*/
public native void setSizePixels(float sizePixels); /*
IM_FONT_CONFIG->SizePixels = sizePixels;
*/
@BindingField
public float SizePixels;
/**
* Rasterize at higher quality for sub-pixel positioning.
* Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory.
* Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
*/
public native int getOversampleH(); /*
return IM_FONT_CONFIG->OversampleH;
*/
/**
* Rasterize at higher quality for sub-pixel positioning.
* Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory.
* Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
*/
public native void setOversampleH(int oversampleH); /*
IM_FONT_CONFIG->OversampleH = oversampleH;
*/
@BindingField
public int OversampleH;
/**
* Rasterize at higher quality for sub-pixel positioning.
* This is not really useful as we don't use sub-pixel positions on the Y axis.
*/
public native int getOversampleV(); /*
return IM_FONT_CONFIG->OversampleV;
*/
/**
* Rasterize at higher quality for sub-pixel positioning.
* This is not really useful as we don't use sub-pixel positions on the Y axis.
*/
public native void setOversampleV(int oversampleV); /*
IM_FONT_CONFIG->OversampleV = oversampleV;
*/
@BindingField
public int OversampleV;
/**
* Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font.
* If enabled, you can set OversampleH/V to 1.
*/
public native boolean getPixelSnapH(); /*
return IM_FONT_CONFIG->PixelSnapH;
*/
/**
* Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font.
* If enabled, you can set OversampleH/V to 1.
*/
public native void setPixelSnapH(boolean isPixelSnapH); /*
IM_FONT_CONFIG->PixelSnapH = isPixelSnapH;
*/
@BindingField
public boolean PixelSnapH;
/**
* Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
*/
public ImVec2 getGlyphExtraSpacing() {
final ImVec2 value = new ImVec2();
getGlyphExtraSpacing(value);
return value;
}
/**
* Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
*/
public native void getGlyphExtraSpacing(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_FONT_CONFIG->GlyphExtraSpacing, dstImVec2);
*/
/**
* Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
*/
public native float getGlyphExtraSpacingX(); /*
return IM_FONT_CONFIG->GlyphExtraSpacing.x;
*/
/**
* Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
*/
public native float getGlyphExtraSpacingY(); /*
return IM_FONT_CONFIG->GlyphExtraSpacing.y;
*/
/**
* Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
*/
public native void setGlyphExtraSpacing(float x, float y); /*
IM_FONT_CONFIG->GlyphExtraSpacing.x = x;
IM_FONT_CONFIG->GlyphExtraSpacing.y = y;
*/
@BindingField
public ImVec2 GlyphExtraSpacing;
/**
* Offset all glyphs from this font input.
*/
public ImVec2 getGlyphOffset() {
final ImVec2 value = new ImVec2();
getGlyphOffset(value);
return value;
}
@BindingField
public ImVec2 GlyphOffset;
/**
* Offset all glyphs from this font input.
*/
public native void getGlyphOffset(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_FONT_CONFIG->GlyphOffset, dstImVec2);
*/
/**
* Offset all glyphs from this font input.
*/
public native float getGlyphOffsetX(); /*
return IM_FONT_CONFIG->GlyphOffset.x;
*/
/**
* Offset all glyphs from this font input.
*/
public native float getGlyphOffsetY(); /*
return IM_FONT_CONFIG->GlyphOffset.y;
*/
/**
* Offset all glyphs from this font input.
*/
public native void setGlyphOffset(float x, float y); /*
IM_FONT_CONFIG->GlyphOffset.x = x;
IM_FONT_CONFIG->GlyphOffset.y = y;
*/
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public short[] getGlyphRanges() {
return glyphRanges;
}
/**
* Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
*/
public void setGlyphRanges(final short[] glyphRanges) {
this.glyphRanges = glyphRanges;
nSetGlyphRanges(glyphRanges);
}
private native void nSetGlyphRanges(short[] glyphRanges); /*
IM_FONT_CONFIG->GlyphRanges = glyphRanges != NULL ? (ImWchar*)&glyphRanges[0] : NULL;
*/
// TODO: GlyphRanges
/**
* Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
*/
public native float getGlyphMinAdvanceX(); /*
return IM_FONT_CONFIG->GlyphMinAdvanceX;
*/
/**
* Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
*/
public native void setGlyphMinAdvanceX(float glyphMinAdvanceX); /*
IM_FONT_CONFIG->GlyphMinAdvanceX = glyphMinAdvanceX;
*/
@BindingField
public float GlyphMinAdvanceX;
/**
* Maximum AdvanceX for glyphs
*/
public native float getGlyphMaxAdvanceX(); /*
return IM_FONT_CONFIG->GlyphMaxAdvanceX;
*/
/**
* Maximum AdvanceX for glyphs
*/
public native void setGlyphMaxAdvanceX(float glyphMaxAdvanceX); /*
IM_FONT_CONFIG->GlyphMaxAdvanceX = glyphMaxAdvanceX;
*/
@BindingField
public float GlyphMaxAdvanceX;
/**
* Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs).
* You may want to use GlyphOffset.y when merge font of different heights.
*/
public native boolean getMergeMode(); /*
return IM_FONT_CONFIG->MergeMode;
*/
/**
* Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs).
* You may want to use GlyphOffset.y when merge font of different heights.
*/
public native void setMergeMode(boolean mergeMode); /*
IM_FONT_CONFIG->MergeMode = mergeMode;
*/
@BindingField
public boolean MergeMode;
/**
* Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
*/
public native int getFontBuilderFlags(); /*
return IM_FONT_CONFIG->FontBuilderFlags;
*/
/**
* Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
*/
public native void setFontBuilderFlags(int fontBuilderFlags); /*
IM_FONT_CONFIG->FontBuilderFlags = (unsigned int)fontBuilderFlags;
*/
@BindingField(isFlag = true)
public int FontBuilderFlags;
/**
* Brighten ({@code >}1.0f) or darken ({@code <}1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
*/
public native float getRasterizerMultiply(); /*
return IM_FONT_CONFIG->RasterizerMultiply;
*/
/**
* Brighten ({@code >}1.0f) or darken ({@code <}1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
*/
public native void setRasterizerMultiply(float rasterizerMultiply); /*
IM_FONT_CONFIG->RasterizerMultiply = rasterizerMultiply;
*/
@BindingField
public float RasterizerMultiply;
/**
* Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
*/
public native short getEllipsisChar(); /*
return (short)IM_FONT_CONFIG->EllipsisChar;
*/
/**
* Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
*/
public native void setEllipsisChar(int ellipsisChar); /*
IM_FONT_CONFIG->EllipsisChar = (ImWchar)ellipsisChar;
*/
@BindingField
public short EllipsisChar;
// [Internal]
@@ -350,6 +135,13 @@ public final class ImFontConfig extends ImGuiStructDestroyable {
* Name (strictly to ease debugging)
*/
public native void setName(String name); /*
strcpy(IM_FONT_CONFIG->Name, name);
strcpy(THIS->Name, name);
*/
@BindingField
public ImFont DstFont;
/*JNI
#undef THIS
*/
}
@@ -1,11 +1,14 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
/**
* Hold rendering data for one glyph.
* (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this)
*/
@BindingSource
public final class ImFontGlyph extends ImGuiStructDestroyable {
public ImFontGlyph() {
}
@@ -14,17 +17,16 @@ public final class ImFontGlyph extends ImGuiStructDestroyable {
super(ptr);
}
/*JNI
#include "_common.h"
#define IM_FONT_GLYPH ((ImFontGlyph*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImFontGlyph*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImFontGlyph());
*/
@@ -32,168 +34,76 @@ public final class ImFontGlyph extends ImGuiStructDestroyable {
/**
* Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops).
*/
public native int getColored(); /*
return (unsigned int)IM_FONT_GLYPH->Colored;
*/
/**
* Flag to indicate glyph is colored and should generally ignore tinting (make it usable with no shift on little-endian as this is used in loops).
*/
public native void setColored(int colored); /*
IM_FONT_GLYPH->Colored = (unsigned int)colored;
*/
@BindingField
public int Colored;
/**
* Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.
*/
public native int getVisible(); /*
return (unsigned int)IM_FONT_GLYPH->Visible;
*/
/**
* Flag to indicate glyph has no visible pixels (e.g. space). Allow early out when rendering.
*/
public native void setVisible(int visible); /*
IM_FONT_GLYPH->Visible = (unsigned int)visible;
*/
@BindingField
public int Visible;
/**
* 0x0000..0xFFFF
*/
public native int getCodepoint(); /*
return (unsigned int)IM_FONT_GLYPH->Codepoint;
*/
/**
* 0x0000..0xFFFF
*/
public native void setCodepoint(int codepoint); /*
IM_FONT_GLYPH->Codepoint = (unsigned int)codepoint;
*/
@BindingField
public int Codepoint;
/**
* Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)
*/
public native float getAdvanceX(); /*
return IM_FONT_GLYPH->AdvanceX;
*/
/**
* Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)
*/
public native void setAdvanceX(float advanceX); /*
IM_FONT_GLYPH->AdvanceX = advanceX;
*/
@BindingField
public float AdvanceX;
/**
* Glyph corners
*/
public native float getX0(); /*
return IM_FONT_GLYPH->X0;
*/
@BindingField
public float X0;
/**
* Glyph corners
*/
public native void setX0(float x0); /*
IM_FONT_GLYPH->X0 = x0;
*/
@BindingField
public float Y0;
/**
* Glyph corners
*/
public native float getY0(); /*
return IM_FONT_GLYPH->Y0;
*/
@BindingField
public float X1;
/**
* Glyph corners
*/
public native void setY0(float y0); /*
IM_FONT_GLYPH->Y0 = y0;
*/
/**
* Glyph corners
*/
public native float getX1(); /*
return IM_FONT_GLYPH->X1;
*/
/**
* Glyph corners
*/
public native void setX1(float x1); /*
IM_FONT_GLYPH->X1 = x1;
*/
/**
* Glyph corners
*/
public native float getY1(); /*
return IM_FONT_GLYPH->Y1;
*/
/**
* Glyph corners
*/
public native void setY1(float y1); /*
IM_FONT_GLYPH->Y1 = y1;
*/
@BindingField
public float Y1;
/**
* Texture coordinates
*/
public native float getU0(); /*
return IM_FONT_GLYPH->U0;
*/
@BindingField
public float U0;
/**
* Texture coordinates
*/
public native void setU0(float u0); /*
IM_FONT_GLYPH->U0 = u0;
*/
@BindingField
public float V0;
/**
* Texture coordinates
*/
public native float getV0(); /*
return IM_FONT_GLYPH->V0;
*/
@BindingField
public float U1;
/**
* Texture coordinates
*/
public native void setV0(float v0); /*
IM_FONT_GLYPH->V0 = v0;
*/
@BindingField
public float V1;
/**
* Texture coordinates
/*JNI
#undef THIS
*/
public native float getU1(); /*
return IM_FONT_GLYPH->U1;
*/
/**
* Texture coordinates
*/
public native void setU1(float u1); /*
IM_FONT_GLYPH->U1 = u1;
*/
/**
* Texture coordinates
*/
public native float getV1(); /*
return IM_FONT_GLYPH->V1;
*/
/**
* Texture coordinates
*/
public native void setV1(float v1); /*
IM_FONT_GLYPH->V1 = v1;
*/
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,9 @@
package imgui;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
/**
* Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used.<p>
@@ -13,6 +16,7 @@ import imgui.binding.ImGuiStruct;
* - ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.<p>
* - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow.<p>
*/
@BindingSource
public class ImGuiInputTextCallbackData extends ImGuiStruct {
public ImGuiInputTextCallbackData(final long ptr) {
super(ptr);
@@ -20,145 +24,71 @@ public class ImGuiInputTextCallbackData extends ImGuiStruct {
/*JNI
#include "_common.h"
#define IMGUI_CALLBACK_DATA ((ImGuiInputTextCallbackData*)STRUCT_PTR)
#define THIS ((ImGuiInputTextCallbackData*)STRUCT_PTR)
*/
/**
* One ImGuiInputTextFlags_Callback*
*
* @return ImGuiInputTextFlags
*/
public native int getEventFlag(); /*
return IMGUI_CALLBACK_DATA->EventFlag;
*/
@BindingField(isFlag = true, accessors = BindingField.Accessor.GETTER)
public int EventFlag;
/**
* What user passed to InputText()
*
* @return ImGuiInputTextFlags
*/
public native int getFlags(); /*
return IMGUI_CALLBACK_DATA->Flags;
*/
@BindingField(isFlag = true, accessors = BindingField.Accessor.GETTER)
public int Flags;
/**
* [CharFilter] Character input;
*
* @return Character input
*/
public native int getEventChar(); /*
return IMGUI_CALLBACK_DATA->EventChar;
*/
// TODO: UserData
/**
* [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0;
*
* @param c Replaced characters
*/
public void setEventChar(final char c) {
setEventChar((int) c);
}
/**
* [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0;
*
* @param c Replaced characters
*/
public native void setEventChar(int c); /*
IMGUI_CALLBACK_DATA->EventChar = c;
*/
@BindingField
public int EventChar;
/**
* [Completion,History]
*
* @return Key pressed (Up/Down/TAB)
*/
public native int getEventKey(); /*
return IMGUI_CALLBACK_DATA->EventKey;
*/
@BindingField(accessors = BindingField.Accessor.GETTER)
public int EventKey;
/**
* [Resize] Can replace pointer <p>
* [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!
*
* @return Buf
*/
public native String getBuf(); /*
return env->NewStringUTF(IMGUI_CALLBACK_DATA->Buf);
*/
@BindingField
public String Buf;
/**
* [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length()
*/
@BindingField
public int BufTextLen;
/**
* Set if you modify Buf/BufTextLen!
*
* @return Dirty
*/
public native boolean getBufDirty(); /*
return IMGUI_CALLBACK_DATA->BufDirty;
*/
/**
* Set if you modify Buf/BufTextLen!
*
* @param dirty Dirty
*/
public native void setBufDirty(boolean dirty); /*
IMGUI_CALLBACK_DATA->BufDirty = dirty;
*/
@BindingField
public boolean BufDirty;
/**
* Current cursor position
*
* @return Current cursor position
*/
public native int getCursorPos(); /*
return IMGUI_CALLBACK_DATA->CursorPos;
*/
/**
* Set the current cursor position
*
* @param pos Set the current cursor position
*/
public native void setCursorPos(int pos); /*
IMGUI_CALLBACK_DATA->CursorPos = pos;
*/
@BindingField
public int CursorPos;
/**
* Selection Start
*
* @return Selection Start
*/
public native int getSelectionStart(); /*
return IMGUI_CALLBACK_DATA->SelectionStart;
*/
/**
* Set Selection Start
*
* @param pos Selection Start
*/
public native void setSelectionStart(int pos); /*
IMGUI_CALLBACK_DATA->SelectionStart = pos;
*/
@BindingField
public int SelectionStart;
/**
* Selection End
*
* @return Selection End
*/
public native int getSelectionEnd(); /*
return IMGUI_CALLBACK_DATA->SelectionEnd;
*/
/**
* Set Selection End
*
* @param pos Selection End
*/
public native void setSelectionEnd(int pos); /*
IMGUI_CALLBACK_DATA->SelectionEnd = pos;
*/
@BindingField
public int SelectionEnd;
/**
* Delete Chars
@@ -166,9 +96,8 @@ public class ImGuiInputTextCallbackData extends ImGuiStruct {
* @param pos Start Delete Pos
* @param bytesCount Delete Char Count
*/
public native void deleteChars(int pos, int bytesCount); /*
IMGUI_CALLBACK_DATA->DeleteChars(pos, bytesCount);
*/
@BindingMethod
public native void DeleteChars(int pos, int bytesCount);
/**
* Insert Chars
@@ -176,7 +105,19 @@ public class ImGuiInputTextCallbackData extends ImGuiStruct {
* @param pos insert Psos
* @param str insert String
*/
public native void insertChars(int pos, String str); /*
IMGUI_CALLBACK_DATA->InsertChars(pos, str);
*/
@BindingMethod
public native void InsertChars(int pos, String str);
@BindingMethod
public native void SelectAll();
@BindingMethod
public native void ClearSelection();
@BindingMethod
public native boolean HasSelection();
/*JNI
#undef THIS
*/
}
@@ -1,11 +1,14 @@
package imgui;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
/**
* (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI.
* We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors.
*/
@BindingSource
public final class ImGuiPlatformMonitor extends ImGuiStruct {
public ImGuiPlatformMonitor(final long ptr) {
super(ptr);
@@ -13,138 +16,42 @@ public final class ImGuiPlatformMonitor extends ImGuiStruct {
/*JNI
#include "_common.h"
#define IMGUI_PLATFORM_MONITOR ((ImGuiPlatformMonitor*)STRUCT_PTR)
#define THIS ((ImGuiPlatformMonitor*)STRUCT_PTR)
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native void getMainPos(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_PLATFORM_MONITOR->MainPos, dstImVec2);
*/
@BindingField
public ImVec2 MainPos;
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native float getMainPosX(); /*
return IMGUI_PLATFORM_MONITOR->MainPos.x;
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native float getMainPosY(); /*
return IMGUI_PLATFORM_MONITOR->MainPos.y;
*/
public native void setMainPos(float x, float y); /*
IMGUI_PLATFORM_MONITOR->MainPos = ImVec2(x, y);
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native void getMainSize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_PLATFORM_MONITOR->MainSize, dstImVec2);
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native float getMainSizeX(); /*
return IMGUI_PLATFORM_MONITOR->MainSize.x;
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native float getMainSizeY(); /*
return IMGUI_PLATFORM_MONITOR->MainSize.y;
*/
/**
* Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right)
*/
public native void setMainSize(float x, float y); /*
IMGUI_PLATFORM_MONITOR->MainSize = ImVec2(x, y);
*/
@BindingField
public ImVec2 MainSize;
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native void getWorkPos(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_PLATFORM_MONITOR->WorkPos, dstImVec2);
*/
@BindingField
public ImVec2 WorkPos;
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native float getWorkPosX(); /*
return IMGUI_PLATFORM_MONITOR->WorkPos.x;
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native float getWorkPosY(); /*
return IMGUI_PLATFORM_MONITOR->WorkPos.y;
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native void setWorkPos(float x, float y); /*
IMGUI_PLATFORM_MONITOR->WorkPos = ImVec2(x, y);
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native void getWorkSize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_PLATFORM_MONITOR->WorkSize, dstImVec2);
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native float getWorkSizeX(); /*
return IMGUI_PLATFORM_MONITOR->WorkSize.x;
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native float getWorkSizeY(); /*
return IMGUI_PLATFORM_MONITOR->WorkSize.y;
*/
/**
* Coordinates without task bars / side bars / menu bars.
* Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize.
*/
public native void setWorkSize(float x, float y); /*
IMGUI_PLATFORM_MONITOR->WorkSize = ImVec2(x, y);
*/
@BindingField
public ImVec2 WorkSize;
/**
* 1.0f = 96 DPI
*/
public native float getDpiScale(); /*
return IMGUI_PLATFORM_MONITOR->DpiScale;
*/
@BindingField
public float DpiScale;
/**
* 1.0f = 96 DPI
/*JNI
#undef THIS
*/
public native void setDpiScale(float dpiScale); /*
IMGUI_PLATFORM_MONITOR->DpiScale = dpiScale;
*/
}
@@ -1,6 +1,9 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
/**
* Helper: Key-Value storage
@@ -12,6 +15,7 @@ import imgui.binding.ImGuiStructDestroyable;
* - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient)
* Types are NOT stored, so it is up to you to make sure your Key don't collide with different types.
*/
@BindingSource
public final class ImGuiStorage extends ImGuiStructDestroyable {
public ImGuiStorage() {
}
@@ -20,17 +24,16 @@ public final class ImGuiStorage extends ImGuiStructDestroyable {
super(ptr);
}
/*JNI
#include "_common.h"
#define IMGUI_STORAGE ((ImGuiStorage*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImGuiStorage*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImGuiStorage());
*/
@@ -39,57 +42,40 @@ public final class ImGuiStorage extends ImGuiStructDestroyable {
// - Set***() functions find pair, insertion on demand if missing.
// - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair.
public native void clear(); /*
IMGUI_STORAGE->Clear();
*/
@BindingMethod
public native void Clear();
public native int getInt(int imGuiID); /*
return IMGUI_STORAGE->GetInt(imGuiID);
*/
@BindingMethod
public native int GetInt(int key, @OptArg int defaultVal);
public native int getInt(int imGuiID, int defaultVal); /*
return IMGUI_STORAGE->GetInt(imGuiID, defaultVal);
*/
@BindingMethod
public native void SetInt(int key, int val);
public native void setInt(int imGuiID, int val); /*
IMGUI_STORAGE->SetInt(imGuiID, val);
*/
@BindingMethod
public native boolean GetBool(int key, @OptArg boolean defaultVal);
public native boolean getBool(int imGuiID); /*
return IMGUI_STORAGE->GetBool(imGuiID);
*/
@BindingMethod
public native void SetBool(int key, boolean val);
public native boolean getBool(int imGuiID, boolean defaultVal); /*
return IMGUI_STORAGE->GetBool(imGuiID, defaultVal);
*/
@BindingMethod
public native float GetFloat(int key, @OptArg float defaultVal);
public native void setBool(int imGuiID, boolean val); /*
IMGUI_STORAGE->SetBool(imGuiID, val);
*/
public native float getFloat(int imGuiID); /*
return IMGUI_STORAGE->GetFloat(imGuiID);
*/
public native float getFloat(int imGuiID, float defaultVal); /*
return IMGUI_STORAGE->GetFloat(imGuiID, defaultVal);
*/
public native void setFloat(int imGuiID, float val); /*
IMGUI_STORAGE->SetFloat(imGuiID, val);
*/
@BindingMethod
public native void SetFloat(int key, float val);
/**
* Use on your own storage if you know only integer are being stored (open/close all tree nodes)
*/
public native void setAllInt(int val); /*
IMGUI_STORAGE->SetAllInt(val);
*/
@BindingMethod
public native void SetAllInt(int val);
/**
* For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.
*/
public native void buildSortByKey(); /*
IMGUI_STORAGE->BuildSortByKey();
*/
@BindingMethod
public native void BuildSortByKey();
/*JNI
#undef THIS
*/
}
File diff suppressed because it is too large. Load diff
@@ -1,10 +1,15 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
/**
* Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
*/
@BindingSource
public final class ImGuiTextFilter extends ImGuiStructDestroyable {
public ImGuiTextFilter() {
this("");
@@ -14,58 +19,51 @@ public final class ImGuiTextFilter extends ImGuiStructDestroyable {
ptr = nCreate(defaultFilter);
}
ImGuiTextFilter(final long ptr) {
public ImGuiTextFilter(final long ptr) {
super(ptr);
}
/*JNI
#include "_common.h"
#define IMGUI_TEXT_FILTER ((ImGuiTextFilter*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate("");
}
/*JNI
#include "_common.h"
#define THIS ((ImGuiTextFilter*)STRUCT_PTR)
*/
private native long nCreate(String defaultFilter); /*
return (intptr_t)(new ImGuiTextFilter(defaultFilter));
*/
public boolean draw() {
return draw("Filter (inc,-exc)");
}
@BindingMethod
public native boolean Draw(@OptArg(callValue = "\"Filter (inc,-exc)\"") String label, @OptArg float width);
public boolean draw(final String label) {
return draw(label, 0f);
}
@BindingMethod
public native boolean PassFilter(String text, Void NULL);
public native boolean draw(String label, float width); /*
return IMGUI_TEXT_FILTER->Draw(label, width);
*/
@BindingMethod
public native void Build();
public native boolean passFilter(String text); /*
return IMGUI_TEXT_FILTER->PassFilter(text);
*/
@BindingMethod
public native void Clear();
public native void build(); /*
IMGUI_TEXT_FILTER->Build();
*/
public native void clear(); /*
IMGUI_TEXT_FILTER->Clear();
*/
public native boolean isActive(); /*
return IMGUI_TEXT_FILTER->IsActive();
*/
@BindingMethod
public native boolean IsActive();
public native String getInputBuffer(); /*
return env->NewStringUTF(IMGUI_TEXT_FILTER->InputBuf);
return env->NewStringUTF(THIS->InputBuf);
*/
public native void setInputBuffer(String inputBuffer); /*
strncpy(IMGUI_TEXT_FILTER->InputBuf, inputBuffer, sizeof(IMGUI_TEXT_FILTER->InputBuf));
public native void setInputBuffer(String inputBuf); /*
strncpy(THIS->InputBuf, inputBuf, sizeof(THIS->InputBuf));
*/
@BindingField
public int CountGrep;
/*JNI
#undef THIS
*/
}
@@ -1,261 +1,80 @@
package imgui;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.ReturnValue;
/**
* The viewports created and managed by Dear ImGui. The role of the platform backend is to create the platform/OS windows corresponding to each viewport.
* - Main Area = entire viewport.
* - Work Area = entire viewport minus sections optionally used by menu bars, status bars. Some positioning code will prefer to use this. Window are also trying to stay within this area.
*/
@BindingSource
public final class ImGuiViewport extends ImGuiStruct {
private static final ImDrawData DRAW_DATA = new ImDrawData(0);
public ImGuiViewport(final long ptr) {
super(ptr);
}
/*JNI
#include "_common.h"
#define IMGUI_VIEWPORT ((ImGuiViewport*)STRUCT_PTR)
#define THIS ((ImGuiViewport*)STRUCT_PTR)
*/
/**
* Unique identifier for the viewport.
*/
public native int getID(); /*
return IMGUI_VIEWPORT->ID;
*/
/**
* Unique identifier for the viewport.
*/
public native void setID(int imGuiID); /*
IMGUI_VIEWPORT->ID = imGuiID;
*/
@BindingField
public int ID;
/**
* See {@link imgui.flag.ImGuiViewportFlags}.
*/
public native int getFlags(); /*
return IMGUI_VIEWPORT->Flags;
*/
/**
* See {@link imgui.flag.ImGuiViewportFlags}.
*/
public native void setFlags(int flags); /*
IMGUI_VIEWPORT->Flags = flags;
*/
/**
* See {@link imgui.flag.ImGuiViewportFlags}.
*/
public void addFlags(final int flags) {
setFlags(getFlags() | flags);
}
/**
* See {@link imgui.flag.ImGuiViewportFlags}.
*/
public void removeFlags(final int flags) {
setFlags(getFlags() & ~(flags));
}
/**
* See {@link imgui.flag.ImGuiViewportFlags}.
*/
public boolean hasFlags(final int flags) {
return (getFlags() & flags) != 0;
}
@BindingField(isFlag = true)
public int Flags;
/**
* Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates).
*/
public ImVec2 getPos() {
final ImVec2 value = new ImVec2();
getPos(value);
return value;
}
/**
* Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates).
*/
public native void getPos(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_VIEWPORT->Pos, dstImVec2);
*/
/**
* Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates).
*/
public native float getPosX(); /*
return IMGUI_VIEWPORT->Pos.x;
*/
/**
* Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates).
*/
public native float getPosY(); /*
return IMGUI_VIEWPORT->Pos.y;
*/
/**
* Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates).
*/
public native void setPos(float x, float y); /*
IMGUI_VIEWPORT->Pos = ImVec2(x, y);
*/
@BindingField
public ImVec2 Pos;
/**
* Main Area: Size of the viewport.
*/
public ImVec2 getSize() {
final ImVec2 value = new ImVec2();
getSize(value);
return value;
}
/**
* Main Area: Size of the viewport.
*/
public native void getSize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IMGUI_VIEWPORT->Size, dstImVec2);
*/
/**
* Main Area: Size of the viewport.
*/
public native float getSizeX(); /*
return IMGUI_VIEWPORT->Size.x;
*/
/**
* Main Area: Size of the viewport.
*/
public native float getSizeY(); /*
return IMGUI_VIEWPORT->Size.y;
*/
/**
* Main Area: Size of the viewport.
*/
public native void seSize(float x, float y); /*
IMGUI_VIEWPORT->Size = ImVec2(x, y);
*/
@BindingField
public ImVec2 Size;
/**
* Work Area: Position of the viewport minus task bars, menus bars, status bars.
*/
public ImVec2 getWorkPos() {
final ImVec2 value = new ImVec2();
getWorkPos(value);
return value;
}
/**
* Work Area: Position of the viewport minus task bars, menus bars, status bars.
*/
public native void getWorkPos(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IMGUI_VIEWPORT->WorkPos, dstImVec2);
*/
/**
* Work Area: Position of the viewport minus task bars, menus bars, status bars.
*/
public native float getWorkPosX(); /*
return IMGUI_VIEWPORT->WorkPos.x;
*/
/**
* Work Area: Position of the viewport minus task bars, menus bars, status bars.
*/
public native float getWorkPosY(); /*
return IMGUI_VIEWPORT->WorkPos.y;
*/
/**
* Work Area: Position of the viewport minus task bars, menus bars, status bars.
*/
public native void setWorkPos(float x, float y); /*
IMGUI_VIEWPORT->WorkPos = ImVec2(x, y);
*/
@BindingField
public ImVec2 WorkPos;
/**
* Work Area: Size of the viewport minus task bars, menu bars, status bars.
*/
public ImVec2 getWorkSize() {
final ImVec2 value = new ImVec2();
getWorkSize(value);
return value;
}
/**
* Work Area: Size of the viewport minus task bars, menu bars, status bars.
*/
public native void getWorkSize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IMGUI_VIEWPORT->WorkSize, dstImVec2);
*/
/**
* Work Area: Size of the viewport minus task bars, menu bars, status bars.
*/
public native float getWorkSizeX(); /*
return IMGUI_VIEWPORT->WorkSize.x;
*/
/**
* Work Area: Size of the viewport minus task bars, menu bars, status bars.
*/
public native float getWorkSizeY(); /*
return IMGUI_VIEWPORT->WorkSize.y;
*/
/**
* Work Area: Size of the viewport minus task bars, menu bars, status bars.
*/
public native void setWorkSize(float x, float y); /*
IMGUI_VIEWPORT->WorkSize = ImVec2(x, y);
*/
@BindingField
public ImVec2 WorkSize;
/**
* 1.0f = 96 DPI = No extra scale.
*/
public native float getDpiScale(); /*
return IMGUI_VIEWPORT->DpiScale;
*/
/**
* 1.0f = 96 DPI = No extra scale.
*/
public native void setDpiScale(float dpiScale); /*
IMGUI_VIEWPORT->DpiScale = dpiScale;
*/
@BindingField
public float DpiScale;
/**
* (Advanced) 0: no parent. Instruct the platform backend to setup a parent/child relationship between platform windows.
*/
public native int getParentViewportId(); /*
return IMGUI_VIEWPORT->ParentViewportId;
*/
/**
* (Advanced) 0: no parent. Instruct the platform backend to setup a parent/child relationship between platform windows.
*/
public native void setParentViewportId(int parentViewportId); /*
IMGUI_VIEWPORT->ParentViewportId = parentViewportId;
*/
@BindingField
public int ParentViewportId;
/**
* The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame().
*/
public ImDrawData getDrawData() {
DRAW_DATA.ptr = nGetDrawData();
return DRAW_DATA;
}
private native long nGetDrawData(); /*
return (intptr_t)IMGUI_VIEWPORT->DrawData;
*/
@BindingField
public ImDrawData DrawData;
// Our design separate the Renderer and Platform backends to facilitate combining default backends with each others.
// When our create your own backend for a custom engine, it is possible that both Renderer and Platform will be handled
@@ -266,141 +85,91 @@ public final class ImGuiViewport extends ImGuiStruct {
* void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.). generally set by your Renderer_CreateWindow function.
*/
public native void setRendererUserData(Object data); /*
if (IMGUI_VIEWPORT->RendererUserData != NULL) {
env->DeleteGlobalRef((jobject)IMGUI_VIEWPORT->RendererUserData);
if (THIS->RendererUserData != NULL) {
env->DeleteGlobalRef((jobject)THIS->RendererUserData);
}
IMGUI_VIEWPORT->RendererUserData = (data == NULL ? NULL : (void*)env->NewGlobalRef(data));
THIS->RendererUserData = (data == NULL ? NULL : (void*)env->NewGlobalRef(data));
*/
/**
* void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.). generally set by your Renderer_CreateWindow function.
*/
public native Object getRendererUserData(); /*
return (jobject)IMGUI_VIEWPORT->RendererUserData;
return (jobject)THIS->RendererUserData;
*/
/**
* void* to hold custom data structure for the OS / platform (e.g. windowing info, render context). generally set by your Platform_CreateWindow function.
*/
public native void setPlatformUserData(Object data); /*
if (IMGUI_VIEWPORT->PlatformUserData != NULL) {
env->DeleteGlobalRef((jobject)IMGUI_VIEWPORT->PlatformUserData);
if (THIS->PlatformUserData != NULL) {
env->DeleteGlobalRef((jobject)THIS->PlatformUserData);
}
IMGUI_VIEWPORT->PlatformUserData = (data == NULL ? NULL : (void*)env->NewGlobalRef(data));
THIS->PlatformUserData = (data == NULL ? NULL : (void*)env->NewGlobalRef(data));
*/
/**
* void* to hold custom data structure for the OS / platform (e.g. windowing info, render context). generally set by your Platform_CreateWindow function.
*/
public native Object getPlatformUserData(); /*
return (jobject)IMGUI_VIEWPORT->PlatformUserData;
return (jobject)THIS->PlatformUserData;
*/
/**
* void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*)
*/
public native void setPlatformHandle(long data); /*
IMGUI_VIEWPORT->PlatformHandle = (void*)data;
THIS->PlatformHandle = (void*)data;
*/
/**
* void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*)
*/
public native long getPlatformHandle(); /*
return (intptr_t)IMGUI_VIEWPORT->PlatformHandle;
return (intptr_t)THIS->PlatformHandle;
*/
/**
* void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*)
*/
public native void setPlatformHandleRaw(long data); /*
IMGUI_VIEWPORT->PlatformHandleRaw = (void*)data;
THIS->PlatformHandleRaw = (void*)data;
*/
/**
* void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*)
*/
public native long getPlatformHandleRaw(); /*
return (intptr_t)IMGUI_VIEWPORT->PlatformHandleRaw;
return (intptr_t)THIS->PlatformHandleRaw;
*/
/**
* Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position).
*/
public native boolean getPlatformRequestMove(); /*
return IMGUI_VIEWPORT->PlatformRequestMove;
*/
/**
* Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position).
*/
public native void setPlatformRequestMove(boolean platformRequestMove); /*
IMGUI_VIEWPORT->PlatformRequestMove = platformRequestMove;
*/
@BindingField
public boolean PlatformRequestMove;
/**
* Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size).
*/
public native boolean getPlatformRequestResize(); /*
return IMGUI_VIEWPORT->PlatformRequestResize;
*/
/**
* Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size).
*/
public native void setPlatformRequestResize(boolean platformRequestResize); /*
IMGUI_VIEWPORT->PlatformRequestResize = platformRequestResize;
*/
@BindingField
public boolean PlatformRequestResize;
/**
* Platform window requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4).
*/
public native boolean getPlatformRequestClose(); /*
return IMGUI_VIEWPORT->PlatformRequestClose;
*/
/**
* Platform window requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4).
*/
public native void setPlatformRequestClose(boolean platformRequestClose); /*
IMGUI_VIEWPORT->PlatformRequestClose = platformRequestClose;
*/
@BindingField
public boolean PlatformRequestClose;
// Helpers
public ImVec2 getCenter() {
final ImVec2 value = new ImVec2();
getCenter(value);
return value;
}
@BindingMethod
public native ImVec2 GetCenter();
public native void getCenter(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IMGUI_VIEWPORT->GetCenter(), dstImVec2);
*/
@BindingMethod
public native ImVec2 GetWorkCenter();
public native float getCenterX(); /*
return IMGUI_VIEWPORT->GetCenter().x;
*/
public native float getCenterY(); /*
return IMGUI_VIEWPORT->GetCenter().y;
*/
public ImVec2 getWorkCenter() {
final ImVec2 value = new ImVec2();
getWorkCenter(value);
return value;
}
public native void getWorkCenter(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, IMGUI_VIEWPORT->GetWorkCenter(), dstImVec2);
*/
public native float getWorkCenterX(); /*
return IMGUI_VIEWPORT->GetWorkCenter().x;
*/
public native float getWorkCenterY(); /*
return IMGUI_VIEWPORT->GetWorkCenter().y;
*/
/*JNI
#undef THIS
*/
}
@@ -1,6 +1,8 @@
package imgui;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
/**
* [ALPHA] Rarely used / very advanced uses only. Use with SetNextWindowClass() and DockSpace() functions.
@@ -11,6 +13,7 @@ import imgui.binding.ImGuiStructDestroyable;
* - To the platform backend for OS level parent/child relationships of viewport.
* - To the docking system for various options and filtering.
*/
@BindingSource
public final class ImGuiWindowClass extends ImGuiStructDestroyable {
public ImGuiWindowClass() {
}
@@ -19,17 +22,16 @@ public final class ImGuiWindowClass extends ImGuiStructDestroyable {
super(ptr);
}
/*JNI
#include "_common.h"
#define IMGUI_WINDOW_CLASS ((ImGuiWindowClass*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#define THIS ((ImGuiWindowClass*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ImGuiWindowClass());
*/
@@ -37,143 +39,57 @@ public final class ImGuiWindowClass extends ImGuiStructDestroyable {
/**
* User data. 0 = Default class (unclassed). Windows of different classes cannot be docked with each others.
*/
public native int geClassId(); /*
return IMGUI_WINDOW_CLASS->ClassId;
*/
/**
* User data. 0 = Default class (unclassed). Windows of different classes cannot be docked with each others.
*/
public native void setClassId(int classId); /*
IMGUI_WINDOW_CLASS->ClassId = classId;
*/
@BindingField
public int ClassId;
/**
* Hint for the platform backend. If non-zero, the platform backend can create a parent{@code <>}child relationship between the platform windows.
* Not conforming backends are free to e.g. parent every viewport to the main viewport or not.
*/
public native int getParentViewportId(); /*
return IMGUI_WINDOW_CLASS->ParentViewportId;
*/
/**
* Hint for the platform backend. If non-zero, the platform backend can create a parent{@code <>}child relationship between the platform windows.
* Not conforming backends are free to e.g. parent every viewport to the main viewport or not.
*/
public native void setParentViewportId(int parentViewportId); /*
IMGUI_WINDOW_CLASS->ParentViewportId = parentViewportId;
*/
@BindingField
public int ParentViewportId;
/**
* Viewport flags to set when a window of this class owns a viewport.
* This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
*/
public native int getViewportFlagsOverrideSet(); /*
return IMGUI_WINDOW_CLASS->ViewportFlagsOverrideSet;
*/
/**
* Viewport flags to set when a window of this class owns a viewport.
* This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
*/
public native void setViewportFlagsOverrideSet(int viewportFlagsOverrideSet); /*
IMGUI_WINDOW_CLASS->ViewportFlagsOverrideSet = viewportFlagsOverrideSet;
*/
@BindingField(isFlag = true)
public int ViewportFlagsOverrideSet;
/**
* Viewport flags to clear when a window of this class owns a viewport.
* This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
*/
public native int getViewportFlagsOverrideClear(); /*
return IMGUI_WINDOW_CLASS->ViewportFlagsOverrideClear;
*/
/**
* Viewport flags to clear when a window of this class owns a viewport.
* This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis.
*/
public native void setViewportFlagsOverrideClear(int viewportFlagsOverrideClear); /*
IMGUI_WINDOW_CLASS->ViewportFlagsOverrideClear = viewportFlagsOverrideClear;
*/
@BindingField(isFlag = true)
public int ViewportFlagsOverrideClear;
/**
* [EXPERIMENTAL] TabItem flags to set when a window of this class gets submitted into a dock node tab bar.
* May use with ImGuiTabItemFlags_Leading or ImGuiTabItemFlags_Trailing.
*/
public native int getTabItemFlagsOverrideSet(); /*
return IMGUI_WINDOW_CLASS->TabItemFlagsOverrideSet;
*/
/**
* [EXPERIMENTAL] TabItem flags to set when a window of this class gets submitted into a dock node tab bar.
* May use with ImGuiTabItemFlags_Leading or ImGuiTabItemFlags_Trailing.
*/
public native void setTabItemFlagsOverrideSet(int tabItemFlagsOverrideSet); /*
IMGUI_WINDOW_CLASS->TabItemFlagsOverrideSet = tabItemFlagsOverrideSet;
*/
@BindingField(isFlag = true)
public int TabItemFlagsOverrideSet;
/**
* [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
*/
public native int getDockNodeFlagsOverrideSet(); /*
return IMGUI_WINDOW_CLASS->DockNodeFlagsOverrideSet;
*/
/**
* [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
*/
public native void setDockNodeFlagsOverrideSet(int dockNodeFlagsOverrideSet); /*
IMGUI_WINDOW_CLASS->DockNodeFlagsOverrideSet = dockNodeFlagsOverrideSet;
*/
/**
* [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
*/
public void addDockNodeFlagsOverrideSet(final int flags) {
setDockNodeFlagsOverrideSet(getDockNodeFlagsOverrideSet() | flags);
}
/**
* [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
*/
public void removeDockNodeFlagsOverrideSet(final int flags) {
setDockNodeFlagsOverrideSet(getDockNodeFlagsOverrideSet() & ~(flags));
}
/**
* [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!)
*/
public boolean hasDockNodeFlagsOverrideSet(final int flags) {
return (getDockNodeFlagsOverrideSet() & flags) != 0;
}
@BindingField(isFlag = true)
public int DockNodeFlagsOverrideSet;
/**
* Set to true to enforce single floating windows of this class always having their own docking node
* (equivalent of setting the global io.ConfigDockingAlwaysTabBar)
*/
public native boolean getDockingAlwaysTabBar(); /*
return IMGUI_WINDOW_CLASS->DockingAlwaysTabBar;
*/
/**
* Set to true to enforce single floating windows of this class always having their own docking node
* (equivalent of setting the global io.ConfigDockingAlwaysTabBar)
*/
public native void setDockingAlwaysTabBar(boolean dockingAlwaysTabBar); /*
IMGUI_WINDOW_CLASS->DockingAlwaysTabBar = dockingAlwaysTabBar;
*/
@BindingField
public boolean DockingAlwaysTabBar;
/**
* Set to true to allow windows of this class to be docked/merged with an unclassed window.
*/
public native boolean getDockingAllowUnclassed(); /*
return IMGUI_WINDOW_CLASS->DockingAllowUnclassed;
*/
@BindingField
public boolean DockingAllowUnclassed;
/**
* Set to true to allow windows of this class to be docked/merged with an unclassed window.
/*JNI
#undef THIS
*/
public native void setDockingAllowUnclassed(boolean dockingAllowUnclassed); /*
IMGUI_WINDOW_CLASS->DockingAllowUnclassed = dockingAllowUnclassed;
*/
}
@@ -17,7 +17,7 @@ public final class ImVec2 implements Cloneable {
}
public ImVec2(final ImVec2 value) {
this(value.x, value.y);
set(value.x, value.y);
}
public ImVec2 set(final float x, final float y) {
@@ -19,7 +19,7 @@ public final class ImVec4 implements Cloneable {
}
public ImVec4(final ImVec4 value) {
this(value.x, value.y, value.z, value.w);
set(value.x, value.y, value.z, value.w);
}
public ImVec4 set(final float x, final float y, final float z, final float w) {
@@ -0,0 +1,39 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Provides an additional metadata for the argument value.
*/
@ExcludedSource
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.SOURCE)
public @interface ArgValue {
/**
* Defines a prefix which will be appended to the call on JNI side.
*/
String callPrefix() default "";
/**
* Defines a prefix which will be added to the call on JNI side.
*/
String callSuffix() default "";
/**
* Defines what will be called on the native side instead of passing actual argument.
*/
String callValue() default "";
/**
* Defines a value to cast with "static_cast" function.
*/
String staticCast() default "";
/**
* Defines a value to cast with "reinterpret_cast" function.
*/
String reinterpretCast() default "";
}
@@ -0,0 +1,38 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Should be applied to a marker field. Provides metadata to generate "enum-like" values from the AST tree.
* Marker field replaced with generated fields.
*/
@ExcludedSource
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface BindingAstEnum {
/**
* AST file name to get the information.
*/
String file();
/**
* Enum qualType to use for generation.
*/
String qualType();
/**
* If provided, will be used to sanitize provided value from enum names.
* Required for cases, when enum has one definition, but the value has different prefix.
*
* <p>Example:
* <code>
* enum ImGuiDockNodeFlagsPrivate_ {
* ImGuiDockNodeFlags_DockSpace
* }
* </code>
*/
String sanitizeName() default "";
}
@@ -0,0 +1,34 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* The marked method will be used as a metadata provider for generating binding methods.
*/
@ExcludedSource
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface BindingField {
/**
* Accessors to generate for field.
*/
Accessor[] accessors() default {Accessor.SETTER, Accessor.GETTER};
enum Accessor {
SETTER,
GETTER;
}
/**
* When true, additions util methods will be generated for field configuration.
*/
boolean isFlag() default false;
/**
* Name of the method which will be used to call native API.
*/
String callName() default "";
}
@@ -0,0 +1,24 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* The marked method will be used as a metadata provider for generating binding methods.
*/
@ExcludedSource
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface BindingMethod {
/**
* Name of the generated method on JVM side.
*/
String name() default "";
/**
* Name of the method which will be used to call native API.
*/
String callName() default "";
}
@@ -0,0 +1,25 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marks the class as a source for binding generation.
* Will be parsed for additional metadata, like information about {@link BindingMethod} etc.
*/
@ExcludedSource
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface BindingSource {
/**
* Native pointer to use to do calls to the API.
*/
String callPtr() default "";
/**
* Operator to call native pointer.
*/
String callOperator() default "";
}
@@ -0,0 +1,12 @@
package imgui.binding.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* This annotation is used as a marker to exclude source code from the final binding generation.
*/
@ExcludedSource
@Retention(RetentionPolicy.SOURCE)
public @interface ExcludedSource {
}
@@ -0,0 +1,26 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Used in conjunction with {@link BindingMethod} to indicate that the generated method parameter is optional.
*/
@ExcludedSource
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.SOURCE)
public @interface OptArg {
/**
* Used to define this default value. An additional method is generated without the annotated parameter on the
* Java side, automatically passing the value specified in `callValue` to the native method.
* <p><b>Constraints:</b>
* <ul>
* <li>The `callValue` field should not be used on parameters that precede other
* optional parameters of the same type to avoid type collision.</li>
* <li>Ensure that the value in `callValue` is compatible with the parameter type.</li>
* </ul>
*/
String callValue() default "";
}
@@ -0,0 +1,32 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Provides an additional metadata for the return value.
*/
@ExcludedSource
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.SOURCE)
public @interface ReturnValue {
/**
* When provided, value returned at the JNI side will have an additional prefix.
* Helpfully to do type casts etc.
*/
String callPrefix() default "";
/**
* When provided, value returned at the JNI side will have an additional suffix.
* Helpfully to call additional methods.
*/
String callSuffix() default "";
/**
* When true, returned struct pointer will be passed to the static field.
* Should be used for global and immutable by their nature structs.
*/
boolean isStatic() default false;
}
@@ -0,0 +1,24 @@
package imgui.binding.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Provides a metadata for the primitive array type value.
*/
@ExcludedSource
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
public @interface TypeArray {
/**
* Array type.
*/
String type();
/**
* Array size.
*/
String size();
}
@@ -1,41 +1,43 @@
package imgui.extension.imguifiledialog;
import imgui.ImVec2;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
import imgui.extension.imguifiledialog.callback.ImGuiFileDialogPaneFun;
import java.util.HashMap;
/**
* ImGuiFileDialog extension for ImGui
* Repo: https://github.com/aiekick/ImGuiFileDialog
* Repo: <a href="https://github.com/aiekick/ImGuiFileDialog">https://github.com/aiekick/ImGuiFileDialog</a>
*/
@BindingSource(callPtr = "ImGuiFileDialog::Instance()", callOperator = "->")
public final class ImGuiFileDialog {
private ImGuiFileDialog() {
}
/*JNI
#include "_imguifiledialog.h"
jobject imgfdPaneFunCallback = NULL;
const void paneFunCallback(const char* filter, void* user_data, bool* can_we_continue) {
if (imgfdPaneFunCallback != NULL) {
JNIEnv* env = Jni::GetEnv();
std::string vKey = ImGuiFileDialog::Instance()->GetOpenedKey();
jlong ret_user_datas = reinterpret_cast<jlong>(user_data);
Jni::CallImGuiFileDialogPaneFun(env, imgfdPaneFunCallback, filter, ret_user_datas, *can_we_continue);
static auto PaneFunCallback(JNIEnv* env, jobject fn) {
static jobject cb = NULL;
if (cb != NULL) {
env->DeleteGlobalRef(cb);
}
cb = env->NewGlobalRef(fn);
return [](const char* filter, void* userData, bool* canWeContinue) {
if (cb != NULL) {
Jni::CallImGuiFileDialogPaneFun(Jni::GetEnv(), cb, filter, reinterpret_cast<jlong>(userData), *canWeContinue);
}
};
}
#define IMGFD_PANE_FUN_METHOD_TMPL()\
if (imgfdPaneFunCallback != NULL) {\
env->DeleteGlobalRef(imgfdPaneFunCallback);\
}\
imgfdPaneFunCallback = env->NewGlobalRef(vSidePane);
*/
/**
* open simple dialog (path and fileName can be specified)
* Open simple dialog (path and fileName can be specified)
*
* @param vKey key dialog
* @param vTitle title
@@ -46,31 +48,57 @@ public final class ImGuiFileDialog {
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
public static native void openDialog(String vKey, String vTitle, String vFilters, String vPath, String vFileName,
int vCountSelectionMax, long vUserDatas, int vFlags); /*MANUAL
@BindingMethod
public static native void OpenDialog(String vKey, String vTitle, String vFilters, String vPath, String vFileName, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
char* vKey = (char*)env->GetStringUTFChars(obj_vKey, 0);
char* vTitle = (char*)env->GetStringUTFChars(obj_vTitle, 0);
char* vPath = (char*)env->GetStringUTFChars(obj_vPath, 0);
char* vFileName = (char*)env->GetStringUTFChars(obj_vFileName, 0);
/**
* Open simple dialog (path and filename are obtained from filePathName)
*
* @param vKey key dialog
* @param vTitle title
* @param vFilters filters (in comma separated form i.e. ".png,.jpg" or ".*") or null for directories
* @param vFilePathName file path name (will be decompsoed in path and fileName)
* @param vCountSelectionMax count selection max
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
@BindingMethod
public static native void OpenDialog(String vKey, String vTitle, String vFilters, String vFilePathName, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
if (env->IsSameObject(obj_vFilters, NULL)) {
ImGuiFileDialog::Instance()->OpenDialog(vKey, vTitle, nullptr, vPath, vFileName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
} else {
char* vFilters = (char*)env->GetStringUTFChars(obj_vFilters, JNI_FALSE);
ImGuiFileDialog::Instance()->OpenDialog(vKey, vTitle, vFilters, vPath, vFileName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
env->ReleaseStringUTFChars(obj_vFilters, vFilters);
}
/**
* Open dialog with custom right pane (path and fileName can be specified)
*
* @param vKey key dialog
* @param vTitle title
* @param vFilters filters (in comma separated form i.e. ".png,.jpg" or ".*") or null for directories
* @param vPath path
* @param vFileName default file name
* @param vSidePane side pane
* @param vCountSelectionMax count selection max
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
@BindingMethod
public static native void OpenDialog(String vKey, String vTitle, String vFilters, String vPath, String vFileName, @ArgValue(callValue = "PaneFunCallback(env, vSidePane)") ImGuiFileDialogPaneFun vSidePane, @OptArg(callValue = "250.0f") float vSidePaneWidth, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
env->ReleaseStringUTFChars(obj_vKey, vKey);
env->ReleaseStringUTFChars(obj_vTitle, vTitle);
env->ReleaseStringUTFChars(obj_vPath, vPath);
env->ReleaseStringUTFChars(obj_vFileName, vFileName);
*/
/**
* Open dialog with custom right pane (path and filename are obtained from filePathName)
*
* @param vKey key dialog
* @param vTitle title
* @param vFilters filters (in comma separated form i.e. ".png,.jpg" or ".*") or null for directories
* @param vFilePathName file path name (will be decompsoed in path and fileName)
* @param vSidePane side pane
* @param vCountSelectionMax count selection max
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
@BindingMethod
public static native void OpenDialog(String vKey, String vTitle, String vFilters, String vFilePathName, @ArgValue(callValue = "PaneFunCallback(env, vSidePane)") ImGuiFileDialogPaneFun vSidePane, @OptArg(callValue = "250.0f") float vSidePaneWidth, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
/**
* open simple modal (path and fileName can be specified)
* Open simple modal (path and fileName can be specified)
*
* @param vKey key dialog
* @param vTitle title
@@ -81,27 +109,8 @@ public final class ImGuiFileDialog {
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
public static native void openModal(String vKey, String vTitle, String vFilters, String vPath, String vFileName,
int vCountSelectionMax, long vUserDatas, int vFlags); /*MANUAL
char* vKey = (char*)env->GetStringUTFChars(obj_vKey, 0);
char* vTitle = (char*)env->GetStringUTFChars(obj_vTitle, 0);
char* vPath = (char*)env->GetStringUTFChars(obj_vPath, 0);
char* vFileName = (char*)env->GetStringUTFChars(obj_vFileName, 0);
if (env->IsSameObject(obj_vFilters, NULL)) {
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, nullptr, vPath, vFileName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
} else {
char* vFilters = (char*)env->GetStringUTFChars(obj_vFilters, JNI_FALSE);
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, vFilters, vPath, vFileName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
env->ReleaseStringUTFChars(obj_vFilters, vFilters);
}
env->ReleaseStringUTFChars(obj_vKey, vKey);
env->ReleaseStringUTFChars(obj_vTitle, vTitle);
env->ReleaseStringUTFChars(obj_vPath, vPath);
env->ReleaseStringUTFChars(obj_vFileName, vFileName);
*/
@BindingMethod
public static native void OpenModal(String vKey, String vTitle, String vFilters, String vPath, String vFileName, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
/**
* open simple modal (path and filename are obtained from filePathName)
@@ -114,28 +123,13 @@ public final class ImGuiFileDialog {
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
public static native void openModal(String vKey, String vTitle, String vFilters, String vFilePathName,
int vCountSelectionMax, long vUserDatas, int vFlags); /*MANUAL
char* vKey = (char*)env->GetStringUTFChars(obj_vKey, 0);
char* vTitle = (char*)env->GetStringUTFChars(obj_vTitle, 0);
char* vFilePathName = (char*)env->GetStringUTFChars(obj_vFilePathName, 0);
if (env->IsSameObject(obj_vFilters, NULL)) {
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, nullptr, vFilePathName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
} else {
char* vFilters = (char*)env->GetStringUTFChars(obj_vFilters, JNI_FALSE);
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, vFilters, vFilePathName, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
env->ReleaseStringUTFChars(obj_vFilters, vFilters);
}
env->ReleaseStringUTFChars(obj_vKey, vKey);
env->ReleaseStringUTFChars(obj_vTitle, vTitle);
env->ReleaseStringUTFChars(obj_vFilePathName, vFilePathName);
*/
@BindingMethod
public static native void OpenModal(String vKey, String vTitle, String vFilters, String vFilePathName, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
//, @ArgValue(callValue = "PaneFunCallback(env, vSidePane)") ImGuiFileDialogPaneFun vSidePane, @OptArg(callValue = "250.0f") float vSidePaneWidth
/**
* open modal with custom right pane (path and fileName can be specified)
* Open modal with custom right pane (path and fileName can be specified)
*
* @param vKey key dialog
* @param vTitle title
@@ -148,32 +142,11 @@ public final class ImGuiFileDialog {
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
public static native void openModal(String vKey, String vTitle, String vFilters, String vPath, String vFileName, ImGuiFileDialogPaneFun vSidePane,
float vSidePaneWidth, int vCountSelectionMax, long vUserDatas, int vFlags); /*MANUAL
IMGFD_PANE_FUN_METHOD_TMPL()
char* vKey = (char*)env->GetStringUTFChars(obj_vKey, 0);
char* vTitle = (char*)env->GetStringUTFChars(obj_vTitle, 0);
char* vPath = (char*)env->GetStringUTFChars(obj_vPath, 0);
char* vFileName = (char*)env->GetStringUTFChars(obj_vFileName, 0);
if (env->IsSameObject(obj_vFilters, NULL)) {
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, nullptr, vPath, vFileName, paneFunCallback, vSidePaneWidth, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
} else {
char* vFilters = (char*)env->GetStringUTFChars(obj_vFilters, JNI_FALSE);
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, vFilters, vPath, vFileName, paneFunCallback, vSidePaneWidth, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
env->ReleaseStringUTFChars(obj_vFilters, vFilters);
}
env->ReleaseStringUTFChars(obj_vKey, vKey);
env->ReleaseStringUTFChars(obj_vTitle, vTitle);
env->ReleaseStringUTFChars(obj_vPath, vPath);
env->ReleaseStringUTFChars(obj_vFileName, vFileName);
*/
@BindingMethod
public static native void OpenModal(String vKey, String vTitle, String vFilters, String vPath, String vFileName, @ArgValue(callValue = "PaneFunCallback(env, vSidePane)") ImGuiFileDialogPaneFun vSidePane, @OptArg(callValue = "250.0f") float vSidePaneWidth, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
/**
* open modal with custom right pane (path and filename are obtained from filePathName)
* Open modal with custom right pane (path and filename are obtained from filePathName)
*
* @param vKey key dialog
* @param vTitle title
@@ -185,102 +158,56 @@ public final class ImGuiFileDialog {
* @param vUserDatas user datas (can be retrieved in pane)
* @param vFlags ImGuiFileDialogFlags
*/
public static native void openModal(String vKey, String vTitle, String vFilters, String vFilePathName, ImGuiFileDialogPaneFun vSidePane,
float vSidePaneWidth, int vCountSelectionMax, long vUserDatas, int vFlags); /*MANUAL
IMGFD_PANE_FUN_METHOD_TMPL()
char* vKey = (char*)env->GetStringUTFChars(obj_vKey, 0);
char* vTitle = (char*)env->GetStringUTFChars(obj_vTitle, 0);
char* vFilePathName = (char*)env->GetStringUTFChars(obj_vFilePathName, 0);
if (env->IsSameObject(obj_vFilters, NULL)) {
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, nullptr, vFilePathName, paneFunCallback, vSidePaneWidth, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
} else {
char* vFilters = (char*)env->GetStringUTFChars(obj_vFilters, JNI_FALSE);
ImGuiFileDialog::Instance()->OpenModal(vKey, vTitle, vFilters, vFilePathName, paneFunCallback, vSidePaneWidth, vCountSelectionMax, reinterpret_cast<void*>(vUserDatas), vFlags);
env->ReleaseStringUTFChars(obj_vFilters, vFilters);
}
env->ReleaseStringUTFChars(obj_vKey, vKey);
env->ReleaseStringUTFChars(obj_vTitle, vTitle);
env->ReleaseStringUTFChars(obj_vFilePathName, vFilePathName);
*/
@BindingMethod
public static native void OpenModal(String vKey, String vTitle, String vFilters, String vFilePathName, @ArgValue(callValue = "PaneFunCallback(env, vSidePane)") ImGuiFileDialogPaneFun vSidePane, @OptArg(callValue = "250.0f") float vSidePaneWidth, @OptArg int vCountSelectionMax, @OptArg @ArgValue(reinterpretCast = "void*") long vUserDatas, @OptArg int vFlags);
/**
* Display / Close dialog form
* Display the dialog. return true if a result was obtained (Ok or not)
*
* @param vKey key dialog to display (if not the same key as defined by OpenDialog/Modal =&gt; no opening)
* @param vFlags ImGuiWindowFlags
* @param vMinSizeX minimal size constraint for the ImGuiWindow
* @param vMinSizeY minimal size constraint for the ImGuiWindow
* @param vMaxSizeX maximal size constraint for the ImGuiWindow
* @param vMaxSizeY maximal size constraint for the ImGuiWindow
* @param vKey key dialog to display (if not the same key as defined by OpenDialog/Modal =&gt; no opening)
* @param vFlags ImGuiWindowFlags
* @param vMinSize minimal size constraint for the ImGuiWindow
* @param vMaxSize maximal size constraint for the ImGuiWindow
* @return true if a result was obtained (Ok or not)
*/
public static native boolean display(String vKey, int vFlags, float vMinSizeX, float vMinSizeY, float vMaxSizeX, float vMaxSizeY); /*
return ImGuiFileDialog::Instance()->Display(vKey, vFlags, ImVec2(vMinSizeX, vMinSizeY), ImVec2(vMaxSizeX, vMaxSizeY));
*/
@BindingMethod
public static native boolean Display(String vKey, @OptArg int vFlags, @OptArg ImVec2 vMinSize, @OptArg ImVec2 vMaxSize);
/**
* close dialog
* Close dialog
*/
public static native void close(); /*
ImGuiFileDialog::Instance()->Close();
*/
@BindingMethod
public static native void Close();
/**
* say if the dialog key was already opened this frame
* Say if the dialog key was already opened this frame
*
* @param vKey key dialog
* @return if the dialog key was already opened this frame
*/
public static native boolean wasOpenedThisFrame(String vKey); /*
return ImGuiFileDialog::Instance()->WasOpenedThisFrame(vKey);
*/
@BindingMethod
public static native boolean WasOpenedThisFrame(@OptArg String vKey);
/**
* say if the dialog was already opened this frame
*
* @return if the dialog was already opened this frame
*/
public static native boolean wasOpenedThisFrame(); /*
return ImGuiFileDialog::Instance()->WasOpenedThisFrame();
*/
/**
* say if the key is opened
* Say if the key is opened
*
* @param vKey key dialog
* @return if the key is opened
*/
public static native boolean isOpened(String vKey); /*
return ImGuiFileDialog::Instance()->IsOpened(vKey);
*/
@BindingMethod
public static native boolean IsOpened(@OptArg String vKey);
/**
* say if the dialog is opened somewhere
*
* @return if the dialog is opened somewhere
*/
public static native boolean isOpened(); /*
return ImGuiFileDialog::Instance()->IsOpened();
*/
/**
* return the dialog key who is opened, return nothing if not opened
* Return the dialog key who is opened, return nothing if not opened
*
* @return the dialog key who is opened or nothing is not opened
*/
public static native String getOpenedKey(); /*
return env->NewStringUTF(ImGuiFileDialog::Instance()->GetOpenedKey().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public static native String GetOpenedKey();
/**
@@ -288,9 +215,8 @@ public final class ImGuiFileDialog {
*
* @return True if the dialog closed with Ok result, or false with cancel result
*/
public static native boolean isOk(); /*
return ImGuiFileDialog::Instance()->IsOk();
*/
@BindingMethod
public static native boolean IsOk();
/**
@@ -301,29 +227,31 @@ public final class ImGuiFileDialog {
*
* @return Map of FileName to FilePathName in key,value pair
*/
public static native HashMap<String, String> getSelection(); /*
//Get the map from ImGuiFileDialog
public static HashMap<String, String> getSelection() {
return nGetSelection();
}
private static native HashMap<String, String> nGetSelection(); /*
// Get the map from ImGuiFileDialog
std::map<std::string, std::string> mMap = ImGuiFileDialog::Instance()->GetSelection();
env->PushLocalFrame(mMap.size() * 2); // Expands stack size to not overflow
//Get reference to java's HashMap
// Get reference to java's HashMap
jclass hashMapClass = env->FindClass("java/util/HashMap");
jmethodID hashMapInit = env->GetMethodID(hashMapClass, "<init>", "(I)V");
jobject hashMapObj = env->NewObject(hashMapClass, hashMapInit, mMap.size());
jmethodID hashMapPut = env->GetMethodID(hashMapClass, "put",
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
jmethodID hashMapPut = env->GetMethodID(hashMapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
//Copy key,value pairs from map to hashmap
for (auto it : mMap)
{
for (auto it : mMap) {
env->CallObjectMethod(hashMapObj, hashMapPut,
env->NewStringUTF(it.first.c_str()),
env->NewStringUTF(it.second.c_str())
);
);
}
env->PopLocalFrame(hashMapObj); //Cleanup stack
env->PopLocalFrame(hashMapObj); // Cleanup stack
return hashMapObj;
*/
@@ -332,50 +260,47 @@ public final class ImGuiFileDialog {
/**
* Save File behavior : will always return the content of the field with current filter extention and current path
*/
public static native String getFilePathName(); /*
return env->NewStringUTF(ImGuiFileDialog::Instance()->GetFilePathName().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public static native String GetFilePathName();
/**
* Save File behavior : will always return the content of the field with current filter extension
*
* @return the content of the field with current filter extension
*/
public static native String getCurrentFileName(); /*
return env->NewStringUTF(ImGuiFileDialog::Instance()->GetCurrentFileName().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public static native String GetCurrentFileName();
/**
* will return current path
* Will return current path
*
* @return the current path
*/
public static native String getCurrentPath(); /*
return env->NewStringUTF(ImGuiFileDialog::Instance()->GetCurrentPath().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public static native String GetCurrentPath();
/**
* will return selected filter
* Will return selected filter
*
* @return the selected filter
*/
public static native String getCurrentFilter(); /*
return env->NewStringUTF(ImGuiFileDialog::Instance()->GetCurrentFilter().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public static native String GetCurrentFilter();
/**
* will return user datas sent with Open Dialog/Modal
* Will return user datas sent with Open Dialog/Modal
* <p>
* Can be used to pass a long value to the dialog and get the value back.
* This long value can be a pointer to a native data structure.
*
* @return user datas sent with Open Dialog/Modal
*/
public static native long getUserDatas(); /*
return reinterpret_cast<jlong>(ImGuiFileDialog::Instance()->GetUserDatas());
*/
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)")
public static native long GetUserDatas();
}
@@ -1,5 +1,5 @@
package imgui.extension.imguifiledialog.callback;
public abstract class ImGuiFileDialogPaneFun {
public abstract void paneFun(String filter, long userDatas, boolean canContinue);
public abstract void accept(String filter, long userDatas, boolean canContinue);
}
@@ -1,40 +1,13 @@
package imgui.extension.imguifiledialog.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiFileDialogFlags {
private ImGuiFileDialogFlags() {
}
public static final int None = 0;
/**
* show confirm to overwrite dialog
*/
public static final int ConfirmOverwrite = (1 << 0);
/**
* dont show hidden file (file starting with a .)
*/
public static final int DontShowHiddenFiles = (1 << 1);
/**
* disable the create directory button
*/
public static final int DisableCreateDirectoryButton = (1 << 2);
/**
* hide column file type
*/
public static final int HideColumnType = (1 << 3);
/**
* hide column file size
*/
public static final int HideColumnSize = (1 << 4);
/**
* hide column file date
*/
public static final int HideColumnDate = (1 << 5);
@BindingAstEnum(file = "ast-ImGuiFileDialog.json", qualType = "ImGuiFileDialogFlags_")
public Void __;
}
@@ -1,5 +1,8 @@
package imgui.extension.imguiknobs;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.type.ImFloat;
import imgui.type.ImInt;
@@ -7,60 +10,46 @@ import imgui.type.ImInt;
* ImGuiKnobs extension for ImGui
* Repo: https://github.com/altschuler/imgui-knobs
*/
@BindingSource
public final class ImGuiKnobs {
private ImGuiKnobs() {
throw new UnsupportedOperationException();
}
/*JNI
/*JNI
#include "_imguiknobs.h"
*/
*/
/**
* Create a knob with float values
*
* @param label knob Label
* @param pValue knob value
* @param minValue minimum value
* @param maxValue maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size size of the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
* @param label knob Label
* @param pValue knob value
* @param vMin minimum value
* @param vMax maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size size of the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
*/
public static boolean knobFloat(final String label, final ImFloat pValue, final float minValue, final float maxValue, final float speed, final String format, final int variant, final float size, final int flags, final int steps) {
return nKnob(label, pValue.getData(), minValue, maxValue, speed, format, variant, size, flags, steps);
}
private static native boolean nKnob(String label, float[] pValue, float minValue, float maxValue, float speed, String format, int variant, float size, int flags, int steps); /*
return ImGuiKnobs::Knob(label, pValue, minValue, maxValue, speed, format, (ImGuiKnobVariant)variant, size, (ImGuiKnobFlags)flags, steps);
*/
@BindingMethod
public static native boolean Knob(String label, ImFloat pValue, float vMin, float vMax, @OptArg(callValue = "0") float speed, @OptArg(callValue = "NULL") String format, @OptArg(callValue = "ImGuiKnobVariant_Tick") int variant, @OptArg(callValue = "0") float size, @OptArg(callValue = "0") int flags, @OptArg int steps);
/**
* Create a knob with int values
*
* @param label knob Label
* @param pValue knob value
* @param minValue minimum value
* @param maxValue maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size Size for the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
* @param label knob Label
* @param pValue knob value
* @param vMin minimum value
* @param vMax maximum value
* @param speed speed of the knob
* @param format string format
* @param variant ImGuiKnobVariant
* @param size Size for the knob
* @param flags ImGuiKnobFlags
* @param steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.
*/
public static boolean knobInt(final String label, final ImInt pValue, final int minValue, final int maxValue, final float speed, final String format, final int variant, final float size, final int flags, final int steps) {
return nKnobInt(label, pValue.getData(), minValue, maxValue, speed, format, variant, size, flags, steps);
}
private static native boolean nKnobInt(String label, int[] pValue, int minValue, int maxValue, float speed, String format, int variant, float size, int flags, int steps); /*
return ImGuiKnobs::KnobInt(label, pValue, minValue, maxValue, speed, format, (ImGuiKnobVariant)variant, size, (ImGuiKnobFlags)flags, steps);
*/
@BindingMethod(callName = "KnobInt")
public static native boolean Knob(String label, ImInt pValue, int vMin, int vMax, @OptArg(callValue = "0") float speed, @OptArg(callValue = "NULL") String format, @OptArg(callValue = "ImGuiKnobVariant_Tick") int variant, @OptArg(callValue = "0") float size, @OptArg(callValue = "0") int flags, @OptArg int steps);
}
@@ -1,14 +1,15 @@
package imgui.extension.imguiknobs.flag;
public final class ImGuiKnobFlags {
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiKnobFlags {
private ImGuiKnobFlags() {
}
public static final int NONE = 0;
public static final int NO_TITLE = 1;
public static final int NO_INPUT = 1 << 1;
public static final int VALUE_TOOLTIP = 1 << 2;
public static final int DRAG_HORIZONTAL = 1 << 3;
public static final int None = 0;
@BindingAstEnum(file = "ast-imgui-knobs.json", qualType = "ImGuiKnobFlags_")
public Void __;
}
@@ -1,14 +1,13 @@
package imgui.extension.imguiknobs.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiKnobVariant {
private ImGuiKnobVariant() {
}
public static final int TICK = 1;
public static final int DOT = 1 << 1;
public static final int WIPER = 1 << 2;
public static final int WIPER_ONLY = 1 << 3;
public static final int WIPER_DOT = 1 << 4;
public static final int STEPPED = 1 << 5;
public static final int SPACE = 1 << 6;
@BindingAstEnum(file = "ast-imgui-knobs.json", qualType = "ImGuiKnobVariant_")
public Void __;
}
@@ -1,120 +1,90 @@
package imgui.extension.imguizmo;
import imgui.ImDrawList;
import imgui.ImGui;
import imgui.ImVec2;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.internal.ImGuiContext;
@BindingSource
public final class ImGuizmo {
private static final float[] MATRICES = new float[4 * 16]; //for drawCubes()
private ImGuizmo() {
}
/*JNI
#include "_imguizmo.h"
*/
private static native void nEnabled(boolean enabled); /*
ImGuizmo::Enable(enabled);
*/
*/
/**
* Enable/Disable the gizmo.
* Call inside your own window and before Manipulate() in order to draw gizmo to that window.
* Or pass a specific ImDrawList to draw to (e.g. ImGui::GetForegroundDrawList()).
*/
public static void setEnabled(final boolean isEnabled) {
nEnabled(isEnabled);
}
private static native boolean nIsUsing(); /*
return ImGuizmo::IsUsing();
*/
@BindingMethod(callName = "SetDrawlist")
public static native void SetDrawList(@OptArg ImDrawList drawList);
/**
* Checks to see if we're using the Gizmo.
* Call BeginFrame right after ImGui_XXXX_NewFrame();
*/
public static boolean isUsing() {
return nIsUsing();
}
private static native boolean nIsOver(); /*
return ImGuizmo::IsOver();
*/
@BindingMethod
public static native void BeginFrame();
/**
* Checks to see if we're over the Gizmo.
* This is necessary because when imguizmo is compiled into a dll, and imgui into another
* Globals are not shared between them.
* More details at https://stackoverflow.com/questions/19373061/what-happens-to-global-and-static-variables-in-a-shared-library-when-it-is-dynam
* Expose method to set imgui context
*/
public static boolean isOver() {
return nIsOver();
}
private static native void nSetDrawList(long pointer); /*
ImGuizmo::SetDrawlist((ImDrawList*)pointer);
*/
@BindingMethod
public static native void SetImGuiContext(ImGuiContext ctx);
/**
* Setting the draw list of the given Gizmo.
*
* @param drawList the target drawlist
* Return true if mouse cursor is over any gizmo control (axis, plan or screen component)
*/
public static void setDrawList(final ImDrawList drawList) {
nSetDrawList(drawList.ptr);
}
@BindingMethod
public static native boolean IsOver();
/**
* Setting the default window drawlist.
* Return true if mouse IsOver or if the gizmo is in moving state
*/
public static void setDrawList() {
setDrawList(ImGui.getWindowDrawList());
}
@BindingMethod
public static native boolean IsUsing();
/**
* Starts the next frame for the Gizmo.
* Call this after you've called ImGui.beginFrame().
* Enable/disable the gizmo. Stay in the state until next call to Enable.
* Gizmo is rendered with gray half transparent color when disabled
*/
public static native void beginFrame(); /*
ImGuizmo::BeginFrame();
*/
private static native void nDecomposeMatrixToComponents(float[] matrix, float[] translation, float[] rotation, float[] scale); /*
ImGuizmo::DecomposeMatrixToComponents(matrix, translation, rotation, scale);
*/
@BindingMethod
public static native void Enable(boolean enable);
/**
* Helper function for manually editing Translation/Rotation/Scale with an input float.
* Translation, Rotation and Scale float points to 3 floats each.
* Angles are in degrees (more suitable for human editing).
*
* @param modelMatrix the model matrix
* @param matrix the model matrix
* @param translation the model translation
* @param rotation the model rotation
* @param scale the model scale
* @see <a target="_blank" href="https://github.com/CedricGuillemet/ImGuizmo">Reference Page</a>
*/
public static void decomposeMatrixToComponents(final float[] modelMatrix, final float[] translation, final float[] rotation, final float[] scale) {
nDecomposeMatrixToComponents(modelMatrix, translation, rotation, scale);
}
private static native void nRecomposeMatrixFromComponents(float[] matrix, float[] translation, float[] rotation, float[] scale); /*
ImGuizmo::RecomposeMatrixFromComponents(translation, rotation, scale, matrix);
*/
@BindingMethod
public static native void DecomposeMatrixToComponents(float[] matrix, float[] translation, float[] rotation, float[] scale);
/**
* Helper function for manually editing Translation/Rotation/Scale with an input float.
* Translation, Rotation and Scale float points to 3 floats each.
* Angles are in degrees (more suitable for human editing).
*
* @param modelMatrix the model matrix
* @param translation the model translation
* @param rotation the model rotation
* @param scale the model scale
* @param matrix the model matrix
* @see <a target="_blank" href="https://github.com/CedricGuillemet/ImGuizmo">Reference Page</a>
*/
public static void recomposeMatrixFromComponents(final float[] modelMatrix, final float[] translation, final float[] rotation, final float[] scale) {
nRecomposeMatrixFromComponents(modelMatrix, translation, rotation, scale);
}
public static native void nSetRect(float x, float y, float width, float height); /*
ImGuizmo::SetRect(x, y, width, height);
*/
@BindingMethod
public static native void RecomposeMatrixFromComponents(float[] translation, float[] rotation, float[] scale, float[] matrix);
/**
* This will set the rect position.
@@ -124,49 +94,57 @@ public final class ImGuizmo {
* @param width width of the rectangle
* @param height height of the rectangle
*/
public static void setRect(final float x, final float y, final float width, final float height) {
nSetRect(x, y, width, height);
}
private static native void nSetOrthographic(boolean ortho); /*
ImGuizmo::SetOrthographic(ortho);
*/
@BindingMethod
public static native void SetRect(float x, float y, float width, float height);
/**
* Making sure if we're set to ortho or not.
*/
public static void setOrthographic(final boolean ortho) {
nSetOrthographic(ortho);
}
private static native void nDrawCubes(float[] view, float[] projection, float[] matrices, int matrixCount); /*
ImGuizmo::DrawCubes(view, projection, matrices, matrixCount);
*/
@BindingMethod
public static native void SetOrthographic(boolean isOrthographic);
/**
* Drawing an arbitrary cube in the world.
*
* @param view target camera view
* @param projection target camera projection
* @param cubeMatrices cube matrices (max. 4 cubes allowed)
* @param view target camera view
* @param projection target camera projection
* @param matrices cube matrices (max. 4 cubes allowed)
*/
public static void drawCubes(final float[] view, final float[] projection, final float[]... cubeMatrices) {
if (cubeMatrices.length > 4) {
throw new IllegalArgumentException("Drawing cubes with ImGuizmo only supports up to 4 cubes because it should only be used for debugging purposes");
@BindingMethod
public static native void DrawCubes(float[] view, float[] projection, float[] matrices, @ArgValue(callValue = "(int)(env->GetArrayLength(obj_matrices)/16)") Void matrixCount);
/**
* Drawing an arbitrary cube in the world.
*
* @param view target camera view
* @param projection target camera projection
* @param matrices cube matrices (max. 4 cubes allowed)
* @param matrixCount number of matrices
*/
@BindingMethod
public static native void DrawCubes(float[] view, float[] projection, float[] matrices, int matrixCount);
/**
* Drawing an arbitrary cube in the world.
*
* @param view target camera view
* @param projection target camera projection
* @param matrices cube matrices (max. 4 cubes allowed)
*/
public static void drawCubes(final float[] view, final float[] projection, final float[]... matrices) {
if (matrices.length > 4) {
throw new IllegalArgumentException("Only up to 4 cubes matrices is supported");
}
for (int i = 0, cubeMatricesLength = cubeMatrices.length; i < cubeMatricesLength; i++) {
final float[] cubeMatrix = cubeMatrices[i];
System.arraycopy(cubeMatrix, 0, MATRICES, i * cubeMatrix.length, cubeMatrix.length);
final float[] cubeMatrices = new float[matrices.length * 16];
for (int i = 0, cubeMatricesLength = matrices.length; i < cubeMatricesLength; i++) {
final float[] cubeMatrix = matrices[i];
System.arraycopy(cubeMatrix, 0, cubeMatrices, i * cubeMatrix.length, cubeMatrix.length);
}
nDrawCubes(view, projection, MATRICES, cubeMatrices.length);
drawCubes(view, projection, cubeMatrices, cubeMatrices.length);
}
private static native void nDrawGrid(float[] view, float[] projection, float[] matrix, int gridSize); /*
ImGuizmo::DrawGrid(view, projection, matrix, gridSize);
*/
/**
* Drawing a grid to the world (should only be used for debugging purposes).
*
@@ -175,159 +153,59 @@ public final class ImGuizmo {
* @param matrix grid matrix
* @param gridSize grid size
*/
public static void drawGrid(final float[] view, final float[] projection, final float[] matrix, final int gridSize) {
nDrawGrid(view, projection, matrix, gridSize);
}
private static native void nManipulate(float[] view, float[] projection, int operation, int mode, float[] matrix); /*
ImGuizmo::Manipulate(view, projection, (ImGuizmo::OPERATION) operation, (ImGuizmo::MODE) mode, matrix);
*/
private static native void nManipulate(float[] view, float[] projection, int operation, int mode, float[] matrix, float[] snap); /*
ImGuizmo::Manipulate(view, projection, (ImGuizmo::OPERATION) operation, (ImGuizmo::MODE) mode, matrix, NULL, snap);
*/
private static native void nManipulate(float[] view, float[] projection, int operation, int mode, float[] matrix, float[] snap, float[] bounds); /*
ImGuizmo::Manipulate(view, projection, (ImGuizmo::OPERATION) operation, (ImGuizmo::MODE) mode, matrix, NULL, snap, bounds, NULL);
*/
private static native void nManipulate(float[] view, float[] projection, int operation, int mode, float[] matrix, float[] snap, float[] bounds, float[] boundsSnap); /*
ImGuizmo::Manipulate(view, projection, (ImGuizmo::OPERATION) operation, (ImGuizmo::MODE) mode, matrix, NULL, snap, bounds, boundsSnap);
*/
private static native void nManipulate(float[] view, float[] projection, int operation, int mode, float[] matrix, float[] deltaMatrix, float[] snap, float[] bounds, float[] boundsSnap); /*
ImGuizmo::Manipulate(view, projection, (ImGuizmo::OPERATION) operation, (ImGuizmo::MODE) mode, matrix, deltaMatrix, snap, bounds, boundsSnap);
*/
/**
* Manipulating the given model matrix.
*
* @param view target camera view
* @param projection target camera projection
* @param modelMatrix model matrix
* @param operation target operation
* @param mode target mode
*/
public static void manipulate(final float[] view, final float[] projection, final float[] modelMatrix, final int operation, final int mode) {
nManipulate(view, projection, operation, mode, modelMatrix);
}
/**
* Manipulating the given model matrix with snap feature enabled!
*
* @param view target camera view
* @param projection target camera projection
* @param modelMatrix model matrix
* @param operation target operation
* @param mode target mode
* @param snap snap value
*/
public static void manipulate(final float[] view, final float[] projection, final float[] modelMatrix, final int operation, final int mode, final float[] snap) {
nManipulate(view, projection, operation, mode, modelMatrix, snap);
}
/**
* Manipulating the given model matrix with snap and bounds feature enabled!
*
* @param view target camera view
* @param projection target camera projection
* @param modelMatrix model matrix
* @param operation target operation
* @param mode target mode
* @param snap snap value
* @param bounds bounds value
*/
public static void manipulate(final float[] view, final float[] projection, final float[] modelMatrix, final int operation, final int mode, final float[] snap, final float[] bounds) {
nManipulate(view, projection, operation, mode, modelMatrix, snap, bounds);
}
/**
* Manipulating the given model matrix with snap and bounds(snap) feature enabled!
*
* @param view target camera view
* @param projection target camera projection
* @param modelMatrix model matrix
* @param operation target operation
* @param mode target mode
* @param snap snap value
* @param bounds bounds value
* @param boundsSnap bounds snap value
*/
public static void manipulate(final float[] view, final float[] projection, final float[] modelMatrix, final int operation, final int mode, final float[] snap, final float[] bounds, final float[] boundsSnap) {
nManipulate(view, projection, operation, mode, modelMatrix, snap, bounds, boundsSnap);
}
@BindingMethod
public static native void DrawGrid(float[] view, float[] projection, float[] matrix, float gridSize);
/**
* Manipulating the given model matrix with delta matrix
*
* @param view target camera view
* @param projection target camera projection
* @param modelMatrix model matrix
* @param deltaMatrix delta matrix
* @param operation target operation
* @param mode target mode
* @param matrix model matrix
* @param deltaMatrix delta matrix
* @param snap snap value
* @param bounds bounds value
* @param localBounds bounds value
* @param boundsSnap bounds snap value
*/
public static void manipulate(final float[] view, final float[] projection, final float[] modelMatrix, final float[] deltaMatrix, final int operation, final int mode, final float[] snap, final float[] bounds, final float[] boundsSnap) {
nManipulate(view, projection, operation, mode, modelMatrix, deltaMatrix, snap, bounds, boundsSnap);
}
private static native void nViewManipulate(float[] view, float length, float[] position, float[] size, int color); /*
ImGuizmo::ViewManipulate(view, length, ImVec2(position[0], position[1]), ImVec2(size[0], size[1]), (ImU32) color);
*/
@BindingMethod
public static native void Manipulate(float[] view, float[] projection, @ArgValue(staticCast = "ImGuizmo::OPERATION") int operation, @ArgValue(staticCast = "ImGuizmo::MODE") int mode, float[] matrix, @OptArg float[] deltaMatrix, @OptArg float[] snap, @OptArg float[] localBounds, @OptArg float[] boundsSnap);
/**
* Manipulating the view
*
* @param view target camera view
* @param length camera distance/length
* @param position position
* @param size size
* @param color color
* @param view target camera view
* @param length camera distance/length
* @param position position
* @param size size
* @param backgroundColor color
*/
public static void viewManipulate(final float[] view, final float length, final float[] position, final float[] size, final int color) {
nViewManipulate(view, length, position, size, color);
}
private static native void nSetId(int id); /*
ImGuizmo::SetID(id);
*/
@BindingMethod
public static native void ViewManipulate(float[] view, float length, ImVec2 position, ImVec2 size, int backgroundColor);
/**
* This will update the current id
*/
public static void setId(final int id) {
nSetId(id);
}
private static native boolean nIsOver(int operation); /*
return ImGuizmo::IsOver((ImGuizmo::OPERATION) operation);
*/
@BindingMethod
public static native void SetID(int id);
/**
* Checks if we're over the current operation.
* One of {@link imgui.extension.imguizmo.flag.Operation}.
* Return true if the cursor is over the operation's gizmo
*
* @param operation target
*/
public static boolean isOver(final int operation) {
return nIsOver(operation);
}
@BindingMethod
public static native boolean IsOver(@ArgValue(staticCast = "ImGuizmo::OPERATION") int operation);
private static native void nSetGizmoSizeClipSpace(float value); /*
ImGuizmo::SetGizmoSizeClipSpace(value);
*/
private static native void nAllowAxisFlip(boolean value); /*
ImGuizmo::AllowAxisFlip(value);
*/
@BindingMethod
public static native void SetGizmoSizeClipSpace(float value);
/**
* This will update the current axis flip value
* Allow axis to flip.
* When true (default), the guizmo axis flip for better visibility.
* When false, they always stay along the positive world/local axis.
*/
public static void setAllowAxisFlip(final boolean value) {
nAllowAxisFlip(value);
}
@BindingMethod
public static native void AllowAxisFlip(boolean value);
}
@@ -1,9 +1,13 @@
package imgui.extension.imguizmo.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class Mode {
private Mode() {
}
public static final int LOCAL = 0;
public static final int WORLD = 1;
@BindingAstEnum(file = "ast-ImGuizmo.json", qualType = "ImGuizmo::MODE")
public Void __;
}
@@ -1,64 +1,18 @@
package imgui.extension.imguizmo.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Needs view and projection matrices.
* Matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional.
* Translation is applied in world space.
*/
@BindingSource
public final class Operation {
private Operation() {
}
/**
* Translating X axis
*/
public static final int TRANSLATE_X = 1;
/**
* Translating Y axis
*/
public static final int TRANSLATE_Y = 1 << 1;
/**
* Translating Z axis
*/
public static final int TRANSLATE_Z = 1 << 2;
/**
* Rotating X axis
*/
public static final int ROTATE_X = 1 << 3;
/**
* Rotating Y axis
*/
public static final int ROTATE_Y = 1 << 4;
/**
* Rotating Z axis
*/
public static final int ROTATE_Z = 1 << 5;
/**
* Rotating screen
*/
public static final int ROTATE_SCREEN = 1 << 6;
/**
* Scaling X axis
*/
public static final int SCALE_X = 1 << 7;
/**
* Scaling Y axis
*/
public static final int SCALE_Y = 1 << 8;
/**
* Scaling Z axis
*/
public static final int SCALE_Z = 1 << 9;
/**
* Translating all axis
*/
public static final int TRANSLATE = TRANSLATE_X | TRANSLATE_Y | TRANSLATE_Z;
/**
* Rotating all axis
*/
public static final int ROTATE = ROTATE_X | ROTATE_Y | ROTATE_Z | ROTATE_SCREEN;
/**
* Scaling all axis
*/
public static final int SCALE = SCALE_X | SCALE_Y | SCALE_Z;
@BindingAstEnum(file = "ast-ImGuizmo.json", qualType = "ImGuizmo::OPERATION")
public Void __;
}
@@ -1,7 +1,12 @@
package imgui.extension.imnodes;
import imgui.ImVec2;
import imgui.extension.imnodes.flag.ImNodesPinShape;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
import imgui.internal.ImGuiContext;
import imgui.type.ImBoolean;
import imgui.type.ImInt;
@@ -11,9 +16,8 @@ import imgui.type.ImInt;
* <p>
* Refer to the library's Github page for examples and support
*/
@BindingSource
public final class ImNodes {
private static final ImNodesStyle STYLE = new ImNodesStyle(0);
private ImNodes() {
}
@@ -27,123 +31,115 @@ public final class ImNodes {
// By default, the library creates an editor context behind the scenes, so using any of the ImNodes
// functions doesn't require you to explicitly create a context.
public static ImNodesContext editorContextCreate() {
return new ImNodesContext();
}
@BindingMethod
public static native void SetImGuiContext(ImGuiContext ctx);
public static void editorContextFree(final ImNodesContext context) {
context.destroy();
}
@BindingMethod
public static native ImNodesContext CreateContext();
public static void editorContextSet(final ImNodesContext context) {
nEditorContextSet(context.ptr);
}
@BindingMethod
public static native void DestroyContext(@OptArg ImNodesContext ctx);
private static native void nEditorContextSet(long ptr); /*
ImNodes::EditorContextSet((ImNodesEditorContext*)ptr);
*/
@BindingMethod
public static native ImNodesContext GetCurrentContext();
/**
* Initialize the node editor system.
*/
public static native void createContext(); /*
ImNodes::CreateContext();
*/
@BindingMethod
public static native void SetCurrentContext(ImNodesContext ctx);
public static native void destroyContext(); /*
ImNodes::DestroyContext();
*/
@BindingMethod
public static native ImNodesEditorContext EditorContextCreate();
@BindingMethod
public static native void EditorContextFree(ImNodesEditorContext context);
@BindingMethod
public static native void EditorContextSet(ImNodesEditorContext context);
@BindingMethod
public static native ImVec2 EditorContextGetPanning();
@BindingMethod
public static native void EditorContextResetPanning(ImVec2 pos);
@BindingMethod
public static native void EditorContextMoveToNode(int nodeId);
@BindingMethod
@ReturnValue(isStatic = true, callPrefix = "&")
public static native ImNodesIO GetIO();
/**
* Returns the global style struct. See the struct declaration for default values.
*/
public static ImNodesStyle getStyle() {
STYLE.ptr = nGetStyle();
return STYLE;
}
private static native long nGetStyle(); /*
return (intptr_t)&ImNodes::GetStyle();
*/
@BindingMethod
@ReturnValue(isStatic = true, callPrefix = "&")
public static native ImNodesStyle GetStyle();
// Style presets matching the dear imgui styles of the same name.
public static native void styleColorsDark(); /*
ImNodes::StyleColorsDark();
*/
@BindingMethod
public static native void StyleColorsDark();
public static native void styleColorsClassic(); /*
ImNodes::StyleColorsClassic();
*/
@BindingMethod
public static native void StyleColorsClassic();
public static native void styleColorsLight(); /*
ImNodes::StyleColorsLight();
*/
/**
* Use PushColorStyle and PopColorStyle to modify ImNodesColorStyle mid-frame.
*/
public static native void pushColorStyle(int imNodesStyleColor, int color); /*
ImNodes::PushColorStyle((ImNodesCol)imNodesStyleColor, color);
*/
public static native void popColorStyle(); /*
ImNodes::PopColorStyle();
*/
public static native void pushStyleVar(int imNodesStyleVar, float value); /*
ImNodes::PushStyleVar((ImNodesStyleVar)imNodesStyleVar, value);
*/
public static native void pushStyleVar(int imNodesStyleVar, float x, float y); /*
ImNodes::PushStyleVar((ImNodesStyleVar)imNodesStyleVar, ImVec2(x, y));
*/
public static native void popStyleVar(); /*
ImNodes::PopStyleVar();
*/
@BindingMethod
public static native void StyleColorsLight();
/**
* The top-level function call. Call this before calling BeginNode/EndNode. Calling this function
* will result the node editor grid workspace being rendered.
*/
public static native void beginNodeEditor(); /*
ImNodes::BeginNodeEditor();
*/
@BindingMethod
public static native void BeginNodeEditor();
public static native void endNodeEditor(); /*
ImNodes::EndNodeEditor();
*/
public static native void beginNode(int node); /*
ImNodes::BeginNode(node);
*/
public static native void endNode(); /*
ImNodes::EndNode();
*/
@BindingMethod
public static native void EndNodeEditor();
/**
* Render a link between attributes.
* The attributes ids used here must match the ids used in Begin(Input|Output)Attribute function
* calls. The order of source and target doesn't make a difference for rendering the link.
* Add a navigable minimap to the editor; call before EndNodeEditor after all nodes and links have been specified
* // TODO: add callback
*/
public static native void link(int id, int source, int target); /*
ImNodes::Link(id, source, target);
*/
@BindingMethod
public static native void MiniMap(@OptArg float miniMapSizeFraction, @OptArg @ArgValue(staticCast = "ImNodesMiniMapLocation") int miniMapLocation);
/**
* Use PushColorStyle and PopColorStyle to modify ImNodesColorStyle mid-frame.
*/
@BindingMethod
public static native void PushColorStyle(@ArgValue(staticCast = "ImNodesCol") int item, int color);
@BindingMethod
public static native void PopColorStyle();
@BindingMethod
public static native void PushStyleVar(@ArgValue(staticCast = "ImNodesStyleVar") int styleItem, float value);
@BindingMethod
public static native void PushStyleVar(@ArgValue(staticCast = "ImNodesStyleVar") int styleItem, ImVec2 value);
@BindingMethod
public static native void PopStyleVar();
@BindingMethod
public static native void BeginNode(int node);
@BindingMethod
public static native void EndNode();
@BindingMethod
public static native ImVec2 GetNodeDimensions(int id);
/**
* Place your node title bar content (such as the node title, using ImGui::Text) between the
* following function calls. These functions have to be called before adding any attributes, or the
* layout of the node will be incorrect.
*/
public static native void beginNodeTitleBar(); /*
ImNodes::BeginNodeTitleBar();
*/
@BindingMethod
public static native void BeginNodeTitleBar();
public static native void endNodeTitleBar(); /*
ImNodes::EndNodeTitleBar();
*/
@BindingMethod
public static native void EndNodeTitleBar();
// Attributes are ImGui UI elements embedded within the node. Attributes can have pin shapes
// rendered next to them. Links are created between pins.
@@ -154,63 +150,105 @@ public final class ImNodes {
//
// Each attribute id must be unique.
/**
* Create a static attribute block. A static attribute has no pin, and therefore can't be linked to
* anything. However, you can still use IsAttributeActive() and IsAnyAttributeActive() to check for
* attribute activity.
*/
public static native void beginStaticAttribute(int id); /*
ImNodes::BeginStaticAttribute(id);
*/
public static native void endStaticAttribute(); /*
ImNodes::EndStaticAttribute();
*/
/**
* Create an input attribute block. The pin is rendered on left side.
*/
public static void beginInputAttribute(final int id) {
beginInputAttribute(id, ImNodesPinShape.CircleFilled);
}
public static native void beginInputAttribute(int id, int imNodesPinShape); /*
@BindingMethod
public static native void BeginInputAttribute(int id, @OptArg @ArgValue(staticCast = "ImNodesPinShape") int shape); /*
ImNodes::BeginInputAttribute(id, (ImNodesPinShape)imNodesPinShape);
*/
public static native void endInputAttribute(); /*
ImNodes::EndInputAttribute();
*/
@BindingMethod
public static native void EndInputAttribute();
/**
* Create an output attribute block. The pin is rendered on the right side.
*/
public static void beginOutputAttribute(final int id) {
beginOutputAttribute(id, ImNodesPinShape.CircleFilled);
}
@BindingMethod
public static native void BeginOutputAttribute(int id, @OptArg @ArgValue(staticCast = "ImNodesPinShape") int shape);
public static native void beginOutputAttribute(int id, int imNodesPinShape); /*
ImNodes::BeginOutputAttribute(id, (ImNodesPinShape)imNodesPinShape);
*/
@BindingMethod
public static native void EndOutputAttribute();
/**
* Create a static attribute block. A static attribute has no pin, and therefore can't be linked to
* anything. However, you can still use IsAttributeActive() and IsAnyAttributeActive() to check for
* attribute activity.
*/
@BindingMethod
public static native void BeginStaticAttribute(int id);
@BindingMethod
public static native void EndStaticAttribute();
/**
* Push a single AttributeFlags value. By default, only AttributeFlags_None is set.
*/
public static native void pushAttributeFlag(int imNodesAttributeFlags); /*
ImNodes::PushAttributeFlag((ImNodesAttributeFlags)imNodesAttributeFlags);
*/
@BindingMethod
public static native void PushAttributeFlag(@ArgValue(staticCast = "ImNodesAttributeFlags") int flag);
public static native void endOutputAttribute(); /*
ImNodes::EndOutputAttribute();
*/
@BindingMethod
public static native void PopAttributeFlag();
/**
* Render a link between attributes.
* The attributes ids used here must match the ids used in Begin(Input|Output)Attribute function
* calls. The order of source and target doesn't make a difference for rendering the link.
*/
@BindingMethod
public static native void Link(int id, int source, int target);
/**
* Enable or disable the ability to click and drag a specific node.
*/
@BindingMethod
public static native void SetNodeDraggable(int nodeId, boolean draggable);
// The node's position can be expressed in three coordinate systems:
// * screen space coordinates, -- the origin is the upper left corner of the window.
// * editor space coordinates -- the origin is the upper left corner of the node editor window
// * grid space coordinates, -- the origin is the upper left corner of the node editor window,
// translated by the current editor panning vector (see EditorContextGetPanning() and
// EditorContextResetPanning())
// Use the following functions to get and set the node's coordinates in these coordinate systems.
@BindingMethod
public static native void SetNodeScreenSpacePos(int nodeId, ImVec2 screenSpacePos);
@BindingMethod
public static native void SetNodeEditorSpacePos(int nodeId, ImVec2 editorSpacePos);
@BindingMethod
public static native void SetNodeGridSpacePos(int nodeId, ImVec2 gridPos);
@BindingMethod
public static native void GetNodeScreenSpacePos(int nodeId);
@BindingMethod
public static native void GetNodeEditorSpacePos(int nodeId);
@BindingMethod
public static native void GetNodeGridSpacePos(int nodeId);
/**
* Returns true if the current node editor canvas is being hovered over by the mouse, and is not
* blocked by any other windows.
*/
public static native boolean isEditorHovered(); /*
return ImNodes::IsEditorHovered();
*/
@BindingMethod
public static native boolean IsEditorHovered();
// The following functions return true if a UI element is being hovered over by the mouse cursor.
// Assigns the id of the UI element being hovered over to the function argument. Use these functions
// after EndNodeEditor() has been called.
@BindingMethod
public static native boolean IsNodeHovered(ImInt nodeId);
@BindingMethod
public static native boolean IsLinkHovered(ImInt linkId);
@BindingMethod
public static native boolean IsPinHovered(ImInt attributeId);
// Binding notice: getHoveredNode(), getHoveredLink() and getHoveredPin()
// return id of the hovered object. If there is no such object -1 will be returned.
@@ -243,6 +281,75 @@ public final class ImNodes {
return ImNodes::IsPinHovered(&i) ? i : -1;
*/
/**
* Use The following two functions to query the number of selected nodes or links in the current
* editor. Use after calling EndNodeEditor().
*/
@BindingMethod
public static native int NumSelectedNodes();
@BindingMethod
public static native int NumSelectedLinks();
/**
* Get the selected node/link ids. The pointer argument should point to an integer array with at
* least as many elements as the respective NumSelectedNodes/NumSelectedLinks function call
* returned.
*/
@BindingMethod
public static native void GetSelectedNodes(int[] nodeIds);
/**
* Get the selected node/link ids. The pointer argument should point to an integer array with at
* least as many elements as the respective NumSelectedNodes/NumSelectedLinks function call
* returned.
*/
@BindingMethod
public static native void GetSelectedLinks(int[] linkIds);
/**
* Clears the list of selected nodes/links. Useful if you want to delete a selected node or link.
*/
@BindingMethod
public static native void ClearNodeSelection();
/**
* Clears the list of selected nodes/links. Useful if you want to delete a selected node or link.
*/
@BindingMethod
public static native void ClearLinkSelection();
/**
* Manually select a node or link.
*/
@BindingMethod
public static native void SelectNode(int nodeId);
@BindingMethod
public static native void ClearNodeSelection(int nodeId);
@BindingMethod
public static native boolean IsNodeSelected(int nodeId);
@BindingMethod
public static native void SelectLink(int linkId);
@BindingMethod
public static native void ClearLinkSelection(int linkId);
@BindingMethod
public static native boolean IsLinkSelected(int linkId);
/**
* Was the previous attribute active? This will continuously return true while the left mouse button
* is being pressed over the UI content of the attribute.
*/
@BindingMethod
public static native boolean IsAttributeActive();
@BindingMethod
public static native boolean IsAnyAttributeActive(@OptArg ImInt attributeId);
/**
* Binding notice: getActiveAttribute() returns id the active attribute. If there is no active attribute -1 will be returned.
* <p>
@@ -253,27 +360,14 @@ public final class ImNodes {
return ImNodes::IsAnyAttributeActive(&i) ? i : -1;
*/
/**
* Was the previous attribute active? This will continuously return true while the left mouse button
* is being pressed over the UI content of the attribute.
*/
public static native boolean isAttributeActive(); /*
return ImNodes::IsAttributeActive();
*/
// Use the following functions to query a change of state for an existing link, or new link. Call
// these after EndNodeEditor().
/**
* Did the user start dragging a new link from a pin?
*/
public static boolean isLinkStarted(final ImInt startAtAttributeId) {
return nIsLinkStarted(startAtAttributeId.getData());
}
private static native boolean nIsLinkStarted(int[] data); /*
return ImNodes::IsLinkStarted(&data[0]);
*/
@BindingMethod
public static native boolean IsLinkStarted(ImInt startedAtAttributeId);
/**
* Did the user drop the dragged link before attaching it to a pin?
@@ -283,258 +377,52 @@ public final class ImNodes {
* Use the including_detached_links flag to control whether this function triggers when the user
* detaches a link and drops it.
*/
public static boolean isLinkDropped(final ImInt startedAtAttributeId, final boolean includingDetachedLinks) {
return nIsLinkDropped(startedAtAttributeId.getData(), includingDetachedLinks);
}
private static native boolean nIsLinkDropped(int[] data, boolean includingDetachedLinks); /*
return ImNodes::IsLinkDropped(&data[0], includingDetachedLinks);
*/
@BindingMethod
public static native boolean IsLinkDropped(@OptArg(callValue = "NULL") ImInt startedAtAttributeId, @OptArg boolean includingDetachedLinks);
/**
* Did the user finish creating a new link?
*/
public static boolean isLinkCreated(final ImInt startedAtAttributeId, final ImInt endedAtAttributeId) {
return nIsLinkCreated(startedAtAttributeId.getData(), endedAtAttributeId.getData());
}
@BindingMethod
public static native boolean IsLinkCreated(ImInt startedAtAttributeId, ImInt endedAtAttributeId, @OptArg ImBoolean createdFromSnap);
private static native boolean nIsLinkCreated(int[] sourceAttribute, int[] targetAttribute); /*
return ImNodes::IsLinkCreated(&sourceAttribute[0], &targetAttribute[0]);
*/
public static boolean isLinkCreated(final ImInt startedAtNodeId, final ImInt startedAtAttributeId,
final ImInt endedAtNodeId, final ImInt endedAtAttributeId,
final ImBoolean createdFromSnap) {
return nIsLinkCreated(startedAtNodeId.getData(), startedAtAttributeId.getData(), endedAtNodeId.getData(), endedAtAttributeId.getData(), createdFromSnap.getData());
}
private static native boolean nIsLinkCreated(int[] startedAtNodeId, int[] startedAtAttributeId, int[] endedAtNodeId, int[] endedAtAttributeId, boolean[] createdFromSnap); /*
return ImNodes::IsLinkCreated(&startedAtNodeId[0], &startedAtAttributeId[0], &endedAtNodeId[0], &endedAtAttributeId[0], &createdFromSnap[0]);
*/
/**
* Did the user finish creating a new link?
*/
@BindingMethod
public static native boolean IsLinkCreated(ImInt startedAtNodeId, ImInt startedAtAttributeId, ImInt endedAtNodeId, ImInt endedAtAttributeId, @OptArg ImBoolean createdFromSnap);
/**
* Was an existing link detached from a pin by the user? The detached link's id is assigned to the
* output argument link_id.
*/
public static boolean isLinkDestroyed(final ImInt linkId) {
return nIsLinkDestroyed(linkId.getData());
}
private static native boolean nIsLinkDestroyed(int[] linkId); /*
return ImNodes::IsLinkDestroyed(&linkId[0]);
*/
/**
* Use The following two functions to query the number of selected nodes or links in the current
* editor. Use after calling EndNodeEditor().
*/
public static native int numSelectedNodes(); /*
return ImNodes::NumSelectedNodes();
*/
public static native int numSelectedLinks(); /*
return ImNodes::NumSelectedLinks();
*/
/**
* Get the selected node/link ids. The pointer argument should point to an integer array with at
* least as many elements as the respective NumSelectedNodes/NumSelectedLinks function call
* returned.
*/
public static native void getSelectedNodes(int[] nodeIds); /*
ImNodes::GetSelectedNodes(&nodeIds[0]);
*/
public static native void getSelectedLinks(int[] linkIds); /*
ImNodes::GetSelectedLinks(&linkIds[0]);
*/
/**
* Clears the list of selected nodes/links. Useful if you want to delete a selected node or link.
*/
public static native void clearNodeSelection(); /*
ImNodes::ClearNodeSelection();
*/
public static native void clearNodeSelection(int node); /*
ImNodes::ClearNodeSelection(node);
*/
public static native void clearLinkSelection(); /*
ImNodes::ClearLinkSelection();
*/
public static native void clearLinkSelection(int link); /*
ImNodes::ClearLinkSelection(link);
*/
/**
* Manually select a node or link.
*/
public static native void selectNode(int node); /*
ImNodes::SelectNode(node);
*/
public static native void selectLink(int link); /*
ImNodes::SelectLink(link);
*/
/**
* Check if a a specified node/link is selected.
*/
public static native boolean isNodeSelected(int node); /*
return ImNodes::IsNodeSelected(node);
*/
public static native boolean isLinkSelected(int link); /*
return ImNodes::IsLinkSelected(link);
*/
/**
* Enable or disable the ability to click and drag a specific node.
*/
public static native void setNodeDraggable(int node, boolean isDraggable); /*
ImNodes::SetNodeDraggable(node, isDraggable);
*/
public static native void getNodeDimensions(int node, ImVec2 result); /*
ImVec2 dst = ImNodes::GetNodeDimensions(node);
Jni::ImVec2Cpy(env, &dst, result);
*/
public static native float getNodeDimensionsX(int node); /*
return ImNodes::GetNodeDimensions(node).x;
*/
public static native float getNodeDimensionsY(int node); /*
return ImNodes::GetNodeDimensions(node).y;
*/
// The node's position can be expressed in three coordinate systems:
// * screen space coordinates, -- the origin is the upper left corner of the window.
// * editor space coordinates -- the origin is the upper left corner of the node editor window
// * grid space coordinates, -- the origin is the upper left corner of the node editor window,
// translated by the current editor panning vector (see EditorContextGetPanning() and
// EditorContextResetPanning())
// Use the following functions to get and set the node's coordinates in these coordinate systems.
public static native void setNodeScreenSpacePos(int node, float x, float y); /*
ImNodes::SetNodeScreenSpacePos(node, ImVec2(x, y));
*/
public static native void setNodeEditorSpacePos(int node, float x, float y); /*
ImNodes::SetNodeEditorSpacePos(node, ImVec2(x, y));
*/
public static native void setNodeGridSpacePos(int node, float x, float y); /*
ImNodes::SetNodeGridSpacePos(node, ImVec2(x, y));
*/
public static native void getNodeScreenSpacePos(int node, ImVec2 result); /*
ImVec2 dst = ImNodes::GetNodeScreenSpacePos(node);
Jni::ImVec2Cpy(env, &dst, result);
*/
public static native float getNodeScreenSpacePosX(int node); /*
return ImNodes::GetNodeScreenSpacePos(node).x;
*/
public static native float getNodeScreenSpacePosY(int node); /*
return ImNodes::GetNodeScreenSpacePos(node).y;
*/
public static native void getNodeEditorSpacePos(int node, ImVec2 result); /*
ImVec2 dst = ImNodes::GetNodeEditorSpacePos(node);
Jni::ImVec2Cpy(env, &dst, result);
*/
public static native float getNodeEditorSpacePosX(int node); /*
return ImNodes::GetNodeEditorSpacePos(node).x;
*/
public static native float getNodeEditorSpacePosY(int node); /*
return ImNodes::GetNodeEditorSpacePos(node).y;
*/
public static native void getNodeGridSpacePos(int node, ImVec2 dst); /*
ImVec2 result = ImNodes::GetNodeGridSpacePos(node);
Jni::ImVec2Cpy(env, &result, dst);
*/
public static native float getNodeGridSpacePosX(int node); /*
return ImNodes::GetNodeGridSpacePos(node).x;
*/
public static native float getNodeGridSpacePosY(int node); /*
return ImNodes::GetNodeGridSpacePos(node).y;
*/
public static native void editorResetPanning(float x, float y); /*
ImNodes::EditorContextResetPanning(ImVec2(x, y));
*/
public static native void editorContextGetPanning(ImVec2 result); /*
ImVec2 dst = ImNodes::EditorContextGetPanning();
Jni::ImVec2Cpy(env, &dst, result);
*/
public static native void editorMoveToNode(int node); /*
ImNodes::EditorContextMoveToNode(node);
*/
@BindingMethod
public static native boolean IsLinkDestroyed(ImInt linkId);
// Use the following functions to write the editor context's state to a string, or directly to a
// file. The editor context is serialized in the INI file format.
public static native String saveCurrentEditorStateToIniString(); /*
return env->NewStringUTF(ImNodes::SaveCurrentEditorStateToIniString(NULL));
*/
@BindingMethod
public static native String SaveCurrentEditorStateToIniString();
public static String saveEditorStateToIniString(final ImNodesContext context) {
return nSaveEditorStateToIniString(context.ptr);
}
@BindingMethod
public static native String SaveEditorStateToIniString(ImNodesEditorContext editor);
private static native String nSaveEditorStateToIniString(long context); /*
return env->NewStringUTF(ImNodes::SaveEditorStateToIniString((ImNodesEditorContext*)context, NULL));
*/
@BindingMethod
public static native void LoadCurrentEditorStateFromIniString(String data, int dataSize);
public static native void loadCurrentEditorStateFromIniString(String data, int dataSize); /*
ImNodes::LoadCurrentEditorStateFromIniString(data, dataSize);
*/
@BindingMethod
public static native void LoadEditorStateFromIniString(ImNodesEditorContext editor, String data, int dataSize);
public static void loadEditorStateFromIniString(final ImNodesContext context, final String data, final int dataSize) {
nLoadEditorStateFromIniString(context.ptr, data, dataSize);
}
@BindingMethod
public static native void SaveCurrentEditorStateToIniFile(String fileName);
private static native void nLoadEditorStateFromIniString(long context, String data, int dataSize); /*
ImNodes::LoadEditorStateFromIniString((ImNodesEditorContext*)context, data, dataSize);
*/
@BindingMethod
public static native void SaveEditorStateToIniFile(ImNodesEditorContext editor, String fileName);
public static native void saveCurrentEditorStateToIniFile(String fileName); /*
ImNodes::SaveCurrentEditorStateToIniFile(fileName);
*/
@BindingMethod
public static native void LoadCurrentEditorStateFromIniFile(String fileName);
public static void saveEditorStateToIniFile(final ImNodesContext context, final String fileName) {
nSaveEditorStateToIniFile(context.ptr, fileName);
}
private static native void nSaveEditorStateToIniFile(long context, String fileName); /*
ImNodes::SaveEditorStateToIniFile((ImNodesEditorContext*)context, fileName);
*/
public static native void loadCurrentEditorStateFromIniFile(String fileName); /*
ImNodes::LoadCurrentEditorStateFromIniFile(fileName);
*/
public static void loadEditorStateFromIniFile(final ImNodesContext context, final String fileName) {
nLoadEditorStateFromIniFile(context.ptr, fileName);
}
private static native void nLoadEditorStateFromIniFile(long context, String fileName); /*
ImNodes::LoadEditorStateFromIniFile((ImNodesEditorContext*)context, fileName);
*/
public static native void miniMap(float miniMapSizeFraction, int miniMapLocation); /*
ImNodes::MiniMap(miniMapSizeFraction, (ImNodesMiniMapLocation)miniMapLocation);
*/
@BindingMethod
public static native void LoadEditorStateFromIniFile(ImNodesEditorContext editor, String fileName);
}
@@ -1,36 +1,9 @@
package imgui.extension.imnodes;
import imgui.binding.ImGuiStructDestroyable;
public final class ImNodesContext extends ImGuiStructDestroyable {
public ImNodesContext() {
}
import imgui.binding.ImGuiStruct;
public final class ImNodesContext extends ImGuiStruct {
public ImNodesContext(final long ptr) {
super(ptr);
}
/*JNI
#include "_imnodes.h"
#define IMNODES_CONTEXT ((ImNodesEditorContext*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
@Override
public void destroy() {
nDestroy();
}
private native long nCreate(); /*
return (intptr_t)ImNodes::EditorContextCreate();
*/
private native void nDestroy(); /*
ImNodes::EditorContextFree(IMNODES_CONTEXT);
*/
}
@@ -0,0 +1,9 @@
package imgui.extension.imnodes;
import imgui.binding.ImGuiStruct;
public final class ImNodesEditorContext extends ImGuiStruct {
public ImNodesEditorContext(final long ptr) {
super(ptr);
}
}
@@ -0,0 +1,34 @@
package imgui.extension.imnodes;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImNodesIO extends ImGuiStruct {
public ImNodesIO(final long ptr) {
super(ptr);
}
/*JNI
#include "_imnodes.h"
#define THIS ((ImNodesIO*)STRUCT_PTR)
*/
/**
* Holding alt mouse button pans the node area, by default middle mouse button will be used
* Set based on ImGuiMouseButton values
*/
@BindingField
public int AltMouseButton;
/**
* Panning speed when dragging an element and mouse is outside the main editor view.
*/
@BindingField
public float AutoPanningSpeed;
/*JNI
#undef THIS
*/
}
@@ -1,8 +1,13 @@
package imgui.extension.imnodes;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.binding.ImGuiStruct;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.TypeArray;
@BindingSource
public final class ImNodesStyle extends ImGuiStruct {
public ImNodesStyle(final long ptr) {
super(ptr);
@@ -10,183 +15,89 @@ public final class ImNodesStyle extends ImGuiStruct {
/*JNI
#include "_imnodes.h"
#define IMNODES_STYLE ((ImNodesStyle*)STRUCT_PTR)
#define THIS ((ImNodesStyle*)STRUCT_PTR)
*/
public native float getGridSpacing(); /*
return IMNODES_STYLE->GridSpacing;
*/
@BindingField
public float GridSpacing;
public native void setGridSpacing(float gridSpacing); /*
IMNODES_STYLE->GridSpacing = gridSpacing;
*/
@BindingField
public float NodeCornerRounding;
public native float getNodeCornerRounding(); /*
return IMNODES_STYLE->NodeCornerRounding;
*/
@BindingField
public ImVec2 NodePadding;
public native void setNodeCornerRounding(float nodeCornerRounding); /*
IMNODES_STYLE->NodeCornerRounding = nodeCornerRounding;
*/
@BindingField
public float NodeBorderThickness;
public native void getNodePadding(ImVec2 result); /*
Jni::ImVec2Cpy(env, &IMNODES_STYLE->NodePadding, result);
*/
@BindingField
public float LinkThickness;
public native void setNodePadding(float x, float y); /*
IMNODES_STYLE->NodePadding = ImVec2(x, y);
*/
@BindingField
public float LinkLineSegmentsPerLength;
public native float getNodeBorderThickness(); /*
return IMNODES_STYLE->NodeBorderThickness;
*/
public native void setNodeBorderThickness(float nodeBorderThickness); /*
IMNODES_STYLE->NodeBorderThickness = nodeBorderThickness;
*/
public native float getLinkThickness(); /*
return IMNODES_STYLE->LinkThickness;
*/
public native void setLinkThickness(float linkThickness); /*
IMNODES_STYLE->LinkThickness = linkThickness;
*/
public native float getLinkLineSegmentsPerLength(); /*
return IMNODES_STYLE->LinkLineSegmentsPerLength;
*/
public native void setLinkLineSegmentsPerLength(float linkLineSegmentsPerLength); /*
IMNODES_STYLE->LinkLineSegmentsPerLength = linkLineSegmentsPerLength;
*/
public native float getLinkHoverDistance(); /*
return IMNODES_STYLE->LinkHoverDistance;
*/
public native void setLinkHoverDistance(float linkHoverDistance); /*
IMNODES_STYLE->LinkHoverDistance = linkHoverDistance;
*/
@BindingField
public float LinkHoverDistance;
/**
* The circle radius used when the pin shape is either PinShape_Circle or PinShape_CircleFilled.
*/
public native float getPinCircleRadius(); /*
return IMNODES_STYLE->PinCircleRadius;
*/
/**
* The circle radius used when the pin shape is either PinShape_Circle or PinShape_CircleFilled.
*/
public native void setPinCircleRadius(float pinCircleRadius); /*
IMNODES_STYLE->PinCircleRadius = pinCircleRadius;
*/
@BindingField
public float PinCircleRadius;
/**
* The quad side length used when the shape is either PinShape_Quad or PinShape_QuadFilled.
*/
public native float getPinQuadSideLength(); /*
return IMNODES_STYLE->PinQuadSideLength;
*/
/**
* The quad side length used when the shape is either PinShape_Quad or PinShape_QuadFilled.
*/
public native void setPinQuadSideLength(float pinQuadSideLength); /*
IMNODES_STYLE->PinQuadSideLength = pinQuadSideLength;
*/
@BindingField
public float PinQuadSideLength;
/**
* The equilateral triangle side length used when the pin shape is either PinShape_Triangle or PinShape_TriangleFilled.
*/
public native float getPinTriangleSideLength(); /*
return IMNODES_STYLE->PinTriangleSideLength;
*/
/**
* The equilateral triangle side length used when the pin shape is either PinShape_Triangle or PinShape_TriangleFilled.
*/
public native void setPinTriangleSideLength(float pinTriangleSideLength); /*
IMNODES_STYLE->PinTriangleSideLength = pinTriangleSideLength;
*/
@BindingField
public float PinTriangleSideLength;
/**
* The thickness of the line used when the pin shape is not filled.
*/
public native float getPinLineThickness(); /*
return IMNODES_STYLE->PinLineThickness;
*/
/**
* The thickness of the line used when the pin shape is not filled.
*/
public native void setPinLineThickness(float pinLineThickness); /*
IMNODES_STYLE->PinLineThickness = pinLineThickness;
*/
@BindingField
public float PinLineThickness;
/**
* The radius from the pin's center position inside of which it is detected as being hovered over.
*/
public native float getPinHoverRadius(); /*
return IMNODES_STYLE->PinHoverRadius;
*/
/**
* The radius from the pin's center position inside of which it is detected as being hovered over.
*/
public native void setPinHoverRadius(float pinHoverRadius); /*
IMNODES_STYLE->PinHoverRadius = pinHoverRadius;
*/
@BindingField
public float PinHoverRadius;
/**
* Offsets the pins' positions from the edge of the node to the outside of the node.
*/
public native float getPinOffset(); /*
return IMNODES_STYLE->PinOffset;
*/
/**
* Offsets the pins' positions from the edge of the node to the outside of the node.
*/
public native void setPinOffset(float pinOffset); /*
IMNODES_STYLE->PinOffset = pinOffset;
*/
@BindingField
public float PinOffset;
/**
* Mini-map padding size between mini-map edge and mini-map content.
*/
public native void getMiniMapPadding(ImVec2 result); /*
Jni::ImVec2Cpy(env, &IMNODES_STYLE->MiniMapPadding, result);
*/
/**
* Mini-map padding size between mini-map edge and mini-map content.
*/
public native void setMiniMapPadding(float x, float y); /*
IMNODES_STYLE->MiniMapPadding = ImVec2(x, y);
*/
@BindingField
public ImVec2 MiniMapPadding;
/**
* Mini-map offset from the screen side.
*/
public native ImVec2 getMiniMapOffset(ImVec2 result); /*
Jni::ImVec2Cpy(env, &IMNODES_STYLE->MiniMapOffset, result);
*/
@BindingField
public ImVec2 MiniMapOffset;
/**
* Mini-map offset from the screen side.
* By default, ImNodesStyleFlags_NodeOutline and ImNodesStyleFlags_Gridlines are enabled.
*/
public native void setMiniMapOffset(float x, float y); /*
IMNODES_STYLE->MiniMapOffset = ImVec2(x, y);
*/
@BindingField(isFlag = true)
public int Flags;
public native int getFlags(); /*
return IMNODES_STYLE->Flags;
*/
@BindingField
@TypeArray(type = "int", size = "ImNodesCol_COUNT")
public int[] Colors;
public native void setFlags(int imNodesStyleFlags); /*
IMNODES_STYLE->Flags = (ImNodesStyleFlags)imNodesStyleFlags;
*/
/*JNI
#undef THIS
*/
}
@@ -1,28 +1,16 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* This enum controls the way the attribute pins behave.
*/
@BindingSource
public final class ImNodesAttributeFlags {
private ImNodesAttributeFlags() {
}
public static final int None = 0;
/**
* Allow detaching a link by left-clicking and dragging the link at a pin it is connected to.
* NOTE: the user has to actually delete the link for this to work. A deleted link can be
* detected by calling IsLinkDestroyed() after EndNodeEditor().
*/
public static final int EnableLinkDetachWithDragClick = 1;
/**
* Visual snapping of an in progress link will trigger IsLink Created/Destroyed events. Allows
* for previewing the creation of a link while dragging it across attributes. See here for demo:
* https://github.com/Nelarius/imnodes/issues/41#issuecomment-647132113 NOTE: the user has to
* actually delete the link for this to work. A deleted link can be detected by calling
* IsLinkDestroyed() after EndNodeEditor().
*/
public static final int EnableLinkCreationOnSnap = 1 << 1;
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesAttributeFlags_")
public Void __;
}
@@ -0,0 +1,13 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImNodesCol {
private ImNodesCol() {
}
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesCol_")
public Void __;
}
@@ -1,36 +0,0 @@
package imgui.extension.imnodes.flag;
public final class ImNodesColorStyle {
private ImNodesColorStyle() {
}
public static final int NodeBackground = 0;
public static final int NodeBackgroundHovered = 1;
public static final int NodeBackgroundSelected = 2;
public static final int NodeOutline = 3;
public static final int TitleBar = 4;
public static final int TitleBarHovered = 5;
public static final int TitleBarSelected = 6;
public static final int Link = 7;
public static final int LinkHovered = 8;
public static final int LinkSelected = 9;
public static final int Pin = 10;
public static final int PinHovered = 11;
public static final int BoxSelector = 12;
public static final int BoxSelectorOutline = 13;
public static final int GridBackground = 14;
public static final int GridLine = 15;
public static final int MiniMapBackground = 16;
public static final int MiniMapBackgroundHovered = 17;
public static final int MiniMapOutline = 18;
public static final int MiniMapOutlineHovered = 19;
public static final int MiniMapNodeBackground = 20;
public static final int MiniMapNodeBackgroundHovered = 21;
public static final int MiniMapNodeBackgroundSelected = 22;
public static final int MiniMapNodeOutline = 23;
public static final int MiniMapLink = 24;
public static final int MiniMapLinkSelected = 25;
public static final int MiniMapCanvas = 26;
public static final int MiniMapCanvasOutline = 27;
public static final int COUNT = 28;
}
@@ -1,14 +1,16 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* This enum controls the minimap's location.
*/
@BindingSource
public final class ImNodesMiniMapLocation {
private ImNodesMiniMapLocation() {
}
public static final int BottomLeft = 0;
public static final int BottomRight = 1;
public static final int TopLeft = 2;
public static final int TopRight = 3;
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesMiniMapLocation_")
public Void __;
}
@@ -1,16 +1,16 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* This enum controls the way attribute pins look.
*/
@BindingSource
public final class ImNodesPinShape {
private ImNodesPinShape() {
}
public static final int Circle = 0;
public static final int CircleFilled = 1;
public static final int Triangle = 2;
public static final int TriangleFilled = 3;
public static final int Quad = 4;
public static final int QuadFilled = 5;
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesPinShape_")
public Void __;
}
@@ -1,10 +1,13 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImNodesStyleFlags {
private ImNodesStyleFlags() {
}
public static final int None = 0;
public static final int NodeOutline = 1;
public static final int GridLines = 1 << 2;
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesStyleFlags_")
public Void __;
}
@@ -1,22 +1,13 @@
package imgui.extension.imnodes.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImNodesStyleVar {
private ImNodesStyleVar() {
}
public static final int GridSpacing = 0;
public static final int NodeCornerRounding = 1;
public static final int NodePadding = 2;
public static final int NodeBorderThickness = 3;
public static final int LinkThickness = 4;
public static final int LinkLineSegmentsPerLength = 5;
public static final int LinkHoverDistance = 6;
public static final int PinCircleRadius = 7;
public static final int PinQuadSideLength = 8;
public static final int PinTriangleSideLength = 9;
public static final int PinLineThickness = 10;
public static final int PinHoverRadius = 11;
public static final int PinOffset = 12;
public static final int MiniMapPadding = 13;
public static final int MiniMapOffset = 14;
@BindingAstEnum(file = "ast-imnodes.json", qualType = "ImNodesStyleVar_")
public Void __;
}
File diff suppressed because it is too large. Load diff
@@ -1,119 +1,93 @@
package imgui.extension.implot;
import imgui.ImVec2;
import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotLimits extends ImGuiStructDestroyable {
public ImPlotLimits(final long ptr) {
super(ptr);
}
import java.util.Objects;
public final class ImPlotLimits implements Cloneable {
public final ImPlotRange x = new ImPlotRange();
public final ImPlotRange y = new ImPlotRange();
public ImPlotLimits() {
this(0, 0, 0, 0);
}
public ImPlotLimits(final double xMin, final double xMax, final double yMin, final double yMax) {
this(0);
ptr = create(xMin, xMax, yMin, yMax);
public ImPlotLimits(final double xMin, final double yMin, final double xMax, final double yMax) {
set(xMin, yMin, xMax, yMax);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotLimits(final ImVec2 min, final ImVec2 max) {
set(min, max);
}
#define IMPLOT_LIMITS ((ImPlotLimits*)STRUCT_PTR)
*/
public ImPlotLimits(final ImPlotLimits value) {
set(value);
}
public boolean contains(final double x, final double y) {
return this.x.contains(x) && this.y.contains(y);
}
public boolean contains(final ImPlotPoint value) {
return contains(value.x, value.y);
}
public ImPlotPoint min() {
return new ImPlotPoint(x.min, y.min);
}
public ImPlotPoint max() {
return new ImPlotPoint(x.max, y.max);
}
public void set(final double xMin, final double yMin, final double xMax, final double yMax) {
this.x.min = xMin;
this.x.max = xMax;
this.y.min = yMin;
this.y.max = yMax;
}
public void set(final ImVec2 min, final ImVec2 max) {
set(min.x, min.y, max.x, max.y);
}
public void set(final ImPlotRange x, final ImPlotRange y) {
set(x.min, y.min, x.max, y.max);
}
public void set(final ImPlotLimits value) {
set(value.x, value.y);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotLimits(0, 0, 0, 0));
*/
protected native long create(double xMin, double xMax, double yMin, double yMax); /*
return (intptr_t)(new ImPlotLimits(xMin, xMax, yMin, yMax));
*/
public boolean contains(final ImPlotPoint plotPoint) {
return contains(plotPoint.getX(), plotPoint.getY());
public String toString() {
return "ImPlotLimits{"
+ "x=" + x
+ ", y=" + y
+ '}';
}
public native boolean contains(double x, double y); /*
return IMPLOT_LIMITS->Contains(x, y);
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
/**
* Returns the same as min(), but instead as an ImVec2.
*/
public ImVec2 minVec() {
final ImPlotPoint val = min();
final ImVec2 vec = new ImVec2((float) val.getX(), (float) val.getY());
val.destroy();
return vec;
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotLimits imPlotLimits = (ImPlotLimits) o;
return Objects.equals(x, imPlotLimits.x) && Objects.equals(y, imPlotLimits.y);
}
/**
* The returned ImPlotPoint should be manually deallocated with destroy()!
*/
public ImPlotPoint min() {
return new ImPlotPoint(nMin());
@Override
public int hashCode() {
return Objects.hash(x, y);
}
private native long nMin(); /*
ImPlotPoint* p = new ImPlotPoint(IMPLOT_LIMITS->Min());
return (intptr_t)p;
*/
/**
* The returned ImPlotPoint should be manually deallocated with destroy()!
*/
public ImPlotPoint max() {
return new ImPlotPoint(nMax());
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotLimits clone() {
return new ImPlotLimits(this);
}
/**
* Returns the same as max(), but instead as an ImVec2.
*/
public ImVec2 maxVec() {
final ImPlotPoint val = max();
final ImVec2 vec = new ImVec2((float) val.getX(), (float) val.getY());
val.destroy();
return vec;
}
private native long nMax(); /*
ImPlotPoint* p = new ImPlotPoint(IMPLOT_LIMITS->Max());
return (intptr_t)p;
*/
public ImPlotRange getX() {
return new ImPlotRange(nGetX(this.ptr));
}
private native long nGetX(long ptr); /*
return (intptr_t)&(IMPLOT_LIMITS->X);
*/
public ImPlotRange getY() {
return new ImPlotRange(nGetY(this.ptr));
}
private native long nGetY(long ptr); /*
return (intptr_t)&(IMPLOT_LIMITS->Y);
*/
public void setX(final ImPlotRange value) {
nSetX(value.ptr);
}
private native void nSetX(long valueptr); /*
IMPLOT_LIMITS->X = *((ImPlotRange*)valueptr);
*/
public void setY(final ImPlotRange value) {
nSetY(value.ptr);
}
private native void nSetY(long valueptr); /*
IMPLOT_LIMITS->Y = *((ImPlotRange*)valueptr);
*/
}
@@ -1,55 +1,100 @@
package imgui.extension.implot;
import imgui.ImVec2;
import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotPoint extends ImGuiStructDestroyable {
public ImPlotPoint(final long ptr) {
super(ptr);
}
import java.util.Objects;
public final class ImPlotPoint implements Cloneable {
public double x;
public double y;
public ImPlotPoint() {
this(0, 0);
}
public ImPlotPoint(final ImVec2 vec) {
this(vec.x, vec.y);
}
public ImPlotPoint(final double x, final double y) {
this(0);
ptr = create(x, y);
set(x, y);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotPoint(final ImVec2 value) {
set(value.x, value.y);
}
#define IMPLOT_POINT ((ImPlotPoint*)STRUCT_PTR)
*/
public ImPlotPoint(final ImPlotPoint value) {
set(value.x, value.y);
}
public ImPlotPoint set(final double x, final double y) {
this.x = x;
this.y = y;
return this;
}
public ImPlotPoint set(final ImPlotPoint value) {
return set(value.x, value.y);
}
public ImPlotPoint set(final ImVec2 value) {
return set(value.x, value.y);
}
public ImPlotPoint plus(final double x, final double y) {
this.x += x;
this.y += y;
return this;
}
public ImPlotPoint plus(final ImPlotPoint value) {
return plus(value.x, value.y);
}
public ImPlotPoint minus(final double x, final double y) {
this.x -= x;
this.y -= y;
return this;
}
public ImPlotPoint minus(final ImPlotPoint value) {
return minus(value.x, value.y);
}
public ImPlotPoint times(final double x, final double y) {
this.x *= x;
this.y *= y;
return this;
}
public ImPlotPoint times(final ImPlotPoint value) {
return times(value.x, value.y);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotPoint(0, 0));
*/
public String toString() {
return "ImPlotPoint{"
+ "x=" + x
+ ", y=" + y
+ '}';
}
protected native long create(double x, double y); /*
return (intptr_t)(new ImPlotPoint(x, y));
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotPoint imPlotPoint = (ImPlotPoint) o;
return Double.compare(imPlotPoint.x, x) == 0 && Double.compare(imPlotPoint.y, y) == 0;
}
public native double getX(); /*
return IMPLOT_POINT->x;
*/
@Override
public int hashCode() {
return Objects.hash(x, y);
}
public native double getY(); /*
return IMPLOT_POINT->y;
*/
public native void setX(double value); /*
IMPLOT_POINT->x = value;
*/
public native void setY(double value); /*
IMPLOT_POINT->y = value;
*/
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotPoint clone() {
return new ImPlotPoint(this);
}
}
@@ -1,58 +1,98 @@
package imgui.extension.implot;
import imgui.binding.ImGuiStructDestroyable;
import java.util.Objects;
public final class ImPlotRange extends ImGuiStructDestroyable {
public ImPlotRange(final long ptr) {
super(ptr);
}
public final class ImPlotRange implements Cloneable {
public double min;
public double max;
public ImPlotRange() {
this(0, 0);
}
public ImPlotRange(final double min, final double max) {
this(0);
ptr = create(min, max);
set(min, max);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotRange(final ImPlotRange value) {
set(value.min, value.max);
}
#define IMPLOT_RANGE ((ImPlotRange*)STRUCT_PTR)
*/
public boolean contains(final double value) {
return value >= min && value <= max;
}
public double size() {
return max - min;
}
public ImPlotRange set(final double min, final double max) {
this.min = min;
this.max = max;
return this;
}
public ImPlotRange set(final ImPlotRange value) {
return set(value.min, value.max);
}
public ImPlotRange plus(final double min, final double max) {
this.min += min;
this.max += max;
return this;
}
public ImPlotRange plus(final ImPlotRange value) {
return plus(value.min, value.max);
}
public ImPlotRange minus(final double min, final double max) {
this.min -= min;
this.max -= max;
return this;
}
public ImPlotRange minus(final ImPlotRange value) {
return minus(value.min, value.max);
}
public ImPlotRange times(final double min, final double max) {
this.min *= min;
this.max *= max;
return this;
}
public ImPlotRange times(final ImPlotRange value) {
return times(value.min, value.max);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotRange(0, 0));
*/
public String toString() {
return "ImPlotRange{"
+ "min=" + min
+ ", max=" + max
+ '}';
}
protected native long create(double min, double max); /*
return (intptr_t)(new ImPlotRange(min, max));
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotRange ImPlotRange = (ImPlotRange) o;
return Double.compare(ImPlotRange.min, min) == 0 && Double.compare(ImPlotRange.max, max) == 0;
}
public native boolean contains(double value); /*
return IMPLOT_RANGE->Contains(value);
*/
@Override
public int hashCode() {
return Objects.hash(min, max);
}
public native double size(); /*
return IMPLOT_RANGE->Size();
*/
public native double getMin(); /*
return IMPLOT_RANGE->Min;
*/
public native double getMax(); /*
return IMPLOT_RANGE->Max;
*/
public native void setMin(double min); /*
IMPLOT_RANGE->Min = min;
*/
public native void nSetMax(double max); /*
IMPLOT_RANGE->Max = max;
*/
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotRange clone() {
return new ImPlotRange(this);
}
}
@@ -2,524 +2,135 @@ package imgui.extension.implot;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.binding.ImGuiStruct;
import imgui.extension.implot.flag.ImPlotCol;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.TypeArray;
@BindingSource
public final class ImPlotStyle extends ImGuiStructDestroyable {
public ImPlotStyle() {
}
public final class ImPlotStyle extends ImGuiStruct {
public ImPlotStyle(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#include "_implot.h"
#define IMPLOT_STYLE ((ImPlotStyle*)STRUCT_PTR)
#define THIS ((ImPlotStyle*)STRUCT_PTR)
*/
//Line weight
public native float getLineWeight(); /*
return IMPLOT_STYLE->LineWeight;
private native long nCreate(); /*
return (intptr_t)(new ImPlotStyle());
*/
public native void setLineWeight(float lineWeight); /*
IMPLOT_STYLE->LineWeight = lineWeight;
*/
//Marker
public native int getMarker(); /*
return IMPLOT_STYLE->Marker;
*/
public native void setMarker(float input); /*
IMPLOT_STYLE->Marker = input;
*/
//Marker size
public native float getMarkerSize(); /*
return IMPLOT_STYLE->MarkerSize;
*/
public native void setMarkerSize(float input); /*
IMPLOT_STYLE->MarkerSize = input;
*/
//Marker weight
public native float getMarkerWeight(); /*
return IMPLOT_STYLE->MarkerWeight;
*/
public native void setMarkerWeight(float input); /*
IMPLOT_STYLE->MarkerWeight = input;
*/
//Fill alpha
public native float getFillAlpha(); /*
return IMPLOT_STYLE->FillAlpha;
*/
public native void setFillAlpha(float input); /*
IMPLOT_STYLE->FillAlpha = input;
*/
//Error bar size
public native float getErrorBarSize(); /*
return IMPLOT_STYLE->ErrorBarSize;
*/
public native void setErrorBarSize(float input); /*
IMPLOT_STYLE->ErrorBarSize = input;
*/
//Error bar weight
public native float getErrorBarWeight(); /*
return IMPLOT_STYLE->ErrorBarWeight;
*/
public native void setErrorBarWeight(float input); /*
IMPLOT_STYLE->ErrorBarWeight = input;
*/
//Digital big height
public native float getDigitalBitHeight(); /*
return IMPLOT_STYLE->DigitalBitHeight;
*/
public native void setDigitalBitHeight(float input); /*
IMPLOT_STYLE->DigitalBitHeight = input;
*/
//Digital bit gap
public native float getDigitalBitGap(); /*
return IMPLOT_STYLE->DigitalBitGap;
*/
public native void setDigitalBitGap(float input); /*
IMPLOT_STYLE->DigitalBitGap = input;
*/
//Plot border size
public native float getPlotBorderSize(); /*
return IMPLOT_STYLE->PlotBorderSize;
*/
public native void setPlotBorderSize(float input); /*
IMPLOT_STYLE->PlotBorderSize = input;
*/
//Minor alpha
public native float getMinorAlpha(); /*
return IMPLOT_STYLE->MinorAlpha;
*/
public native void setMinorAlpha(float input); /*
IMPLOT_STYLE->MinorAlpha = input;
*/
//Major tick length
public ImVec2 getMajorTickLen() {
final ImVec2 vec = new ImVec2();
nGetMajorTickLen(vec);
return vec;
}
private native void nGetMajorTickLen(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorTickLen, vec);
*/
public void setMajorTickLen(final ImVec2 majorTickLen) {
nSetMajorTickLen(majorTickLen.x, majorTickLen.y);
}
private native void nSetMajorTickLen(float x, float y); /*
IMPLOT_STYLE->MajorTickLen = ImVec2(x, y);
*/
//Minor tick length
public ImVec2 getMinorTickLen() {
final ImVec2 vec = new ImVec2();
nGetMinorTickLen(vec);
return vec;
}
private native void nGetMinorTickLen(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorTickLen, vec);
*/
public void setMinorTickLen(final ImVec2 minorTickLen) {
nSetMinorTickLen(minorTickLen.x, minorTickLen.y);
}
private native void nSetMinorTickLen(float x, float y); /*
IMPLOT_STYLE->MinorTickLen = ImVec2(x, y);
*/
//Major tick size
public ImVec2 getMajorTickSize() {
final ImVec2 vec = new ImVec2();
nGetMajorTickSize(vec);
return vec;
}
private native void nGetMajorTickSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorTickSize, vec);
*/
public void setMajorTickSize(final ImVec2 majorTickSize) {
nSetMajorTickSize(majorTickSize.x, majorTickSize.y);
}
private native void nSetMajorTickSize(float x, float y); /*
IMPLOT_STYLE->MajorTickSize = ImVec2(x, y);
*/
//Minor tick size
public ImVec2 getMinorTickSize() {
final ImVec2 vec = new ImVec2();
nGetMinorTickSize(vec);
return vec;
}
private native void nGetMinorTickSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorTickSize, vec);
*/
public void setMinorTickSize(final ImVec2 minorTickSize) {
nSetMinorTickSize(minorTickSize.x, minorTickSize.y);
}
private native void nSetMinorTickSize(float x, float y); /*
IMPLOT_STYLE->MinorTickSize = ImVec2(x, y);
*/
//Major grid size
public ImVec2 getMajorGridSize() {
final ImVec2 vec = new ImVec2();
nGetMajorGridSize(vec);
return vec;
}
private native void nGetMajorGridSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorGridSize, vec);
*/
public void setMajorGridSize(final ImVec2 majorGridSize) {
nSetMajorGridSize(majorGridSize.x, majorGridSize.y);
}
private native void nSetMajorGridSize(float x, float y); /*
IMPLOT_STYLE->MajorGridSize = ImVec2(x, y);
*/
//Minor grid size
public ImVec2 getMinorGridSize() {
final ImVec2 vec = new ImVec2();
nGetMinorGridSize(vec);
return vec;
}
private native void nGetMinorGridSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorGridSize, vec);
*/
public void setMinorGridSize(final ImVec2 minorGridSize) {
nSetMinorGridSize(minorGridSize.x, minorGridSize.y);
}
private native void nSetMinorGridSize(float x, float y); /*
IMPLOT_STYLE->MinorGridSize = ImVec2(x, y);
*/
//Plot padding
public ImVec2 getPlotPadding() {
final ImVec2 vec = new ImVec2();
nGetPlotPadding(vec);
return vec;
}
private native void nGetPlotPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotPadding, vec);
*/
public void setPlotPadding(final ImVec2 plotPadding) {
nSetPlotPadding(plotPadding.x, plotPadding.y);
}
private native void nSetPlotPadding(float x, float y); /*
IMPLOT_STYLE->PlotPadding = ImVec2(x, y);
*/
//Label padding
public ImVec2 getLabelPadding() {
final ImVec2 vec = new ImVec2();
nGetLabelPadding(vec);
return vec;
}
private native void nGetLabelPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LabelPadding, vec);
*/
public void setLabelPadding(final ImVec2 labelPadding) {
nSetLabelPadding(labelPadding.x, labelPadding.y);
}
private native void nSetLabelPadding(float x, float y); /*
IMPLOT_STYLE->LabelPadding = ImVec2(x, y);
*/
//Legend padding
public ImVec2 getLegendPadding() {
final ImVec2 vec = new ImVec2();
nGetLegendPadding(vec);
return vec;
}
private native void nGetLegendPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendPadding, vec);
*/
public void setLegendPadding(final ImVec2 legendPadding) {
nSetLegendPadding(legendPadding.x, legendPadding.y);
}
private native void nSetLegendPadding(float x, float y); /*
IMPLOT_STYLE->LegendPadding = ImVec2(x, y);
*/
//Legend inner padding
public ImVec2 getLegendInnerPadding() {
final ImVec2 vec = new ImVec2();
nGetLegendInnerPadding(vec);
return vec;
}
private native void nGetLegendInnerPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendInnerPadding, vec);
*/
public void setLegendInnerPadding(final ImVec2 legendInnerPadding) {
nSetLegendInnerPadding(legendInnerPadding.x, legendInnerPadding.y);
}
private native void nSetLegendInnerPadding(float x, float y); /*
IMPLOT_STYLE->LegendInnerPadding = ImVec2(x, y);
*/
//Legend spacing
public ImVec2 getLegendSpacing() {
final ImVec2 vec = new ImVec2();
nGetLegendSpacing(vec);
return vec;
}
private native void nGetLegendSpacing(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendSpacing, vec);
*/
public void setLegendSpacing(final ImVec2 legendSpacing) {
nSetLegendSpacing(legendSpacing.x, legendSpacing.y);
}
private native void nSetLegendSpacing(float x, float y); /*
IMPLOT_STYLE->LegendSpacing = ImVec2(x, y);
*/
//Mouse position padding
public ImVec2 getMousePosPadding() {
final ImVec2 vec = new ImVec2();
nGetMousePosPadding(vec);
return vec;
}
private native void nGetMousePosPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MousePosPadding, vec);
*/
public void setMousePosPadding(final ImVec2 mousePosPadding) {
nSetMousePosPadding(mousePosPadding.x, mousePosPadding.y);
}
private native void nSetMousePosPadding(float x, float y); /*
IMPLOT_STYLE->MousePosPadding = ImVec2(x, y);
*/
//Annotation padding
public ImVec2 getAnnotationPadding() {
final ImVec2 vec = new ImVec2();
nGetAnnotationPadding(vec);
return vec;
}
private native void nGetAnnotationPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->AnnotationPadding, vec);
*/
public void setAnnotationPadding(final ImVec2 annotationPadding) {
nSetAnnotationPadding(annotationPadding.x, annotationPadding.y);
}
private native void nSetAnnotationPadding(float x, float y); /*
IMPLOT_STYLE->AnnotationPadding = ImVec2(x, y);
*/
//Fit padding
public ImVec2 getFitPadding() {
final ImVec2 vec = new ImVec2();
nGetFitPadding(vec);
return vec;
}
private native void nGetFitPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->FitPadding, vec);
*/
public void setFitPadding(final ImVec2 fitPadding) {
nSetFitPadding(fitPadding.x, fitPadding.y);
}
private native void nSetFitPadding(float x, float y); /*
IMPLOT_STYLE->FitPadding = ImVec2(x, y);
*/
//Plot default size
public ImVec2 getPlotDefaultSize() {
final ImVec2 vec = new ImVec2();
nGetPlotDefaultSize(vec);
return vec;
}
private native void nGetPlotDefaultSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotDefaultSize, vec);
*/
public void setPlotDefaultSize(final ImVec2 plotDefaultSize) {
nSetPlotDefaultSize(plotDefaultSize.x, plotDefaultSize.y);
}
private native void nSetPlotDefaultSize(float x, float y); /*
IMPLOT_STYLE->PlotDefaultSize = ImVec2(x, y);
*/
//Plot minimum size
public ImVec2 getPlotMinSize() {
final ImVec2 vec = new ImVec2();
nGetPlotMinSize(vec);
return vec;
}
private native void nGetPlotMinSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotMinSize, vec);
*/
public void setPlotMinSize(final ImVec2 plotMinSize) {
nSetPlotMinSize(plotMinSize.x, plotMinSize.y);
}
private native void nSetPlotMinSize(float x, float y); /*
IMPLOT_STYLE->PlotMinSize = ImVec2(x, y);
*/
//Colors
public ImVec4[] getColors() {
final float[] w = new float[ImPlotCol.COUNT];
final float[] x = new float[ImPlotCol.COUNT];
final float[] y = new float[ImPlotCol.COUNT];
final float[] z = new float[ImPlotCol.COUNT];
nGetColors(w, x, y, z, ImPlotCol.COUNT);
final ImVec4[] colors = new ImVec4[ImPlotCol.COUNT];
for (int i = 0; i < ImPlotCol.COUNT; i++) {
colors[i] = new ImVec4(w[i], x[i], y[i], z[i]);
}
return colors;
}
private native void nGetColors(float[] w, float[] x, float[] y, float[] z, int count); /*
ImVec4* colors = IMPLOT_STYLE->Colors;
for (int i = 0; i < count; i++) {
w[i] = colors->w;
x[i] = colors->x;
y[i] = colors->y;
z[i] = colors->z;
colors++;
}
*/
public void setColors(final ImVec4[] colors) {
final float[] w = new float[ImPlotCol.COUNT];
final float[] x = new float[ImPlotCol.COUNT];
final float[] y = new float[ImPlotCol.COUNT];
final float[] z = new float[ImPlotCol.COUNT];
for (int i = 0; i < ImPlotCol.COUNT; i++) {
w[i] = colors[i].w;
x[i] = colors[i].x;
y[i] = colors[i].y;
z[i] = colors[i].z;
}
nSetColors(w, x, y, z, ImPlotCol.COUNT);
}
private native void nSetColors(float[] w, float[] x, float[] y, float[] z, int count); /*
ImVec4* colors = IMPLOT_STYLE->Colors;
for (int i = 0; i < count; i++) {
colors->w = w[i];
colors->x = x[i];
colors->y = y[i];
colors->z = z[i];
colors++;
}
*/
//Colormap
public native int getColormap(); /*
return IMPLOT_STYLE->Colormap;
*/
public native void setColormap(int input); /*
IMPLOT_STYLE->Colormap = input;
*/
//Antialiasing
public native boolean isAntiAliasedLines(); /*
return IMPLOT_STYLE->AntiAliasedLines;
*/
public native void setAntiAliasedLines(boolean input); /*
IMPLOT_STYLE->AntiAliasedLines = input;
*/
//Local time
public native boolean isUseLocalTime(); /*
return IMPLOT_STYLE->UseLocalTime;
*/
public native void setUseLocalTime(boolean input); /*
IMPLOT_STYLE->UseLocalTime = input;
*/
//ISO 8601
public native boolean isUseISO8601(); /*
return IMPLOT_STYLE->UseISO8601;
*/
public native void setUseISO8601(boolean input); /*
IMPLOT_STYLE->UseISO8601 = input;
*/
//24HR clock
public native boolean isUse24HourClock(); /*
return IMPLOT_STYLE->Use24HourClock;
*/
public native void setUse24HourClock(boolean input); /*
IMPLOT_STYLE->Use24HourClock = input;
@BindingField
public float LineWeight;
@BindingField
public int Marker;
@BindingField
public float MarkerSize;
@BindingField
public float MarkerWeight;
@BindingField
public float FillAlpha;
@BindingField
public float ErrorBarSize;
@BindingField
public float ErrorBarWeight;
@BindingField
public float DigitalBitHeight;
@BindingField
public float DigitalBitGap;
@BindingField
public float PlotBorderSize;
@BindingField
public float MinorAlpha;
@BindingField
public ImVec2 MajorTickLen;
@BindingField
public ImVec2 MinorTickLen;
@BindingField
public ImVec2 MajorTickSize;
@BindingField
public ImVec2 MinorTickSize;
@BindingField
public ImVec2 MajorGridSize;
@BindingField
public ImVec2 MinorGridSize;
@BindingField
public ImVec2 PlotPadding;
@BindingField
public ImVec2 LabelPadding;
@BindingField
public ImVec2 LegendPadding;
@BindingField
public ImVec2 LegendInnerPadding;
@BindingField
public ImVec2 LegendSpacing;
@BindingField
public ImVec2 MousePosPadding;
@BindingField
public ImVec2 AnnotationPadding;
@BindingField
public ImVec2 FitPadding;
@BindingField
public ImVec2 PlotDefaultSize;
@BindingField
public ImVec2 PlotMinSize;
@BindingField
@TypeArray(type = "ImVec4", size = "ImPlotCol_COUNT")
public ImVec4[] Colors;
@BindingField
public int Colormap;
@BindingField
public boolean AntiAliasedLines;
@BindingField
public boolean UseLocalTime;
@BindingField
public boolean UseISO8601;
@BindingField
public boolean Use24HourClock;
/*JNI
#undef THIS
*/
}
@@ -1,37 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotAxisFlags {
private ImPlotAxisFlags() {
}
/** default */
public static final int None = 0;
/** the axis label will not be displayed (axis labels also hidden if the supplied string name is NULL) */
public static final int NoLabel = 1;
/** no grid lines will be displayed */
public static final int NoGridLines = 1 << 1;
/** no tick marks will be displayed */
public static final int NoTickMarks = 1 << 2;
/** no text labels will be displayed */
public static final int NoTickLabels = 1 << 3;
/** grid lines will be displayed in the foreground (i.e. on top of data) in stead of the background */
public static final int Foreground = 1 << 4;
/** a logartithmic (base 10) axis scale will be used (mutually exclusive with ImPlotAxisFlags_Time) */
public static final int LogScale = 1 << 5;
/** axis will display date/time formatted labels (mutually exclusive with ImPlotAxisFlags_LogScale) */
public static final int Time = 1 << 6;
/** the axis will be inverted */
public static final int Invert = 1 << 7;
/** axis will not be initially fit to data extents on the first rendered frame (also the case if SetNextPlotLimits explicitly called) */
public static final int NoInitialFit = 1 << 8;
/** axis will be auto-fitting to data extents */
public static final int AutoFit = 1 << 9;
/** axis will only fit points if the point is in the visible range of the **orthoganol** axis */
public static final int RangeFit = 1 << 10;
/** the axis minimum value will be locked when panning/zooming */
public static final int LockMin = 1 << 11;
/** the axis maximum value will be locked when panning/zooming */
public static final int LockMax = 1 << 12;
public static final int Lock = LockMin | LockMax;
public static final int NoDecorations = NoLabel | NoGridLines | NoTickMarks | NoTickLabels;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotAxisFlags_")
public Void __;
}
@@ -1,15 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotBin {
private ImPlotBin() {
}
/** k = sqrt(n) */
public static final int Sqrt = -1;
/** k = 1 + log2(n) */
public static final int Sturges = -2;
/** k = 2 * cbrt(n) */
public static final int Rice = -3;
/** w = 3.49 * sigma / cbrt(n) */
public static final int Scott = -4;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotBin_")
public Void __;
}
@@ -1,57 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotCol {
private ImPlotCol() {
}
/** plot line/outline color (defaults to next unused color in current colormap)*/
public static final int Line = 0;
/** plot fill color for bars (defaults to the current line color)*/
public static final int Fill = 1;
/** marker outline color (defaults to the current line color)*/
public static final int MarkerOutline = 2;
/** marker fill color (defaults to the current line color)*/
public static final int MarkerFill = 3;
/** error bar color (defaults to ImGuiCol_Text)*/
public static final int ErrorBar = 4;
// plot styling colors
/** plot frame background color (defaults to ImGuiCol_FrameBg) */
public static final int FrameBg = 5;
/** plot area background color (defaults to ImGuiCol_WindowBg) */
public static final int PlotBg = 6;
/** plot area border color (defaults to ImGuiCol_Border) */
public static final int PlotBorder = 7;
/** legend background color (defaults to ImGuiCol_PopupBg) */
public static final int LegendBg = 8;
/** legend border color (defaults to ImPlotCol_PlotBorder) */
public static final int LegendBorder = 9;
/** legend text color (defaults to ImPlotCol_InlayText) */
public static final int LegendText = 10;
/** plot title text color (defaults to ImGuiCol_Text) */
public static final int TitleText = 11;
/** color of text appearing inside of plots (defaults to ImGuiCol_Text) */
public static final int InlayText = 12;
/** x-axis label and tick lables color (defaults to ImGuiCol_Text) */
public static final int XAxis = 13;
/** x-axis grid color (defaults to 25% ImPlotCol_XAxis) */
public static final int XAxisGrid = 14;
/** y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis = 15;
/** y-axis grid color (defaults to 25% ImPlotCol_YAxis) */
public static final int YAxisGrid = 16;
/** 2nd y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis2 = 17;
/** 2nd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis2) */
public static final int YAxisGrid2 = 18;
/** 3rd y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis3 = 19;
/** 3rd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis3) */
public static final int YAxisGrid3 = 21;
/** box-selection color (defaults to yellow) */
public static final int Selection = 22;
/** box-query color (defaults to green) */
public static final int Query = 23;
/** crosshairs color (defaults to ImPlotCol_PlotBorder) */
public static final int Crosshairs = 24;
public static final int COUNT = 25;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotCol_")
public Void __;
}
@@ -1,39 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotColormap {
private ImPlotColormap() {
}
/** a.k.a. seaborn deep (qual=true, n=10) (default) */
public static final int Deep = 0;
/** a.k.a. matplotlib "Set1" (qual=true, n=9 ) */
public static final int Dark = 1;
/** a.k.a. matplotlib "Pastel1" (qual=true, n=9 ) */
public static final int Pastel = 2;
/** a.k.a. matplotlib "Paired" (qual=true, n=12) */
public static final int Paired = 3;
/** a.k.a. matplotlib "viridis" (qual=false, n=11) */
public static final int Viridis = 4;
/** a.k.a. matplotlib "plasma" (qual=false, n=11) */
public static final int Plasma = 5;
/** a.k.a. matplotlib/MATLAB "hot" (qual=false, n=11) */
public static final int Hot = 6;
/** a.k.a. matplotlib/MATLAB "cool" (qual=false, n=11) */
public static final int Cool = 7;
/** a.k.a. matplotlib/MATLAB "pink" (qual=false, n=11) */
public static final int Pink = 8;
/** a.k.a. MATLAB "jet" (qual=false, n=11) */
public static final int Jet = 9;
/** a.k.a. matplotlib "twilight" (qual=false, n=11) */
public static final int Twilight = 10;
/** red/blue, Color Brewer (qual=false, n=11) */
public static final int RdBu = 11;
/** brown/blue-green, Color Brewer (qual=false, n=11) */
public static final int BrBG = 12;
/** pink/yellow-green, Color Brewer (qual=false, n=11) */
public static final int PiYG = 13;
/** color spectrum, Color Brewer (qual=false, n=11) */
public static final int Spectral = 14;
/** white/black (qual=false, n=2 ) */
public static final int Greys = 15;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotColormap_")
public Void __;
}
@@ -1,36 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotFlags {
private ImPlotFlags() {
}
/** default */
public static final int None = 0;
/** the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot") */
public static final int NoTitle = 1;
/** the legend will not be displayed */
public static final int NoLegend = 1 << 1;
/** the user will not be able to open context menus with right-click */
public static final int NoMenus = 1 << 2;
/** the user will not be able to box-select with right-click drag */
public static final int NoBoxSelect = 1 << 3;
/** the mouse position, in plot coordinates, will not be displayed inside of the plot */
public static final int NoMousePos = 1 << 4;
/** plot items will not be highlighted when their legend entry is hovered */
public static final int NoHighlight = 1 << 5;
/** a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications) */
public static final int NoChild = 1 << 6;
/** primary x and y axes will be constrained to have the same units/pixel (does not apply to auxiliary y-axes) */
public static final int Equal = 1 << 7;
/** enable a 2nd y-axis on the right side */
public static final int YAxis2 = 1 << 8;
/** enable a 3rd y-axis on the right side */
public static final int YAxis3 = 1 << 9;
/** the user will be able to draw query rects with middle-mouse or CTRL + right-click drag */
public static final int Query = 1 << 1;
/** the default mouse cursor will be replaced with a crosshair when hovered */
public static final int Crosshairs = 1 << 1;
/** plot lines will be software anti-aliased (not recommended for high density plots, prefer MSAA) */
public static final int AntiAliased = 1 << 1;
public static final int CanvasOnly = NoTitle | NoLegend | NoMenus | NoBoxSelect | NoMousePos;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotFlags_")
public Void __;
}
@@ -1,25 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotLocation {
private ImPlotLocation() {
}
/** center-center */
public static final int Center = 0;
/** top-center */
public static final int North = 1;
/** bottom-center */
public static final int South = 1 << 1;
/** center-left */
public static final int West = 1 << 2;
/** center-right */
public static final int East = 1 << 3;
/** top-left */
public static final int NorthWest = North | West;
/** top-right */
public static final int NorthEast = North | East;
/** bottom-left */
public static final int SouthWest = South | West;
/** bottom-right */
public static final int SouthEast = South | East;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotLocation_")
public Void __;
}
@@ -1,30 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotMarker {
private ImPlotMarker() {
}
/** no marker */
public static final int None = -1;
/** a circle marker */
public static final int Circle = 0;
/** a square maker */
public static final int Square = 1;
/** a diamond marker */
public static final int Diamond = 2;
/** an upward-pointing triangle marker */
public static final int Up = 3;
/** an downward-pointing triangle marker */
public static final int Down = 4;
/** an leftward-pointing triangle marker */
public static final int Left = 5;
/** an rightward-pointing triangle marker */
public static final int Right = 6;
/** a cross marker (not fillable) */
public static final int Cross = 7;
/** a plus marker (not fillable) */
public static final int Plus = 8;
/** a asterisk marker (not fillable) */
public static final int Asterisk = 9;
public static final int COUNT = 10;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotMarker_")
public Void __;
}
@@ -1,11 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotOrientation {
private ImPlotOrientation() {
}
/** left/right */
public static final int Horizontal = 0;
/** up/down */
public static final int Vertical = 1;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotOrientation_")
public Void __;
}
@@ -1,62 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotStyleVar {
private ImPlotStyleVar() {
}
/** float, plot item line weight in pixels */
public static final int LineWeight = 0;
/** int, marker specification */
public static final int Marker = 1;
/** float, marker size in pixels (roughly the marker's "radius") */
public static final int MarkerSize = 2;
/** float, plot outline weight of markers in pixels */
public static final int MarkerWeight = 3;
/** float, alpha modifier applied to all plot item fills */
public static final int FillAlpha = 4;
/** float, error bar whisker width in pixels */
public static final int ErrorBarSize = 5;
/** float, error bar whisker weight in pixels */
public static final int ErrorBarWeight = 6;
/** float, digital channels bit height (at 1) in pixels */
public static final int DigitalBitHeight = 7;
/** float, digital channels bit padding gap in pixels */
public static final int DigitalBitGap = 8;
/** float, thickness of border around plot area */
public static final int PlotBorderSize = 9;
/** float, alpha multiplier applied to minor axis grid lines */
public static final int MinorAlpha = 10;
/** ImVec2, major tick lengths for X and Y axes */
public static final int MajorTickLen = 12;
/** ImVec2, minor tick lengths for X and Y axes */
public static final int MinorTickLen = 13;
/** ImVec2, line thickness of major ticks */
public static final int MajorTickSize = 14;
/** ImVec2, line thickness of minor ticks */
public static final int MinorTickSize = 15;
/** ImVec2, line thickness of major grid lines */
public static final int MajorGridSize = 16;
/** ImVec2, line thickness of minor grid lines */
public static final int MinorGridSize = 17;
/** ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding) */
public static final int PlotPadding = 18;
/** ImVec2, padding between axes labels, tick labels, and plot edge */
public static final int LabelPadding = 19;
/** ImVec2, legend padding from plot edges */
public static final int LegendPadding = 20;
/** ImVec2, legend inner padding from legend edges */
public static final int LegendInnerPadding = 21;
/** ImVec2, spacing between legend entries */
public static final int LegendSpacing = 22;
/** ImVec2, padding between plot edge and interior info text */
public static final int MousePosPadding = 23;
/** ImVec2, text padding around annotation labels */
public static final int AnnotationPadding = 24;
/** ImVec2, additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1f,0.1f) adds 10% to the fit extents of X and Y) */
public static final int FitPadding = 25;
/** ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot */
public static final int PlotDefaultSize = 26;
/** ImVec2, minimum size plot frame can be when shrunk */
public static final int PlotMinSize = 27;
public static final int COUNT = 28;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotStyleVar_")
public Void __;
}
@@ -1,13 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotYAxis {
private ImPlotYAxis() {
}
/** left (default) */
public static final int YAxis_1 = 0;
/** first on right side */
public static final int YAxis_2 = 1;
/** second on right side */
public static final int YAxis_3 = 2;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotYAxis_", sanitizeName = "ImPlot")
public Void __;
}
@@ -1,21 +1,19 @@
package imgui.extension.memedit;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
/**
* ImGui Club Memory Editor extension for ImGui
* Repo: https://github.com/ocornut/imgui_club
* Repo: <a href="https://github.com/ocornut/imgui_club">https://github.com/ocornut/imgui_club</a>
*/
@BindingSource
public final class MemoryEditor extends ImGuiStructDestroyable {
/*JNI
#include "_memedit.h"
#define MEMORY_EDITOR ((MemoryEditor*)STRUCT_PTR)
*/
public MemoryEditor() {
}
public MemoryEditor(final long ptr) {
@@ -27,51 +25,75 @@ public final class MemoryEditor extends ImGuiStructDestroyable {
return nCreate();
}
/*JNI
#include "_memedit.h"
#define THIS ((MemoryEditor*)STRUCT_PTR)
#define MemoryEditorSizes MemoryEditor::Sizes
*/
private native long nCreate(); /*
return (intptr_t)(new MemoryEditor());
*/
public native void gotoAddrAndHighlight(long addrMin, long addrMax); /*
MEMORY_EDITOR->GotoAddrAndHighlight(addrMin, addrMax);
*/
@BindingField
public boolean Open;
public void calcSizes(final MemoryEditorSizes s, final long memSize, final long baseDisplayAddr) {
nCalcSizes(s.ptr, memSize, baseDisplayAddr);
}
@BindingField
public boolean ReadOnly;
public native void nCalcSizes(long ptr, long memSize, long baseDisplayAddr); /*
MEMORY_EDITOR->CalcSizes(*((MemoryEditor::Sizes*)ptr), static_cast<size_t>(memSize), static_cast<size_t>(baseDisplayAddr));
*/
@BindingField
public int Cols;
public void drawWindow(final String title, final long memData, final long memSize) {
drawWindow(title, memData, memSize, 0x000);
}
@BindingField
public boolean OptShowOptions;
public native void drawWindow(String title, long memData, long memSize, long baseDisplayAddr); /*
MEMORY_EDITOR->DrawWindow(title, reinterpret_cast<void*>(memData), static_cast<size_t>(memSize), static_cast<size_t>(baseDisplayAddr));
*/
@BindingField
public boolean OptShowDataPreview;
public void drawContents(final long memData, final long memSize) {
drawContents(memData, memSize, 0x0000);
}
@BindingField
public boolean OptShowHexII;
public native void drawContents(long memData, long memSize, long baseDisplayAddr); /*
MEMORY_EDITOR->DrawContents(reinterpret_cast<void*>(memData), static_cast<size_t>(memSize), static_cast<size_t>(baseDisplayAddr));
*/
@BindingField
public boolean OptShowAscii;
public void drawOptionsLine(final MemoryEditorSizes s, final long memData, final long memSize, final long baseDisplayAddr) {
nDrawOptionsLine(s.ptr, memData, memSize, baseDisplayAddr);
}
@BindingField
public boolean OptGreyOutZeroes;
public native void nDrawOptionsLine(long ptr, long memData, long memSize, long baseDisplayAddr); /*
MEMORY_EDITOR->DrawOptionsLine(*((MemoryEditor::Sizes*)ptr), reinterpret_cast<void*>(memData), static_cast<size_t>(memSize), static_cast<size_t>(baseDisplayAddr));
*/
@BindingField
public boolean OptUpperCaseHex;
public void drawPreviewLine(final MemoryEditorSizes s, final long memDataVoid, final long memSize, final long baseDisplayAddr) {
nDrawPreviewLine(s.ptr, memDataVoid, memSize, baseDisplayAddr);
}
@BindingField
public int OptMidColsCount;
public native void nDrawPreviewLine(long ptr, long memDataVoid, long memSize, long baseDisplayAddr); /*
MEMORY_EDITOR->DrawPreviewLine(*((MemoryEditor::Sizes*)ptr), reinterpret_cast<void*>(memDataVoid), static_cast<size_t>(memSize), static_cast<size_t>(baseDisplayAddr));
*/
@BindingField
public int OptAddrDigitsCount;
@BindingField
public float OptFooterExtraHeight;
@BindingField
public int HighlightColor;
@BindingMethod
public native void GotoAddrAndHighlight(long addrMin, long addrMax);
@BindingMethod
public native void CalcSizes(@ArgValue(callPrefix = "*") MemoryEditorSizes s, long memSize, long baseDisplayAddr);
@BindingMethod
public native void DrawWindow(String title, @ArgValue(reinterpretCast = "void*") long memData, long memSize, @OptArg long baseDisplayAddr);
@BindingMethod
public native void DrawContents(@ArgValue(reinterpretCast = "void*") long memData, long memSize, @OptArg long baseDisplayAddr);
@BindingMethod
public native void DrawOptionsLine(@ArgValue(callPrefix = "*") MemoryEditorSizes s, @ArgValue(reinterpretCast = "void*") long memData, long memSize, long baseDisplayAddr);
@BindingMethod
public native void DrawPreviewLine(@ArgValue(callPrefix = "*") MemoryEditorSizes s, @ArgValue(reinterpretCast = "void*") long memDataVoid, long memSize, long baseDisplayAddr);
/*JNI
#undef MemoryEditorSizes
#undef THIS
*/
}
@@ -1,17 +1,12 @@
package imgui.extension.memedit;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class MemoryEditorSizes extends ImGuiStructDestroyable {
/*JNI
#include "_memedit.h"
#define MEMORY_EDITOR_SIZES ((MemoryEditor::Sizes*)STRUCT_PTR)
*/
public MemoryEditorSizes() {
}
public MemoryEditorSizes(final long ptr) {
@@ -23,87 +18,46 @@ public final class MemoryEditorSizes extends ImGuiStructDestroyable {
return nCreate();
}
/*JNI
#include "_memedit.h"
#define THIS ((MemoryEditor::Sizes*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new MemoryEditor::Sizes());
*/
public native void setAddrDigitsCount(int addrDigitsCount); /*
MEMORY_EDITOR_SIZES->AddrDigitsCount = addrDigitsCount;
*/
@BindingField
public int AddrDigitsCount;
public native int getAddrDigitsCount(); /*
return MEMORY_EDITOR_SIZES->AddrDigitsCount;
*/
@BindingField
public float LineHeight;
public native void setLineHeight(float lineHeight); /*
MEMORY_EDITOR_SIZES->LineHeight = lineHeight;
*/
@BindingField
public float GlyphWidth;
public native float getLineHeight(); /*
return MEMORY_EDITOR_SIZES->LineHeight;
*/
@BindingField
public float HexCellWidth;
public native void setGlyphWidth(float glyphWidth); /*
MEMORY_EDITOR_SIZES->GlyphWidth = glyphWidth;
*/
@BindingField
public float SpacingBetweenMidCols;
public native float getGlyphWidth(); /*
return MEMORY_EDITOR_SIZES->GlyphWidth;
*/
@BindingField
public float PosHexStart;
public native void setHexCellWidth(float hexCellWidth); /*
MEMORY_EDITOR_SIZES->HexCellWidth = hexCellWidth;
*/
@BindingField
public float PosHexEnd;
public native float getHexCellWidth(); /*
return MEMORY_EDITOR_SIZES->HexCellWidth;
*/
@BindingField
public float PosAsciiStart;
public native void setSpacingBetweenMidCols(float spacingBetweenMidCols); /*
MEMORY_EDITOR_SIZES->SpacingBetweenMidCols = spacingBetweenMidCols;
*/
@BindingField
public float PosAsciiEnd;
public native float getSpacingBetweenMidCols(); /*
return MEMORY_EDITOR_SIZES->SpacingBetweenMidCols;
*/
@BindingField
public float WindowWidth;
public native void setPosHexStart(float posHexStart); /*
MEMORY_EDITOR_SIZES->PosHexStart = posHexStart;
*/
public native float getPosHexStart(); /*
return MEMORY_EDITOR_SIZES->PosHexStart;
*/
public native void setPosHexEnd(float posHexEnd); /*
MEMORY_EDITOR_SIZES->PosHexEnd = posHexEnd;
*/
public native float getPosHexEnd(); /*
return MEMORY_EDITOR_SIZES->PosHexEnd;
*/
public native void setPosAsciiStart(float posAsciiStart); /*
MEMORY_EDITOR_SIZES->PosAsciiStart = posAsciiStart;
*/
public native float getPosAsciiStart(); /*
return MEMORY_EDITOR_SIZES->PosAsciiStart;
*/
public native void setPosAsciiEnd(float posAsciiEnd); /*
MEMORY_EDITOR_SIZES->PosAsciiEnd = posAsciiEnd;
*/
public native float getPosAsciiEnd(); /*
return MEMORY_EDITOR_SIZES->PosAsciiEnd;
*/
public native void setWindowWidth(float windowWidth); /*
MEMORY_EDITOR_SIZES->WindowWidth = windowWidth;
*/
public native float getWindowWidth(); /*
return MEMORY_EDITOR_SIZES->WindowWidth;
*/
/*JNI
#undef THIS
*/
}
@@ -2,542 +2,406 @@ package imgui.extension.nodeditor;
import imgui.ImDrawList;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
import imgui.type.ImLong;
/**
* Bindings for Imgui Node Editor (https://github.com/thedmd/imgui-node-editor)
* Original library author - Michał Cichoń (https://github.com/thedmd)
*
* <p>
* An implementation of node editor with ImGui-like API.
* Project purpose is to serve as a basis for more complex solutions like blueprint editors.
*
* <p>
* Refer to the library's Github page for examples and support
*
* <p>
* Before you can start drawing editor you have to create ImNodeEditorContext
* (either by invoking constructor directly or using ImNodeEditor.createEditor()) and switch
* current editor via ImNodeEditor.setCurrentEditor(NodeEditorContext)
*
* <p>
* Binding notice: instead of special types for ids of nodes, links and pins which used in native library
* we use longs to reduce boilerplate and garbage production
*/
@BindingSource(callPtr = "ax::NodeEditor")
public final class NodeEditor {
private static final ImDrawList HINT_FOREGROUND_DRAW_LIST = new ImDrawList(0);
private static final ImDrawList HINT_BACKGROUND_DRAW_LIST = new ImDrawList(0);
private static final ImDrawList NODE_BACKGROUND_DRAW_LIST = new ImDrawList(0);
private static final NodeEditorStyle STYLE = new NodeEditorStyle(0);
private NodeEditor() {
}
/*JNI
#include "_nodeeditor.h"
namespace ed = ax::NodeEditor;
#define NodeEditorConfig ax::NodeEditor::Config
#define NodeEditorStyle ax::NodeEditor::Style
#define NodeEditorContext ax::NodeEditor::EditorContext
*/
/**
* This method exists for api consistency and you can just call NodeEditorContext manually
*/
public static NodeEditorContext createEditor() {
return new NodeEditorContext();
}
@BindingMethod
public static native void SetCurrentEditor(NodeEditorContext ctx);
public static NodeEditorContext createEditor(final NodeEditorConfig config) {
return new NodeEditorContext(config);
}
@BindingMethod
public static native NodeEditorContext GetCurrentEditor();
/**
* This method exists for api consistency and you can just call NodeEditorContext.destroy() manually
*/
public static void destroyEditor(final NodeEditorContext editorContext) {
editorContext.destroy();
}
@BindingMethod
public static native NodeEditorContext CreateEditor(@OptArg NodeEditorConfig config);
public static void setCurrentEditor(final NodeEditorContext editorContext) {
nSetCurrentEditor(editorContext.ptr);
}
@BindingMethod
public static native void DestroyEditor(NodeEditorContext ctx);
private static native void nSetCurrentEditor(long editor); /*
ed::SetCurrentEditor((ed::EditorContext*)editor);
*/
@BindingMethod
@ReturnValue(isStatic = true, callPrefix = "&")
public static native NodeEditorStyle GetStyle();
public static native void begin(String title); /*
ed::Begin(title);
*/
@BindingMethod
public static native String GetStyleColorName(@ArgValue(staticCast = "ax::NodeEditor::StyleColor") int colorIndex);
public static native void beginNode(long id); /*
ed::BeginNode(id);
*/
@BindingMethod
public static native void PushStyleColor(@ArgValue(staticCast = "ax::NodeEditor::StyleColor") int colorIndex, ImVec4 color);
public static native void group(float w, float h); /*
ed::Group(ImVec2(w, h));
*/
@BindingMethod
public static native void PopStyleColor(@OptArg int count);
public static native boolean beginGroupHint(long id); /*
return ed::BeginGroupHint(id);
*/
@BindingMethod
public static native void PushStyleVar(@ArgValue(staticCast = "ax::NodeEditor::StyleVar")int varIndex, float value);
@BindingMethod
public static native void PushStyleVar(@ArgValue(staticCast = "ax::NodeEditor::StyleVar")int varIndex, ImVec2 value);
public static native void beginPin(long pin, int imNodeEditorPinKind); /*
ed::BeginPin(pin, (ed::PinKind)imNodeEditorPinKind);
*/
@BindingMethod
public static native void PushStyleVar(@ArgValue(staticCast = "ax::NodeEditor::StyleVar")int varIndex, ImVec4 value);
public static native void endGroupHint(); /*
ed::EndGroupHint();
*/
@BindingMethod
public static native void PopStyleVar(@OptArg int count);
public static native void endPin(); /*
ed::EndPin();
*/
@BindingMethod
public static native void Begin(String id, @OptArg ImVec2 size);
public static native void endNode(); /*
ed::EndNode();
*/
@BindingMethod
public static native void End();
public static native void end(); /*
ed::End();
*/
@BindingMethod
public static native void BeginNode(long id);
public static native float getScreenSizeX(); /*
return ed::GetScreenSize().x;
*/
@BindingMethod
public static native void BeginPin(long id, @ArgValue(staticCast = "ax::NodeEditor::PinKind") int kind);
public static native float getScreenSizeY(); /*
return ed::GetScreenSize().y;
*/
@BindingMethod
public static native void PinRect(ImVec2 a, ImVec2 b);
public static native float toCanvasX(float screenSpacePosX); /*
return ed::ScreenToCanvas(ImVec2(screenSpacePosX, 0.0f)).x;
*/
@BindingMethod
public static native void PinPivotRect(ImVec2 a, ImVec2 b);
public static native float toCanvasY(float screenSpacePosY); /*
return ed::ScreenToCanvas(ImVec2(0.0f, screenSpacePosY)).y;
*/
@BindingMethod
public static native void PinPivotSize(ImVec2 size);
public static native float toScreenX(float canvasSpacePosX); /*
return ed::CanvasToScreen(ImVec2(canvasSpacePosX, 0.0f)).x;
*/
@BindingMethod
public static native void PinPivotScale(ImVec2 scale);
public static native float toScreenY(float canvasSpacePosY); /*
return ed::CanvasToScreen(ImVec2(0.0f, canvasSpacePosY)).y;
*/
@BindingMethod
public static native void PinPivotAlignment(ImVec2 alignment);
public static NodeEditorStyle getStyle() {
STYLE.ptr = nGetStyle();
return STYLE;
}
@BindingMethod
public static native void EndPin();
private static native long nGetStyle(); /*
return (intptr_t)&ed::GetStyle();
*/
@BindingMethod
public static native void Group(ImVec2 size);
public static native String getStyleColorName(int imNodeEditorStyleColor); /*
return env->NewStringUTF(ed::GetStyleColorName((ed::StyleColor)imNodeEditorStyleColor));
*/
@BindingMethod
public static native void EndNode();
public static native void pushStyleColor(int imNodeEditorStyleColor, float r, float g, float b, float a); /*
ed::PushStyleColor((ed::StyleColor)imNodeEditorStyleColor, ImVec4(r, g, b, a));
*/
@BindingMethod
public static native boolean BeginGroupHint(long nodeId);
public static native void popStyleColor(int count); /*
ed::PopStyleColor(count);
*/
@BindingMethod
public static native ImVec2 GetGroupMin();
public static native void pushStyleVar(int imNodeEditorStyleVar, float v); /*
ed::PushStyleVar((ed::StyleVar)imNodeEditorStyleVar, v);
*/
@BindingMethod
public static native ImVec2 GetGroupMax();
public static native void pushStyleVar(int imNodeEditorStyleVar, float x, float y); /*
ed::PushStyleVar((ed::StyleVar)imNodeEditorStyleVar, ImVec2(x, y));
*/
@BindingMethod
@ReturnValue(isStatic = true)
public static native ImDrawList GetHintForegroundDrawList();
public static native void pushStyleVar(int imNodeEditorStyleVar, float r, float g, float b, float a); /*
ed::PushStyleVar((ed::StyleVar)imNodeEditorStyleVar, ImVec4(r, g, b, a));
*/
@BindingMethod
@ReturnValue(isStatic = true)
public static native ImDrawList GetHintBackgroundDrawList();
public static native void popStyleVar(int count); /*
ed::PopStyleVar(count);
*/
@BindingMethod
public static native void EndGroupHint();
public static native float getGroupMinX(); /*
return ed::GetGroupMin().x;
*/
@BindingMethod
@ReturnValue(isStatic = true)
public static native ImDrawList GetNodeBackgroundDrawList(long nodeId);
public static native float getGroupMinY(); /*
return ed::GetGroupMin().y;
*/
@BindingMethod
public static native boolean Link(long id, long startPinId, long endPinId, @OptArg(callValue = "ImVec4(1,1,1,1)") ImVec4 color, @OptArg float thickness);
public static native float getGroupMaxX(); /*
return ed::GetGroupMax().x;
*/
@BindingMethod
public static native void Flow(long linkId, @OptArg @ArgValue(staticCast = "ax::NodeEditor::FlowDirection") int direction);
public static native float getGroupMaxY(); /*
return ed::GetGroupMax().y;
*/
@BindingMethod
public static native boolean BeginCreate(@OptArg(callValue = "ImVec4(1,1,1,1)") ImVec4 color, @OptArg float thickness);
/**
* Binding notice: both getHintForegroundDrawList(), getHintBackgroundDrawList() and getNodeBackgroundDrawList(long)
* return singleton objects which shouldn't be used outside of the scope of current hint/node
*/
@BindingMethod
public static native boolean QueryNewLink(@ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong startId, @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong endId);
public static ImDrawList getHintForegroundDrawList() {
HINT_FOREGROUND_DRAW_LIST.ptr = nGetHintForegroundDrawList();
return HINT_FOREGROUND_DRAW_LIST;
}
@BindingMethod
public static native boolean QueryNewLink(@ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong startId, @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong endId, ImVec4 color, @OptArg float thickness);
public static ImDrawList getHintBackgroundDrawList() {
HINT_BACKGROUND_DRAW_LIST.ptr = nGetHintBackgroundDrawList();
return HINT_BACKGROUND_DRAW_LIST;
}
@BindingMethod
public static native boolean QueryNewNode(@ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong pinId);
public static ImDrawList getNodeBackgroundDrawList(final long nodeId) {
NODE_BACKGROUND_DRAW_LIST.ptr = nGetNodeBackgroundDrawList(nodeId);
return NODE_BACKGROUND_DRAW_LIST;
}
@BindingMethod
public static native boolean QueryNewNode(@ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong pinId, ImVec4 color, @OptArg float thickness);
private static native long nGetHintForegroundDrawList(); /*
return (intptr_t)(uintptr_t)ed::GetHintForegroundDrawList();
*/
@BindingMethod
public static native boolean AcceptNewItem();
private static native long nGetHintBackgroundDrawList(); /*
return (intptr_t)(uintptr_t)ed::GetHintBackgroundDrawList();
*/
@BindingMethod
public static native boolean AcceptNewItem(ImVec4 color, @OptArg float thickness);
private static native long nGetNodeBackgroundDrawList(long nodeId); /*
return (intptr_t)(uintptr_t)ed::GetNodeBackgroundDrawList(nodeId);
*/
@BindingMethod
public static native void RejectNewItem();
public static native long getDoubleClickedNode(); /*
return (intptr_t)(uintptr_t)ed::GetDoubleClickedNode();
*/
@BindingMethod
public static native void RejectNewItem(ImVec4 color, @OptArg float thickness);
public static native long getDoubleClickedPin(); /*
return (intptr_t)(uintptr_t)ed::GetDoubleClickedPin();
*/
@BindingMethod
public static native void EndCreate();
public static native long getDoubleClickedLink(); /*
return (intptr_t)(uintptr_t)ed::GetDoubleClickedLink();
*/
@BindingMethod
public static native boolean BeginDelete();
public static native boolean isBackgroundClicked(); /*
return ed::IsBackgroundClicked();
*/
@BindingMethod
public static native boolean QueryDeletedLink(@ArgValue(reinterpretCast = "ax::NodeEditor::LinkId*") ImLong linkId, @OptArg @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong startId, @OptArg @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong endId);
public static native boolean isBackgroundDoubleClicked(); /*
return ed::IsBackgroundDoubleClicked();
*/
@BindingMethod
public static native boolean QueryDeletedNode(@ArgValue(reinterpretCast = "ax::NodeEditor::NodeId*") ImLong nodeId);
public static native boolean pinHadAnyLinks(long pinId); /*
return ed::PinHadAnyLinks(pinId);
*/
@BindingMethod
public static native boolean AcceptDeletedItem(@OptArg boolean deleteDependencies);
public static native float getCurrentZoom(); /*
return ed::GetCurrentZoom();
*/
@BindingMethod
public static native void RejectDeletedItem();
public static native void pinRect(float x, float y, float w, float h); /*
ed::PinRect(ImVec2(x, y), ImVec2(w, h));
*/
@BindingMethod
public static native void EndDelete();
public static native void pinPivotRect(float x, float y, float w, float h); /*
ed::PinPivotRect(ImVec2(x, y), ImVec2(w, h));
*/
@BindingMethod
public static native void SetNodePosition(long nodeId, ImVec2 editorPosition);
public static native void pinPivotSize(float w, float h); /*
ed::PinPivotSize(ImVec2(w, h));
*/
@BindingMethod
public static native void SetGroupSize(long nodeId, ImVec2 size);
public static native void pinPivotScale(float w, float h); /*
ed::PinPivotScale(ImVec2(w, h));
*/
@BindingMethod
public static native ImVec2 GetNodePosition(long nodeId);
public static native void pinPivotAlignment(float x, float y); /*
ed::PinPivotAlignment(ImVec2(x, y));
*/
@BindingMethod
public static native ImVec2 GetNodeSize(long nodeId);
public static boolean showNodeContextMenu(final ImLong nodeId) {
return nShowNodeContextMenu(nodeId.getData());
}
@BindingMethod
public static native void CenterNodeOnScreen(long nodeId);
private static native boolean nShowNodeContextMenu(long[] nodeId); /*
return ed::ShowNodeContextMenu((ed::NodeId*)&nodeId[0]);
*/
@BindingMethod
public static native void SetNodeZPosition(long nodeId, float z);
public static boolean showPinContextMenu(final ImLong pinId) {
return nShowPinContextMenu(pinId.getData());
}
@BindingMethod
public static native float GetNodeZPosition(long nodeId);
private static native boolean nShowPinContextMenu(long[] pinId); /*
return ed::ShowPinContextMenu((ed::PinId*)&pinId[0]);
*/
@BindingMethod
public static native void RestoreNodeState(long nodeId);
public static boolean showLinkContextMenu(final ImLong linkId) {
return nShowLinkContextMenu(linkId.getData());
}
@BindingMethod
public static native void Suspend();
private static native boolean nShowLinkContextMenu(long[] linkId); /*
return ed::ShowLinkContextMenu((ed::LinkId*)&linkId[0]);
*/
@BindingMethod
public static native void Resume();
/**
* Binding notice: getNodeWithContextMenu(), getPinWithContextMenu() and getLinkWithContextMenu()
* return id of the object for which context menu should be shown. If there is no such object -1 will be returned.
* <p>
* These methods implemented as convenient alternative to showNodeContextMenu(ImLong), showPinContextMenu(ImLong) and
* showLinkContextMenu(ImLong)
*/
@BindingMethod
public static native boolean IsSuspended();
@BindingMethod
public static native boolean IsActive();
@BindingMethod
public static native boolean HasSelectionChanged();
@BindingMethod
public static native int GetSelectedObjectCount();
@BindingMethod
public static native int GetSelectedNodes(@ArgValue(reinterpretCast = "ax::NodeEditor::NodeId*") long[] nodes, int size);
@BindingMethod
public static native int GetSelectedLinks(@ArgValue(reinterpretCast = "ax::NodeEditor::LinkId*") long[] links, int size);
@BindingMethod
public static native boolean IsNodeSelected(long nodeId);
@BindingMethod
public static native boolean IsLinkSelected(long linkId);
@BindingMethod
public static native void ClearSelection();
@BindingMethod
public static native void SelectNode(long nodeId, @OptArg boolean append);
@BindingMethod
public static native void SelectLink(long linkId, @OptArg boolean append);
@BindingMethod
public static native void DeselectNode(long nodeId);
@BindingMethod
public static native void DeselectLink(long linkId);
@BindingMethod
public static native boolean DeleteNode(long nodeId);
@BindingMethod
public static native boolean DeleteLink(long linkId);
@BindingMethod(callName = "HasAnyLinks")
public static native boolean HasAnyLinksNode(@ArgValue(staticCast = "ax::NodeEditor::NodeId") long nodeId);
@BindingMethod(callName = "HasAnyLinks")
public static native boolean HasAnyLinksPin(@ArgValue(staticCast = "ax::NodeEditor::PinId") long pinId);
@BindingMethod(callName = "BreakLinks")
public static native int BreakLinksNode(@ArgValue(staticCast = "ax::NodeEditor::NodeId") long nodeId);
@BindingMethod(callName = "BreakLinks")
public static native int BreakLinksPin(@ArgValue(staticCast = "ax::NodeEditor::PinId") long pinId);
@BindingMethod
public static native void NavigateToContent(@OptArg float duration);
@BindingMethod
public static native void NavigateToSelection(@OptArg(callValue = "false") boolean zoomIn, @OptArg float duration);
@BindingMethod
public static native boolean ShowNodeContextMenu(@ArgValue(reinterpretCast = "ax::NodeEditor::NodeId*") ImLong nodeId);
@BindingMethod
public static native boolean ShowPinContextMenu(@ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong pinId);
@BindingMethod
public static native boolean ShowLinkContextMenu(@ArgValue(reinterpretCast = "ax::NodeEditor::LinkId*") ImLong linkId);
public static native long getNodeWithContextMenu(); /*
ed::NodeId id;
return ed::ShowNodeContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
ax::NodeEditor::NodeId id;
return ax::NodeEditor::ShowNodeContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
*/
public static native long getPinWithContextMenu(); /*
ed::PinId id;
return ed::ShowPinContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
ax::NodeEditor::PinId id;
return ax::NodeEditor::ShowPinContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
*/
public static native long getLinkWithContextMenu(); /*
ed::LinkId id;
return ed::ShowLinkContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
ax::NodeEditor::LinkId id;
return ax::NodeEditor::ShowLinkContextMenu(&id) ? (intptr_t)(uintptr_t)id : -1;
*/
public static native boolean showBackgroundContextMenu(); /*
return ed::ShowBackgroundContextMenu();
*/
@BindingMethod
public static native boolean ShowBackgroundContextMenu();
public static native void restoreNodeState(long node); /*
ed::RestoreNodeState(node);
*/
@BindingMethod
public static native void EnableShortcuts(boolean enable);
public static native void suspend(); /*
ed::Suspend();
*/
@BindingMethod
public static native boolean AreShortcutsEnabled();
public static native void resume(); /*
ed::Resume();
*/
@BindingMethod
public static native boolean BeginShortcut();
public static native boolean isSuspended(); /*
return ed::IsSuspended();
*/
@BindingMethod
public static native boolean AcceptCut();
public static native boolean isActive(); /*
return ed::IsActive();
*/
@BindingMethod
public static native boolean AcceptCopy();
public static native void setNodePosition(long node, float x, float y); /*
ed::SetNodePosition(node, ImVec2(x, y));
*/
@BindingMethod
public static native boolean AcceptPaste();
public static void link(final long id, final long startPinId, final long endPinId) {
link(id, startPinId, endPinId, 1, 1, 1, 1, 1);
}
@BindingMethod
public static native boolean AcceptDuplicate();
public static native void link(long id, long startPinId, long endPinId, float r, float g, float b, float a,
float thickness); /*
ed::Link(id, startPinId, endPinId, ImVec4(r, g, b, a), thickness);
*/
@BindingMethod
public static native boolean AcceptCreateNode();
public static native void flow(long linkId); /*
ed::Flow(linkId);
*/
@BindingMethod
public static native int GetActionContextSize();
public static boolean beginCreate() {
return beginCreate(1, 1, 1, 1, 1);
}
@BindingMethod
public static native int GetActionContextNodes(@ArgValue(reinterpretCast = "ax::NodeEditor::NodeId*") long[] nodes, int size);
public static native boolean beginCreate(float r, float g, float b, float a, float thickness); /*
return ed::BeginCreate(ImVec4(r, g, b, a), thickness);
*/
@BindingMethod
public static native int GetActionContextLinks(@ArgValue(reinterpretCast = "ax::NodeEditor::LinkId*") long[] links, int size);
public static boolean queryNewLink(final ImLong startId, final ImLong endId) {
return nQueryNewLink(startId.getData(), endId.getData(), 1, 1, 1, 1, 1);
}
@BindingMethod
public static native void EndShortcut();
public static boolean queryNewLink(final ImLong startId, final ImLong endId, final float r, final float g, final float b, final float a, final float thickness) {
return nQueryNewLink(startId.getData(), endId.getData(), r, g, b, a, thickness);
}
@BindingMethod
public static native float GetCurrentZoom();
private static native boolean nQueryNewLink(long[] startId, long[] endId, float r, float g, float b, float a, float thickness); /*
return ed::QueryNewLink((ed::PinId*)&startId[0], (ed::PinId*)&endId[0], ImVec4(r, g, b, a), thickness);
*/
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetHoveredNode();
public static boolean acceptNewItem() {
return acceptNewItem(1, 1, 1, 1, 1);
}
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetHoveredPin();
public static native boolean acceptNewItem(float r, float g, float b, float a, float thickness); /*
return ed::AcceptNewItem(ImVec4(r, g, b, a), thickness);
*/
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetHoveredLink();
public static void rejectNewItem() {
rejectNewItem(1, 1, 1, 1, 1);
}
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetDoubleClickedNode();
public static native void rejectNewItem(float r, float g, float b, float a, float thickness); /*
ed::RejectNewItem(ImVec4(r, g, b, a), thickness);
*/
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetDoubleClickedPin();
public static native void endCreate(); /*
ed::EndCreate();
*/
@BindingMethod
@ReturnValue(callPrefix = "(intptr_t)(uintptr_t)")
public static native long GetDoubleClickedLink();
public static native boolean beginDelete(); /*
return ed::BeginDelete();
*/
@BindingMethod
public static native boolean IsBackgroundClicked();
public static boolean queryDeletedLink(final ImLong linkId, final ImLong startId, final ImLong endId) {
return nQueryDeletedLink(linkId.getData(), startId.getData(), endId.getData());
}
@BindingMethod
public static native boolean IsBackgroundDoubleClicked();
private static native boolean nQueryDeletedLink(long[] linkId, long[] startId, long[] endId); /*
return ed::QueryDeletedLink((ed::LinkId*)&linkId[0], (ed::PinId*)&startId[0], (ed::PinId*)&endId[0]);
*/
@BindingMethod
public static native boolean GetLinkPins(@ArgValue(staticCast = "ax::NodeEditor::LinkId") long linkId, @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong startPinId, @ArgValue(reinterpretCast = "ax::NodeEditor::PinId*") ImLong endPinId);
public static boolean queryDeletedNode(final ImLong nodeId) {
return nQueryDeletedNode(nodeId.getData());
}
@BindingMethod
public static native boolean PinHadAnyLinks(@ArgValue(staticCast = "ax::NodeEditor::PinId") long pinId);
private static native boolean nQueryDeletedNode(long[] nodeId); /*
return ed::QueryDeletedNode((ed::NodeId*)&nodeId[0]);
*/
@BindingMethod
public static native ImVec2 GetScreenSize();
public static native boolean acceptDeletedItem(); /*
return ed::AcceptDeletedItem();
*/
@BindingMethod
public static native ImVec2 ScreenToCanvas(ImVec2 pos);
public static native void rejectDeletedItem(); /*
ed::RejectDeletedItem();
*/
@BindingMethod
public static native ImVec2 CanvasToScreen(ImVec2 pos);
public static native void endDelete(); /*
ed::EndDelete();
*/
@BindingMethod
public static native int GetNodeCount();
public static native void navigateToContent(float duration); /*
ed::NavigateToContent(duration);
*/
@BindingMethod
public static native int GetOrderedNodeIds(@ArgValue(reinterpretCast = "ax::NodeEditor::NodeId*") long[] nodes, int size);
public static native void navigateToSelection(boolean zoomIn, float duration); /*
ed::NavigateToSelection(zoomIn, duration);
*/
public static native void getNodePosition(long node, ImVec2 dst); /*
ImVec2 result = ed::GetNodePosition(node);
Jni::ImVec2Cpy(env, &result, dst);
*/
public static native float getNodePositionX(long node); /*
return ed::GetNodePosition(node).x;
*/
public static native float getNodePositionY(long node); /*
return ed::GetNodePosition(node).y;
*/
public static native float getNodeSizeX(long node); /*
return ed::GetNodeSize(node).x;
*/
public static native float getNodeSizeY(long node); /*
return ed::GetNodeSize(node).y;
*/
public static native void centerNodeOnScreen(long node); /*
ed::CenterNodeOnScreen(node);
*/
public static native boolean hasSelectionChanged(); /*
return ed::HasSelectionChanged();
*/
public static native int getSelectedObjectCount(); /*
return ed::GetSelectedObjectCount();
*/
public static native int getSelectedNodes(long[] nodes, int size); /*
return ed::GetSelectedNodes((ed::NodeId*)&nodes[0], size);
*/
public static native int getSelectedLinks(long[] links, int size); /*
return ed::GetSelectedLinks((ed::LinkId*)&links[0], size);
*/
public static native void clearSelection(); /*
return ed::ClearSelection();
*/
public static native void selectNode(long id, boolean append); /*
ed::SelectNode(id, append);
*/
public static native void selectLink(long id, boolean append); /*
ed::SelectLink(id, append);
*/
public static native void deselectNode(long id); /*
ed::DeselectNode(id);
*/
public static native void deselectLink(long id); /*
ed::DeselectLink(id);
*/
public static native boolean deleteNode(long nodeId); /*
return ed::DeleteNode(nodeId);
*/
public static native boolean deleteLink(long linkId); /*
return ed::DeleteLink(linkId);
*/
public static native void enableShortcuts(boolean enable); /*
ed::EnableShortcuts(enable);
*/
public static native boolean areShortcutsEnabled(); /*
return ed::AreShortcutsEnabled();
*/
public static native boolean beginShortcut(); /*
return ed::BeginShortcut();
*/
public static native boolean acceptCut(); /*
return ed::AcceptCut();
*/
public static native boolean acceptCopy(); /*
return ed::AcceptCopy();
*/
public static native boolean acceptPaste(); /*
return ed::AcceptPaste();
*/
public static native boolean acceptDuplicate(); /*
return ed::AcceptDuplicate();
*/
public static native boolean acceptCreateNode(); /*
return ed::AcceptCreateNode();
*/
public static native int getActionContextSize(); /*
return ed::GetActionContextSize();
*/
public static native int getActionContextNodes(long[] nodes, int size); /*
return ed::GetActionContextNodes((ed::NodeId*)&nodes[0], size);
*/
public static native int getActionContextLinks(long[] links, int size); /*
return ed::GetActionContextLinks((ed::LinkId*)&links[0], size);
*/
public static native void endShortcut(); /*
ed::EndShortcut();
*/
/*JNI
#undef NodeEditorConfig
#undef NodeEditorStyle
#undef NodeEditorContext
*/
}
@@ -1,37 +1,41 @@
package imgui.extension.nodeditor;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class NodeEditorConfig extends ImGuiStructDestroyable {
public NodeEditorConfig() {
}
public NodeEditorConfig(final long ptr) {
super(ptr);
}
/*JNI
#include "_nodeeditor.h"
namespace ed = ax::NodeEditor;
#define IM_NODE_EDITOR_CONFIG ((ed::Config*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_nodeeditor.h"
#define THIS ((ax::NodeEditor::Config*)STRUCT_PTR)
*/
private native long nCreate(); /*
return (intptr_t)(new ed::Config());
return (intptr_t)(new ax::NodeEditor::Config());
*/
public native String getSettingsFile(); /*
return env->NewStringUTF(IM_NODE_EDITOR_CONFIG->SettingsFile);
*/
@BindingField
public String SettingsFile;
public native void setSettingsFile(String settingsFile); /*MANUAL
IM_NODE_EDITOR_CONFIG->SettingsFile = obj_settingsFile == NULL ? NULL : (char*)env->GetStringUTFChars(obj_settingsFile, JNI_FALSE);
*/
@BindingField
public int DragButtonIndex;
@BindingField
public int SelectButtonIndex;
@BindingField
public int NavigateButtonIndex;
@BindingField
public int ContextMenuButtonIndex;
/*JNI
#undef THIS
*/
}
@@ -1,46 +1,9 @@
package imgui.extension.nodeditor;
import imgui.binding.ImGuiStructDestroyable;
public final class NodeEditorContext extends ImGuiStructDestroyable {
public NodeEditorContext() {
}
public NodeEditorContext(final NodeEditorConfig config) {
this(nCreate(config.ptr));
}
import imgui.binding.ImGuiStruct;
public final class NodeEditorContext extends ImGuiStruct {
public NodeEditorContext(final long ptr) {
super(ptr);
}
/*JNI
#include "_nodeeditor.h"
namespace ed = ax::NodeEditor;
#define IM_NODE_EDITOR_CONTEXT ((ed::EditorContext*)STRUCT_PTR)
*/
@Override
protected long create() {
return nCreate();
}
@Override
public void destroy() {
nDestroyEditorContext();
}
private native long nCreate(); /*
return (intptr_t)ed::CreateEditor();
*/
private static native long nCreate(long cfgPtr); /*
return (intptr_t)ed::CreateEditor((ed::Config*)cfgPtr);
*/
private native void nDestroyEditorContext(); /*
ed::DestroyEditor(IM_NODE_EDITOR_CONTEXT);
*/
}
@@ -3,8 +3,11 @@ package imgui.extension.nodeditor;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.binding.ImGuiStruct;
import imgui.extension.nodeditor.flag.NodeEditorStyleColor;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.TypeArray;
@BindingSource
public final class NodeEditorStyle extends ImGuiStruct {
public NodeEditorStyle(final long ptr) {
super(ptr);
@@ -12,340 +15,83 @@ public final class NodeEditorStyle extends ImGuiStruct {
/*JNI
#include "_nodeeditor.h"
namespace ed = ax::NodeEditor;
#define IM_NODE_EDITOR_STYLE ((ed::Style*)STRUCT_PTR)
#define THIS ((ax::NodeEditor::Style*)STRUCT_PTR)
*/
public ImVec4 getNodePadding() {
final ImVec4 value = new ImVec4();
getNodePadding(value);
return value;
}
@BindingField
public ImVec4 NodePadding;
@BindingField
public float NodeRounding;
public native void getNodePadding(ImVec4 dstImVec4); /*
Jni::ImVec4Cpy(env, IM_NODE_EDITOR_STYLE->NodePadding, dstImVec4);
*/
@BindingField
public float NodeBorderWidth;
public native void setNodePadding(float x, float y, float z, float w); /*
IM_NODE_EDITOR_STYLE->NodePadding.x = x;
IM_NODE_EDITOR_STYLE->NodePadding.y = y;
IM_NODE_EDITOR_STYLE->NodePadding.z = z;
IM_NODE_EDITOR_STYLE->NodePadding.w = w;
*/
@BindingField
public float HoveredNodeBorderWidth;
public native float getNodeRounding(); /*
return IM_NODE_EDITOR_STYLE->NodeRounding;
*/
@BindingField
public float SelectedNodeBorderWidth;
public native void setNodeRounding(float nodeRounding); /*
IM_NODE_EDITOR_STYLE->NodeRounding = nodeRounding;
*/
@BindingField
public float PinRounding;
public native float getNodeBorderWidth(); /*
return IM_NODE_EDITOR_STYLE->NodeBorderWidth;
*/
@BindingField
public float PinBorderWidth;
public native void setNodeBorderWidth(float nodeBorderWidth); /*
IM_NODE_EDITOR_STYLE->NodeBorderWidth = nodeBorderWidth;
*/
@BindingField
public float LinkStrength;
public native float getHoveredNodeBorderWidth(); /*
return IM_NODE_EDITOR_STYLE->HoveredNodeBorderWidth;
*/
@BindingField
public ImVec2 SourceDirection;
public native void setHoveredNodeBorderWidth(float hoveredNodeBorderWidth); /*
IM_NODE_EDITOR_STYLE->HoveredNodeBorderWidth = hoveredNodeBorderWidth;
*/
@BindingField
public ImVec2 TargetDirection;
public native float getSelectedNodeBorderWidth(); /*
return IM_NODE_EDITOR_STYLE->SelectedNodeBorderWidth;
*/
@BindingField
public float ScrollDuration;
public native void setSelectedNodeBorderWidth(float selectedNodeBorderWidth); /*
IM_NODE_EDITOR_STYLE->SelectedNodeBorderWidth = selectedNodeBorderWidth;
*/
@BindingField
public float FlowMarkerDistance;
public native float getPinRounding(); /*
return IM_NODE_EDITOR_STYLE->PinRounding;
*/
@BindingField
public float FlowSpeed;
public native void setPinRounding(float pinRounding); /*
IM_NODE_EDITOR_STYLE->PinRounding = pinRounding;
*/
@BindingField
public float FlowDuration;
public native float getPinBorderWidth(); /*
return IM_NODE_EDITOR_STYLE->PinBorderWidth;
*/
@BindingField
public ImVec2 PivotAlignment;
public native void setPinBorderWidth(float pinBorderWidth); /*
IM_NODE_EDITOR_STYLE->PinBorderWidth = pinBorderWidth;
*/
@BindingField
public ImVec2 PivotSize;
public native float getLinkStrength(); /*
return IM_NODE_EDITOR_STYLE->LinkStrength;
*/
@BindingField
public ImVec2 PivotScale;
public native void setLinkStrength(float linkStrength); /*
IM_NODE_EDITOR_STYLE->LinkStrength = linkStrength;
*/
@BindingField
public float PinCorners;
public ImVec2 getSourceDirection() {
final ImVec2 value = new ImVec2();
getSourceDirection(value);
return value;
}
@BindingField
public float PinRadius;
public native void getSourceDirection(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_NODE_EDITOR_STYLE->SourceDirection, dstImVec2);
*/
@BindingField
public float PinArrowSize;
public native float getSourceDirectionX(); /*
return IM_NODE_EDITOR_STYLE->SourceDirection.x;
*/
@BindingField
public float PinArrowWidth;
public native float getSourceDirectionY(); /*
return IM_NODE_EDITOR_STYLE->SourceDirection.y;
*/
@BindingField
public float GroupRounding;
public native void setSourceDirection(float x, float y); /*
IM_NODE_EDITOR_STYLE->SourceDirection.x = x;
IM_NODE_EDITOR_STYLE->SourceDirection.y = y;
*/
@BindingField
public float GroupBorderWidth;
public ImVec2 getTargetDirection() {
final ImVec2 value = new ImVec2();
getTargetDirection(value);
return value;
}
@BindingField
@TypeArray(type = "ImVec4", size = "ax::NodeEditor::StyleColor_Count")
public ImVec4[] Colors;
public native void getTargetDirection(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_NODE_EDITOR_STYLE->TargetDirection, dstImVec2);
*/
public native float getTargetDirectionX(); /*
return IM_NODE_EDITOR_STYLE->TargetDirection.x;
*/
public native float getTargetDirectionY(); /*
return IM_NODE_EDITOR_STYLE->TargetDirection.y;
*/
public native void setTargetDirection(float x, float y); /*
IM_NODE_EDITOR_STYLE->TargetDirection.x = x;
IM_NODE_EDITOR_STYLE->TargetDirection.y = y;
*/
public native float getScrollDuration(); /*
return IM_NODE_EDITOR_STYLE->ScrollDuration;
*/
public native void setScrollDuration(float scrollDuration); /*
IM_NODE_EDITOR_STYLE->ScrollDuration = scrollDuration;
*/
public native float getFlowMarkerDistance(); /*
return IM_NODE_EDITOR_STYLE->FlowMarkerDistance;
*/
public native void setFlowMarkerDistance(float flowMarkerDistance); /*
IM_NODE_EDITOR_STYLE->FlowMarkerDistance = flowMarkerDistance;
*/
public native float getFlowSpeed(); /*
return IM_NODE_EDITOR_STYLE->FlowSpeed;
*/
public native void setFlowSpeed(float flowSpeed); /*
IM_NODE_EDITOR_STYLE->FlowSpeed = flowSpeed;
*/
public native float getFlowDuration(); /*
return IM_NODE_EDITOR_STYLE->FlowDuration;
*/
public native void setFlowDuration(float flowDuration); /*
IM_NODE_EDITOR_STYLE->FlowDuration = flowDuration;
*/
public ImVec2 getPivotAlignment() {
final ImVec2 value = new ImVec2();
getPivotAlignment(value);
return value;
}
public native void getPivotAlignment(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_NODE_EDITOR_STYLE->PivotAlignment, dstImVec2);
*/
public native float getPivotAlignmentX(); /*
return IM_NODE_EDITOR_STYLE->PivotAlignment.x;
*/
public native float getPivotAlignmentY(); /*
return IM_NODE_EDITOR_STYLE->PivotAlignment.y;
*/
public native void setPivotAlignment(float x, float y); /*
IM_NODE_EDITOR_STYLE->PivotAlignment.x = x;
IM_NODE_EDITOR_STYLE->PivotAlignment.y = y;
*/
public ImVec2 getPivotSize() {
final ImVec2 value = new ImVec2();
getPivotSize(value);
return value;
}
public native void getPivotSize(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_NODE_EDITOR_STYLE->PivotSize, dstImVec2);
*/
public native float getPivotSizeX(); /*
return IM_NODE_EDITOR_STYLE->PivotSize.x;
*/
public native float getPivotSizeY(); /*
return IM_NODE_EDITOR_STYLE->PivotSize.y;
*/
public native void setPivotSize(float x, float y); /*
IM_NODE_EDITOR_STYLE->PivotSize.x = x;
IM_NODE_EDITOR_STYLE->PivotSize.y = y;
*/
public ImVec2 getPivotScale() {
final ImVec2 value = new ImVec2();
getPivotScale(value);
return value;
}
public native void getPivotScale(ImVec2 dstImVec2); /*
Jni::ImVec2Cpy(env, &IM_NODE_EDITOR_STYLE->PivotScale, dstImVec2);
*/
public native float getPivotScaleX(); /*
return IM_NODE_EDITOR_STYLE->PivotScale.x;
*/
public native float getPivotScaleY(); /*
return IM_NODE_EDITOR_STYLE->PivotScale.y;
*/
public native void setPivotScale(float x, float y); /*
IM_NODE_EDITOR_STYLE->PivotScale.x = x;
IM_NODE_EDITOR_STYLE->PivotScale.y = y;
*/
public native float getPinCorners(); /*
return IM_NODE_EDITOR_STYLE->PinCorners;
*/
public native void setPinCorners(float pinCorners); /*
IM_NODE_EDITOR_STYLE->PinCorners = pinCorners;
*/
public native float getPinRadius(); /*
return IM_NODE_EDITOR_STYLE->PinRadius;
*/
public native void setPinRadius(float pinRadius); /*
IM_NODE_EDITOR_STYLE->PinRadius = pinRadius;
*/
public native float getPinArrowSize(); /*
return IM_NODE_EDITOR_STYLE->PinArrowSize;
*/
public native void setPinArrowSize(float pinArrowSize); /*
IM_NODE_EDITOR_STYLE->PinArrowSize = pinArrowSize;
*/
public native float getPinArrowWidth(); /*
return IM_NODE_EDITOR_STYLE->PinArrowWidth;
*/
public native void setPinArrowWidth(float pinArrowWidth); /*
IM_NODE_EDITOR_STYLE->PinArrowWidth = pinArrowWidth;
*/
public native float getGroupRounding(); /*
return IM_NODE_EDITOR_STYLE->GroupRounding;
*/
public native void setGroupRounding(float groupRounding); /*
IM_NODE_EDITOR_STYLE->GroupRounding = groupRounding;
*/
public native float getGroupBorderWidth(); /*
return IM_NODE_EDITOR_STYLE->GroupBorderWidth;
*/
public native void setGroupBorderWidth(float groupBorderWidth); /*
IM_NODE_EDITOR_STYLE->GroupBorderWidth = groupBorderWidth;
*/
public float[][] getColors() {
final float[][] colors = new float[NodeEditorStyleColor.COUNT][4];
getColors(colors);
return colors;
}
public native void getColors(float[][] buff); /*
for (int i = 0; i < ed::StyleColor_Count; i++) {
jfloatArray jColors = (jfloatArray)env->GetObjectArrayElement(buff, i);
jfloat* jBuffColor = env->GetFloatArrayElements(jColors, 0);
jBuffColor[0] = IM_NODE_EDITOR_STYLE->Colors[i].x;
jBuffColor[1] = IM_NODE_EDITOR_STYLE->Colors[i].y;
jBuffColor[2] = IM_NODE_EDITOR_STYLE->Colors[i].z;
jBuffColor[3] = IM_NODE_EDITOR_STYLE->Colors[i].w;
env->ReleaseFloatArrayElements(jColors, jBuffColor, 0);
env->DeleteLocalRef(jColors);
}
*/
/**
* BINDING NOTICE: colors is a 2d array with sizes: [StyleColor_Count][4]
/*JNI
#undef THIS
*/
public native void setColors(float[][] colors); /*
for (int i = 0; i < ed::StyleColor_Count; i++) {
jfloatArray jColors = (jfloatArray)env->GetObjectArrayElement(colors, i);
jfloat* jColor = env->GetFloatArrayElements(jColors, 0);
IM_NODE_EDITOR_STYLE->Colors[i].x = jColor[0];
IM_NODE_EDITOR_STYLE->Colors[i].y = jColor[1];
IM_NODE_EDITOR_STYLE->Colors[i].z = jColor[2];
IM_NODE_EDITOR_STYLE->Colors[i].w = jColor[3];
env->ReleaseFloatArrayElements(jColors, jColor, 0);
env->DeleteLocalRef(jColors);
}
*/
public ImVec4 getColor(final int styleColor) {
final ImVec4 value = new ImVec4();
getColor(styleColor, value);
return value;
}
public native void getColor(int styleColor, ImVec4 dstImVec4); /*
Jni::ImVec4Cpy(env, IM_NODE_EDITOR_STYLE->Colors[styleColor], dstImVec4);
*/
public native void setColor(int styleColor, float r, float g, float b, float a); /*
IM_NODE_EDITOR_STYLE->Colors[styleColor] = ImColor((float)r, (float)g, (float)b, (float)a);
*/
public native void setColor(int styleColor, int r, int g, int b, int a); /*
IM_NODE_EDITOR_STYLE->Colors[styleColor] = ImColor((int)r, (int)g, (int)b, (int)a);
*/
public native void setColor(int styleColor, int col); /*
IM_NODE_EDITOR_STYLE->Colors[styleColor] = ImColor(col);
*/
}
@@ -0,0 +1,13 @@
package imgui.extension.nodeditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class NodeEditorFlowDirection {
private NodeEditorFlowDirection() {
}
@BindingAstEnum(file = "ast-imgui_node_editor.json", qualType = "ax::NodeEditor::FlowDirection")
public Void __;
}
@@ -1,9 +1,13 @@
package imgui.extension.nodeditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class NodeEditorPinKind {
private NodeEditorPinKind() {
}
public static final int Input = 0;
public static final int Output = 1;
@BindingAstEnum(file = "ast-imgui_node_editor.json", qualType = "ax::NodeEditor::PinKind")
public Void __;
}
@@ -1,26 +1,13 @@
package imgui.extension.nodeditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class NodeEditorStyleColor {
private NodeEditorStyleColor() {
}
public static final int Bg = 0;
public static final int Grid = 1;
public static final int NodeBg = 2;
public static final int NodeBorder = 3;
public static final int HovNodeBorder = 4;
public static final int SelNodeBorder = 5;
public static final int NodeSelRect = 6;
public static final int NodeSelRectBorder = 7;
public static final int HovLinkBorder = 8;
public static final int SelLinkBorder = 9;
public static final int LinkSelRect = 10;
public static final int LinkSelRectBorder = 11;
public static final int PinRect = 12;
public static final int PinRectBorder = 13;
public static final int Flow = 14;
public static final int FlowMarker = 15;
public static final int GroupBg = 16;
public static final int GroupBorder = 17;
public static final int COUNT = 18;
@BindingAstEnum(file = "ast-imgui_node_editor.json", qualType = "ax::NodeEditor::StyleColor", sanitizeName = "StyleColor_")
public Void __;
}
@@ -1,30 +1,13 @@
package imgui.extension.nodeditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class NodeEditorStyleVar {
private NodeEditorStyleVar() {
}
public static final int NodePadding = 0;
public static final int NodeRounding = 1;
public static final int NodeBorderWidth = 2;
public static final int HoveredNodeBorderWidth = 3;
public static final int SelectedNodeBorderWidth = 4;
public static final int PinRounding = 5;
public static final int PinBorderWidth = 6;
public static final int LinkStrength = 7;
public static final int SourceDirection = 8;
public static final int TargetDirection = 9;
public static final int ScrollDuration = 10;
public static final int FlowMarkerDistance = 11;
public static final int FlowSpeed = 12;
public static final int FlowDuration = 13;
public static final int PivotAlignment = 14;
public static final int PivotSize = 15;
public static final int PivotScale = 16;
public static final int PinCorners = 17;
public static final int PinRadius = 18;
public static final int PinArrowSize = 19;
public static final int PinArrowWidth = 20;
public static final int GroupRounding = 21;
public static final int GroupBorderWidth = 22;
@BindingAstEnum(file = "ast-imgui_node_editor.json", qualType = "ax::NodeEditor::StyleVar", sanitizeName = "StyleVar_")
public Void __;
}
@@ -1,16 +1,17 @@
package imgui.extension.texteditor;
import imgui.ImVec2;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.ArgValue;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.OptArg;
import imgui.binding.annotation.ReturnValue;
import java.util.Map;
@BindingSource
public final class TextEditor extends ImGuiStructDestroyable {
/*JNI
#include "_texteditor.h"
#define TEXT_EDITOR ((TextEditor*)STRUCT_PTR)
*/
public TextEditor() {
}
@@ -23,30 +24,31 @@ public final class TextEditor extends ImGuiStructDestroyable {
return nCreate();
}
/*JNI
#include "_texteditor.h"
#define THIS ((TextEditor*)STRUCT_PTR)
#define TextEditorLanguageDefinition TextEditor::LanguageDefinition
*/
private native long nCreate(); /*
return (intptr_t)(new TextEditor());
*/
public void setLanguageDefinition(final TextEditorLanguageDefinition definition) {
nSetLanguageDefinition(definition.ptr);
}
@BindingMethod
public native void SetLanguageDefinition(@ArgValue(callPrefix = "*") TextEditorLanguageDefinition aLanguageDef);
public native void nSetLanguageDefinition(long ptr); /*
TEXT_EDITOR->SetLanguageDefinition(*((TextEditor::LanguageDefinition*)ptr));
*/
@BindingMethod
@ReturnValue(callPrefix = "&")
public native TextEditorLanguageDefinition GetLanguageDefinition();
public native int[] getPalette(); /*
const auto& palette = TEXT_EDITOR->GetPalette();
const auto& palette = THIS->GetPalette();
jintArray res = env->NewIntArray(palette.size());
jint arr[palette.size()];
for (int i = 0; i < palette.size(); i++) {
arr[i] = palette[i];
}
env->SetIntArrayRegion(res, 0, palette.size(), arr);
return res;
*/
@@ -56,33 +58,28 @@ public final class TextEditor extends ImGuiStructDestroyable {
public native void nSetPalette(int[] palette, int length); /*
std::array<ImU32, (unsigned)TextEditor::PaletteIndex::Max> arr;
for (int i = 0; i < length; i++) {
arr[i] = palette[i];
}
TEXT_EDITOR->SetPalette(arr);
THIS->SetPalette(arr);
*/
public void setErrorMarkers(final Map<Integer, String> errorMarkers) {
final int[] keys = errorMarkers.keySet().stream().mapToInt(i -> i).toArray();
final String[] values = errorMarkers.values().toArray(new String[0]);
nSetErrorMarkers(keys, keys.length, values, values.length);
}
private native void nSetErrorMarkers(int[] keys, int keysLen, String[] values, int valuesLen); /*
std::map<int, std::string> markers;
for (int i = 0; i < keysLen; i++) {
int key = keys[i];
jstring string = (jstring)env->GetObjectArrayElement(values, i);
const char* value = env->GetStringUTFChars(string, JNI_FALSE);
markers.emplace(std::pair<int, std::string>(key, std::string(value)));
env->ReleaseStringUTFChars(string, value);
}
TEXT_EDITOR->SetErrorMarkers(markers);
THIS->SetErrorMarkers(markers);
*/
public void setBreakpoints(final int[] breakpoints) {
@@ -91,25 +88,21 @@ public final class TextEditor extends ImGuiStructDestroyable {
private native void nSetBreakpoints(int[] breakpoints, int length); /*
std::unordered_set<int> set;
for (int i = 0; i < length; i++) {
set.emplace(breakpoints[i]);
}
TEXT_EDITOR->SetBreakpoints(set);
THIS->SetBreakpoints(set);
*/
public native void render(String title); /*
TEXT_EDITOR->Render(title);
*/
@BindingMethod
public native void Render(String title, @OptArg(callValue = "ImVec2()") ImVec2 aSize, @OptArg boolean aBorder);
public native void setText(String text); /*
TEXT_EDITOR->SetText(text);
*/
@BindingMethod
public native void SetText(String text);
public native String getText(); /*
return env->NewStringUTF(TEXT_EDITOR->GetText().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public native String GetText();
public void setTextLines(final String[] lines) {
nSetTextLines(lines, lines.length);
@@ -118,260 +111,203 @@ public final class TextEditor extends ImGuiStructDestroyable {
private native void nSetTextLines(String[] lines, int length); /*
std::vector<std::string> vec;
vec.reserve(length);
for (int i = 0; i < length; i++) {
jstring string = (jstring)env->GetObjectArrayElement(lines, i);
const char* raw = env->GetStringUTFChars(string, JNI_FALSE);
vec.emplace_back(std::string(raw));
env->ReleaseStringUTFChars(string, raw);
}
TEXT_EDITOR->SetTextLines(vec);
THIS->SetTextLines(vec);
*/
public native String[] getTextLines(); /*
const auto lines = TEXT_EDITOR->GetTextLines();
const auto lines = THIS->GetTextLines();
jobjectArray arr = (jobjectArray)env->NewObjectArray(lines.size(),
jobjectArray arr = env->NewObjectArray(
lines.size(),
env->FindClass("java/lang/String"),
env->NewStringUTF(""));
env->NewStringUTF("")
);
for (int i = 0; i < lines.size(); i++) {
const auto& str = lines[i];
env->SetObjectArrayElement(arr, i, env->NewStringUTF(str.c_str()));
}
return arr;
*/
public native String getSelectedText(); /*
return env->NewStringUTF(TEXT_EDITOR->GetSelectedText().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public native String GetSelectedText();
public native String getCurrentLineText(); /*
return env->NewStringUTF(TEXT_EDITOR->GetCurrentLineText().c_str());
*/
@BindingMethod
@ReturnValue(callSuffix = ".c_str()")
public native String GetCurrentLineText();
public native int getTotalLines(); /*
return TEXT_EDITOR->GetTotalLines();
*/
@BindingMethod
public native int GetTotalLines();
public native boolean isOverwrite(); /*
return TEXT_EDITOR->IsOverwrite();
*/
@BindingMethod
public native boolean IsOverwrite();
public native void setReadOnly(boolean value); /*
TEXT_EDITOR->SetReadOnly(value);
*/
@BindingMethod
public native void SetReadOnly(boolean aValue);
public native boolean isReadOnly(); /*
return TEXT_EDITOR->IsReadOnly();
*/
@BindingMethod
public native boolean IsReadOnly();
public native boolean isTextChanged(); /*
return TEXT_EDITOR->IsTextChanged();
*/
@BindingMethod
public native boolean IsTextChanged();
public native boolean isCursorPositionChanged(); /*
return TEXT_EDITOR->IsCursorPositionChanged();
*/
@BindingMethod
public native boolean IsCursorPositionChanged();
public native boolean isColorizerEnabled(); /*
return TEXT_EDITOR->IsColorizerEnabled();
*/
@BindingMethod
public native boolean IsColorizerEnabled();
public native void setColorizerEnable(boolean value); /*
TEXT_EDITOR->SetColorizerEnable(value);
*/
@BindingMethod
public native void SetColorizerEnable(boolean aValue);
public native int getCursorPositionLine(); /*
return TEXT_EDITOR->GetCursorPosition().mLine;
*/
@BindingMethod
public native TextEditorCoordinates GetCursorPosition();
public native int getCursorPositionColumn(); /*
return TEXT_EDITOR->GetCursorPosition().mColumn;
*/
@BindingMethod
public native void SetCursorPosition(TextEditorCoordinates aPosition);
public native void setCursorPosition(int line, int column); /*
TEXT_EDITOR->SetCursorPosition({ line, column });
*/
@BindingMethod
public native void SetHandleMouseInputs(boolean aValue);
public native void setHandleMouseInputs(boolean value); /*
TEXT_EDITOR->SetHandleMouseInputs(value);
*/
@BindingMethod
public native boolean IsHandleMouseInputsEnabled();
public native boolean isHandleMouseInputsEnabled(); /*
return TEXT_EDITOR->IsHandleMouseInputsEnabled();
*/
@BindingMethod
public native void SetHandleKeyboardInputs(boolean aValue);
public native void setHandleKeyboardInputs(boolean value); /*
TEXT_EDITOR->SetHandleKeyboardInputs(value);
*/
@BindingMethod
public native boolean IsHandleKeyboardInputsEnabled();
public native boolean isHandleKeyboardInputsEnabled(); /*
return TEXT_EDITOR->IsHandleKeyboardInputsEnabled();
*/
@BindingMethod
public native void SetImGuiChildIgnored(boolean aValue);
public native void setImGuiChildIgnored(boolean value); /*
TEXT_EDITOR->SetImGuiChildIgnored(value);
*/
@BindingMethod
public native boolean IsImGuiChildIgnored();
public native boolean isImGuiChildIgnored(); /*
return TEXT_EDITOR->IsImGuiChildIgnored();
*/
@BindingMethod
public native void SetShowWhitespaces(boolean aValue);
public native void setShowWhitespaces(boolean value); /*
TEXT_EDITOR->SetShowWhitespaces(value);
*/
@BindingMethod
public native boolean IsShowingWhitespaces();
public native boolean isShowingWhitespaces(); /*
return TEXT_EDITOR->IsShowingWhitespaces();
*/
@BindingMethod
public native void SetTabSize(int aValue);
public native void setTabSize(int value); /*
TEXT_EDITOR->SetTabSize(value);
*/
@BindingMethod
public native int GetTabSize();
public native int getTabSize(); /*
return TEXT_EDITOR->GetTabSize();
*/
@BindingMethod
public native void InsertText(String aValue);
public native void insertText(String value); /*
TEXT_EDITOR->InsertText(value);
*/
@BindingMethod
public native void MoveUp(@OptArg int aAmount, @OptArg boolean aSelect);
public native void moveUp(int amount, boolean select); /*
TEXT_EDITOR->MoveUp(amount, select);
*/
@BindingMethod
public native void MoveDown(@OptArg int aAmount, @OptArg boolean aSelect);
public native void moveDown(int amount, boolean select); /*
TEXT_EDITOR->MoveDown(amount, select);
*/
@BindingMethod
public native void MoveLeft(@OptArg int aAmount, @OptArg boolean aSelect, @OptArg boolean aWordMode);
public native void moveLeft(int amount, boolean select, boolean wordMode); /*
TEXT_EDITOR->MoveLeft(amount, select, wordMode);
*/
@BindingMethod
public native void MoveRight(@OptArg int aAmount, @OptArg boolean aSelect, @OptArg boolean aWordMode);
public native void moveRight(int amount, boolean select, boolean wordMode); /*
TEXT_EDITOR->MoveRight(amount, select, wordMode);
*/
@BindingMethod
public native void MoveTop(@OptArg boolean aSelect);
public native void moveTop(boolean select); /*
TEXT_EDITOR->MoveTop(select);
*/
@BindingMethod
public native void MoveBottom(@OptArg boolean aSelect);
public native void moveBottom(boolean select); /*
TEXT_EDITOR->MoveBottom(select);
*/
@BindingMethod
public native void MoveHome(@OptArg boolean aSelect);
public native void moveHome(boolean select); /*
TEXT_EDITOR->MoveHome(select);
*/
@BindingMethod
public native void MoveEnd(@OptArg boolean aSelect);
public native void moveEnd(boolean select); /*
TEXT_EDITOR->MoveEnd(select);
*/
@BindingMethod
public native void SetSelectionStart(TextEditorCoordinates aPosition);
public native void setSelectionStart(int line, int column); /*
TEXT_EDITOR->SetSelectionStart({ line, column });
*/
@BindingMethod
public native void SetSelectionEnd(TextEditorCoordinates aPosition);
public native void setSelectionEnd(int line, int column); /*
TEXT_EDITOR->SetSelectionEnd({ line, column });
*/
@BindingMethod
public native void SetSelection(TextEditorCoordinates aStart, TextEditorCoordinates aEnd, @OptArg @ArgValue(staticCast = "TextEditor::SelectionMode") int aMode);
public native void setSelection(int lineStart, int columnStart, int lineEnd, int columnEnd, int selectionMode); /*
TEXT_EDITOR->SetSelection({ lineStart, columnStart }, { lineEnd, columnEnd },
static_cast<TextEditor::SelectionMode>(selectionMode));
*/
@BindingMethod
public native void SelectWordUnderCursor();
public native void selectWordUnderCursor(); /*
TEXT_EDITOR->SelectWordUnderCursor();
*/
@BindingMethod
public native void SelectAll();
public native void selectAll(); /*
TEXT_EDITOR->SelectAll();
*/
@BindingMethod
public native boolean HasSelection();
public native boolean hasSelection(); /*
return TEXT_EDITOR->HasSelection();
*/
@BindingMethod
public native void Copy();
public native void copy(); /*
TEXT_EDITOR->Copy();
*/
@BindingMethod
public native void Cut();
public native void cut(); /*
TEXT_EDITOR->Cut();
*/
@BindingMethod
public native void Paste();
public native void paste(); /*
TEXT_EDITOR->Paste();
*/
@BindingMethod
public native void Delete();
public native void delete(); /*
TEXT_EDITOR->Delete();
*/
@BindingMethod
public native boolean CanUndo();
public native boolean canUndo(); /*
return TEXT_EDITOR->CanUndo();
*/
@BindingMethod
public native boolean CanRedo();
public native boolean canRedo(); /*
return TEXT_EDITOR->CanRedo();
*/
@BindingMethod
public native void Undo(@OptArg int aSteps);
public native void undo(int steps); /*
TEXT_EDITOR->Undo(steps);
*/
public native void redo(int steps); /*
TEXT_EDITOR->Redo(steps);
*/
@BindingMethod
public native void Redo(@OptArg int aSteps);
public native int[] getDarkPalette(); /*
const auto& palette = TEXT_EDITOR->GetDarkPalette();
const auto& palette = THIS->GetDarkPalette();
jintArray res = env->NewIntArray(palette.size());
jint arr[palette.size()];
for (int i = 0; i < palette.size(); i++) {
arr[i] = palette[i];
}
env->SetIntArrayRegion(res, 0, palette.size(), arr);
return res;
*/
public native int[] getLightPalette(); /*
const auto& palette = TEXT_EDITOR->GetLightPalette();
const auto& palette = THIS->GetLightPalette();
jintArray res = env->NewIntArray(palette.size());
jint arr[palette.size()];
for (int i = 0; i < palette.size(); i++) {
arr[i] = palette[i];
}
env->SetIntArrayRegion(res, 0, palette.size(), arr);
return res;
*/
public native int[] getRetroBluePalette(); /*
const auto& palette = TEXT_EDITOR->GetRetroBluePalette();
const auto& palette = THIS->GetRetroBluePalette();
jintArray res = env->NewIntArray(palette.size());
jint arr[palette.size()];
for (int i = 0; i < palette.size(); i++) {
arr[i] = palette[i];
}
env->SetIntArrayRegion(res, 0, palette.size(), arr);
return res;
*/
/*JNI
#undef TextEditorLanguageDefinition
#undef THIS
*/
}
@@ -0,0 +1,90 @@
package imgui.extension.texteditor;
import java.util.Objects;
public final class TextEditorCoordinates implements Cloneable {
public int mLine;
public int mColumn;
public TextEditorCoordinates() {
}
public TextEditorCoordinates(final int mLine, final int mColumn) {
set(mLine, mColumn);
}
public TextEditorCoordinates(final TextEditorCoordinates value) {
set(value.mLine, value.mColumn);
}
public TextEditorCoordinates set(final int mLine, final int mColumn) {
this.mLine = mLine;
this.mColumn = mColumn;
return this;
}
public TextEditorCoordinates set(final TextEditorCoordinates value) {
return set(value.mLine, value.mColumn);
}
public TextEditorCoordinates plus(final int mLine, final int mColumn) {
this.mLine += mLine;
this.mColumn += mColumn;
return this;
}
public TextEditorCoordinates plus(final TextEditorCoordinates value) {
return plus(value.mLine, value.mColumn);
}
public TextEditorCoordinates minus(final int mLine, final int mColumn) {
this.mLine -= mLine;
this.mColumn -= mColumn;
return this;
}
public TextEditorCoordinates minus(final TextEditorCoordinates value) {
return minus(value.mLine, value.mColumn);
}
public TextEditorCoordinates times(final int mLine, final int mColumn) {
this.mLine *= mLine;
this.mColumn *= mColumn;
return this;
}
public TextEditorCoordinates times(final TextEditorCoordinates value) {
return times(value.mLine, value.mColumn);
}
@Override
public String toString() {
return "TextEditorCoordinates{"
+ "mLine=" + mLine
+ ", mColumn=" + mColumn
+ '}';
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final TextEditorCoordinates textEditorCoordinates = (TextEditorCoordinates) o;
return textEditorCoordinates.mLine == mLine && textEditorCoordinates.mColumn == mColumn;
}
@Override
public int hashCode() {
return Objects.hash(mLine, mColumn);
}
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public TextEditorCoordinates clone() {
return new TextEditorCoordinates(this);
}
}
@@ -1,16 +1,15 @@
package imgui.extension.texteditor;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingMethod;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.ReturnValue;
import java.util.Map;
@BindingSource
public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
/*JNI
#include "_texteditor.h"
#define LANG_DEF ((TextEditor::LanguageDefinition*)STRUCT_PTR)
*/
public TextEditorLanguageDefinition() {
}
@@ -23,13 +22,19 @@ public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
return nCreate();
}
/*JNI
#include "_texteditor.h"
#define THIS ((TextEditor::LanguageDefinition*)STRUCT_PTR)
#define TextEditorLanguageDefinition TextEditor::LanguageDefinition
*/
private native long nCreate(); /*
return (intptr_t)(new TextEditor::LanguageDefinition());
*/
public native void setName(String name); /*
LANG_DEF->mName = name;
*/
@BindingField(callName = "mName")
@ReturnValue(callSuffix = ".c_str()")
public String Name;
public void setKeywords(final String[] keywords) {
nSetKeywords(keywords, keywords.length);
@@ -37,169 +42,133 @@ public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable {
private native void nSetKeywords(String[] keywords, int length); /*
std::unordered_set<std::string> set;
for (int i = 0; i < length; i++) {
jstring string = (jstring)env->GetObjectArrayElement(keywords, i);
const char* raw = env->GetStringUTFChars(string, JNI_FALSE);
set.emplace(std::string(raw));
env->ReleaseStringUTFChars(string, raw);
}
LANG_DEF->mKeywords = set;
THIS->mKeywords = set;
*/
public void setIdentifiers(final Map<String, String> identifiers) {
final String[] keys = identifiers.keySet().toArray(new String[0]);
final String[] decl = identifiers.values().toArray(new String[0]);
nSetIdentifiers(keys, keys.length, decl, decl.length);
}
private native void nSetIdentifiers(String[] keys, int keysLen, String[] decl, int declLen); /*
std::unordered_map<std::string, TextEditor::Identifier> identifiers;
for (int i = 0; i < keysLen; i++) {
jstring string1 = (jstring)env->GetObjectArrayElement(keys, i);
const char* key = env->GetStringUTFChars(string1, JNI_FALSE);
jstring string2 = (jstring)env->GetObjectArrayElement(decl, i);
const char* key = env->GetStringUTFChars(string1, JNI_FALSE);
const char* value = env->GetStringUTFChars(string2, JNI_FALSE);
TextEditor::Identifier id;
id.mDeclaration = std::string(value);
identifiers.insert(std::pair<std::string, TextEditor::Identifier>(std::string(key), id));
env->ReleaseStringUTFChars(string1, key);
env->ReleaseStringUTFChars(string2, value);
}
LANG_DEF->mIdentifiers = identifiers;
THIS->mIdentifiers = identifiers;
*/
public void setPreprocIdentifiers(final Map<String, String> identifiers) {
final String[] keys = identifiers.keySet().toArray(new String[0]);
final String[] decl = identifiers.values().toArray(new String[0]);
nSetPreprocIdentifiers(keys, keys.length, decl, decl.length);
}
private native void nSetPreprocIdentifiers(String[] keys, int keysLen, String[] decl, int declLen); /*
std::unordered_map<std::string, TextEditor::Identifier> preprocIdentifiers;
for (int i = 0; i < keysLen; i++) {
jstring string1 = (jstring)env->GetObjectArrayElement(keys, i);
const char* key = env->GetStringUTFChars(string1, JNI_FALSE);
jstring string2 = (jstring)env->GetObjectArrayElement(decl, i);
const char* key = env->GetStringUTFChars(string1, JNI_FALSE);
const char* value = env->GetStringUTFChars(string2, JNI_FALSE);
TextEditor::Identifier id;
id.mDeclaration = std::string(value);
preprocIdentifiers.insert(std::pair<std::string, TextEditor::Identifier>(std::string(key), id));
env->ReleaseStringUTFChars(string1, key);
env->ReleaseStringUTFChars(string2, value);
}
LANG_DEF->mPreprocIdentifiers = preprocIdentifiers;
THIS->mPreprocIdentifiers = preprocIdentifiers;
*/
public native void setCommentStart(String value); /*
LANG_DEF->mCommentStart = value;
*/
@BindingField(callName = "mCommentStart")
@ReturnValue(callSuffix = ".c_str()")
public String CommentStart;
public native void setCommentEnd(String value); /*
LANG_DEF->mCommentEnd = value;
*/
@BindingField(callName = "mCommentEnd")
@ReturnValue(callSuffix = ".c_str()")
public String CommentEnd;
public native void setSingleLineComment(String value); /*
LANG_DEF->mSingleLineComment = value;
*/
@BindingField(callName = "mSingleLineComment")
@ReturnValue(callSuffix = ".c_str()")
public String SingleLineComment;
public native void setPreprocChar(char value); /*
LANG_DEF->mPreprocChar = value;
*/
@BindingField(callName = "mPreprocChar")
public char PreprocChar;
public native void setAutoIdentation(boolean value); /*
LANG_DEF->mAutoIndentation = value;
*/
@BindingField(callName = "mAutoIndentation")
public boolean AutoIndentation;
public void setTokenRegexStrings(final Map<String, Integer> tokenRegexStrings) {
final String[] keys = tokenRegexStrings.keySet().toArray(new String[0]);
final int[] paletteIndexes = tokenRegexStrings.values().stream().mapToInt(i -> i).toArray();
nSetTokenRegexStrings(keys, keys.length, paletteIndexes, paletteIndexes.length);
}
private native void nSetTokenRegexStrings(String[] keys, int keysLen, int[] paletteIndexes, int paletteIndexesLen); /*
std::vector<std::pair<std::string, TextEditor::PaletteIndex>> tokenRegexStrings;
for (int i = 0; i < keysLen; i++) {
jstring string = (jstring)env->GetObjectArrayElement(keys, i);
const char* key = env->GetStringUTFChars(string, JNI_FALSE);
int value = paletteIndexes[i];
tokenRegexStrings.emplace_back(std::pair<std::string, TextEditor::PaletteIndex>(std::string(key),
static_cast<TextEditor::PaletteIndex>(value)));
tokenRegexStrings.emplace_back(
std::pair<std::string, TextEditor::PaletteIndex>(
std::string(key),
static_cast<TextEditor::PaletteIndex>(value)
)
);
env->ReleaseStringUTFChars(string, key);
}
LANG_DEF->mTokenRegexStrings = tokenRegexStrings;
THIS->mTokenRegexStrings = tokenRegexStrings;
*/
private native void setCaseSensitive(boolean value); /*
LANG_DEF->mCaseSensitive = value;
*/
@BindingField
public boolean mCaseSensitive;
public static TextEditorLanguageDefinition cPlusPlus() {
return new TextEditorLanguageDefinition(nCPlusPlus());
}
@BindingMethod(name = "CPlusPlus")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition CPlusPlus();
public static TextEditorLanguageDefinition hlsl() {
return new TextEditorLanguageDefinition(nHLSL());
}
@BindingMethod(name = "HLSL")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition HLSL();
public static TextEditorLanguageDefinition glsl() {
return new TextEditorLanguageDefinition(nGLSL());
}
@BindingMethod(name = "GLSL")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition GLSL();
public static TextEditorLanguageDefinition c() {
return new TextEditorLanguageDefinition(nC());
}
@BindingMethod(name = "C")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition C();
public static TextEditorLanguageDefinition sql() {
return new TextEditorLanguageDefinition(nSQL());
}
@BindingMethod(name = "SQL")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition SQL();
public static TextEditorLanguageDefinition angelScript() {
return new TextEditorLanguageDefinition(nAngelScript());
}
@BindingMethod(name = "AngelScript")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition AngelScript();
public static TextEditorLanguageDefinition lua() {
return new TextEditorLanguageDefinition(nLua());
}
@BindingMethod(name = "Lua")
@ReturnValue(isStatic = true, callPrefix = "&")
public static native TextEditorLanguageDefinition Lua();
private static native long nCPlusPlus(); /*
return (intptr_t)&TextEditor::LanguageDefinition::CPlusPlus();
*/
private static native long nHLSL(); /*
return (intptr_t)&TextEditor::LanguageDefinition::HLSL();
*/
private static native long nGLSL(); /*
return (intptr_t)&TextEditor::LanguageDefinition::GLSL();
*/
private static native long nC(); /*
return (intptr_t)&TextEditor::LanguageDefinition::C();
*/
private static native long nSQL(); /*
return (intptr_t)&TextEditor::LanguageDefinition::SQL();
*/
private static native long nAngelScript(); /*
return (intptr_t)&TextEditor::LanguageDefinition::AngelScript();
*/
private static native long nLua(); /*
return (intptr_t)&TextEditor::LanguageDefinition::Lua();
*/
/*JNI
#undef TextEditorLanguageDefinition
#undef THIS
*/
}
@@ -1,29 +1,13 @@
package imgui.extension.texteditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class TextEditorPaletteIndex {
private TextEditorPaletteIndex() {
}
public static final int Default = 0;
public static final int Keyword = 1;
public static final int Number = 2;
public static final int String = 3;
public static final int CharLiteral = 4;
public static final int Punctuation = 5;
public static final int Preprocessor = 6;
public static final int Identifier = 7;
public static final int KnownIdentifier = 8;
public static final int PreprocIdentifier = 9;
public static final int Comment = 10;
public static final int MultiLineComment = 11;
public static final int Background = 12;
public static final int Cursor = 13;
public static final int Selection = 14;
public static final int ErrorMarker = 15;
public static final int Breakpoint = 16;
public static final int LineNumber = 17;
public static final int CurrentLineFill = 18;
public static final int CurrentLineFillInactive = 19;
public static final int CurrentLineEdge = 20;
public static final int Max = 21;
@BindingAstEnum(file = "ast-TextEditor.json", qualType = "TextEditor::PaletteIndex")
public Void __;
}
@@ -1,10 +1,13 @@
package imgui.extension.texteditor.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class TextEditorSelectionMode {
private TextEditorSelectionMode() {
}
public static final int Normal = 0;
public static final int Word = 1;
public static final int Line = 2;
@BindingAstEnum(file = "ast-TextEditor.json", qualType = "TextEditor::SelectionMode")
public Void __;
}
@@ -1,42 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImDrawList functions
*/
@BindingSource
public final class ImDrawFlags {
private ImDrawFlags() {
}
public static final int None = 0;
/**
* PathStroke(), AddPolyline(): specify that shape should be closed (Important: this is always == 1 for legacy reason)
*/
public static final int Closed = 1;
/**
* AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding {@code >} 0.0f, we default to all corners). Was 0x01.
*/
public static final int RoundCornersTopLeft = 1 << 4;
/**
* AddRect(), AddRectFilled(), PathRect(): enable rounding top-right corner only (when rounding {@code >} 0.0f, we default to all corners). Was 0x02.
*/
public static final int RoundCornersTopRight = 1 << 5;
/**
* AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-left corner only (when rounding {@code >} 0.0f, we default to all corners). Was 0x04.
*/
public static final int RoundCornersBottomLeft = 1 << 6;
/**
* AddRect(), AddRectFilled(), PathRect(): enable rounding bottom-right corner only (when rounding {@code >} 0.0f, we default to all corners). Wax 0x08.
*/
public static final int RoundCornersBottomRight = 1 << 7;
/**
* AddRect(), AddRectFilled(), PathRect(): disable rounding on all corners (when rounding {@code >} 0.0f). This is NOT zero, NOT an implicit flag!
*/
public static final int RoundCornersNone = 1 << 8;
public static final int RoundCornersTop = RoundCornersTopLeft | RoundCornersTopRight;
public static final int RoundCornersBottom = RoundCornersBottomLeft | RoundCornersBottomRight;
public static final int RoundCornersLeft = RoundCornersBottomLeft | RoundCornersTopLeft;
public static final int RoundCornersRight = RoundCornersBottomRight | RoundCornersTopRight;
public static final int RoundCornersAll = RoundCornersTopLeft | RoundCornersTopRight | RoundCornersBottomLeft | RoundCornersBottomRight;
/**
* Default to ALL corners if none of the _RoundCornersXX flags are specified.
*/
public static final int RoundCornersDefault = RoundCornersAll;
public static final int RoundCornersMask = RoundCornersAll | RoundCornersNone;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImDrawFlags_")
public Void __;
}
@@ -1,28 +1,17 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImDrawList. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly.
* It is however possible to temporarily alter flags between calls to ImDrawList:: functions.
*/
@BindingSource
public final class ImDrawListFlags {
private ImDrawListFlags() {
}
public static final int None = 0;
/**
* Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles)
*/
public static final int AntiAliasedLines = 1;
/**
* Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering.
*/
public static final int AntiAliasedLinesUseTex = 1 << 1;
/**
* Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
*/
public static final int AntiAliasedFill = 1 << 2;
/**
* Can emit 'VtxOffset {@code >} 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
*/
public static final int AllowVtxOffset = 1 << 3;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImDrawListFlags_")
public Void __;
}
@@ -1,24 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImFontAtlas build
*/
@BindingSource
public final class ImFontAtlasFlags {
private ImFontAtlasFlags() {
}
public static final int None = 0;
/**
* Don't round the height to next power of two
*/
public static final int NoPowerOfTwoHeight = 1;
/**
* Don't build software mouse cursors into the atlas
*/
public static final int NoMouseCursors = 1 << 1;
/**
* Don't build thick line textures into the atlas (save a little texture memory).
* The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
*/
public static final int NoBakedLines = 1 << 2;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImFontAtlasFlags_")
public Void __;
}
@@ -1,44 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend.
*/
@BindingSource
public final class ImGuiBackendFlags {
private ImGuiBackendFlags() {
}
public static final int None = 0;
/**
* Backend Platform supports gamepad and currently has one connected.
*/
public static final int HasGamepad = 1;
/**
* Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape.
*/
public static final int HasMouseCursors = 1 << 1;
/**
* Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).
*/
public static final int HasSetMousePos = 1 << 2;
/**
* Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices.
*/
public static final int RendererHasVtxOffset = 1 << 3;
// [BETA] Viewports
/**
* Backend Platform supports multiple viewports.
*/
public static final int PlatformHasViewports = 1 << 10;
/**
* Backend Platform supports setting io.MouseHoveredViewport to the viewport directly under the mouse _IGNORING_ viewports
* with the ImGuiViewportFlags_NoInputs flag and _REGARDLESS_ of whether another viewport is focused and may be capturing the mouse.
* This information is _NOT EASY_ to provide correctly with most high-level engines! Don't set this without studying how the examples/ backend handle it!
*/
public static final int HasMouseHoveredViewport = 1 << 11;
/**
* Backend Renderer supports multiple viewports.
*/
public static final int RendererHasViewports = 1 << 12;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiBackendFlags_")
public Void __;
}
@@ -1,20 +1,13 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiButtonFlags {
private ImGuiButtonFlags() {
}
public static final int None = 0;
/**
* React on left mouse button (default).
*/
public static final int MouseButtonLeft = 0;
/**
* React on right mouse button.
*/
public static final int MouseButtonRight = 1 << 1;
/**
* React on center mouse button.
*/
public static final int MouseButtonMiddle = 1 << 2;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiButtonFlags_")
public Void __;
}
@@ -1,114 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Enumeration for PushStyleColor() / PopStyleColor()
*/
@BindingSource
public final class ImGuiCol {
private ImGuiCol() {
}
public static final int Text = 0;
public static final int TextDisabled = 1;
/**
* Background of normal windows
*/
public static final int WindowBg = 2;
/**
* Background of child windows
*/
public static final int ChildBg = 3;
/**
* Background of popups, menus, tooltips windows
*/
public static final int PopupBg = 4;
public static final int Border = 5;
public static final int BorderShadow = 6;
/**
* Background of checkbox, radio button, plot, slider, text input
*/
public static final int FrameBg = 7;
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;
/**
* Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem
*/
public static final int Header = 24;
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;
/**
* Preview overlay color when about to docking something
*/
public static final int DockingPreview = 38;
/**
* Background color for empty node (e.g. CentralNode with no window docked into it)
*/
public static final int DockingEmptyBg = 39;
public static final int PlotLines = 40;
public static final int PlotLinesHovered = 41;
public static final int PlotHistogram = 42;
public static final int PlotHistogramHovered = 43;
/**
* Table header background
*/
public static final int TableHeaderBg = 44;
/**
* Table outer and header borders (prefer using Alpha=1.0 here)
*/
public static final int TableBorderStrong = 45;
/**
* Table inner borders (prefer using Alpha=1.0 here)
*/
public static final int TableBorderLight = 46;
/**
* Table row background (even rows)
*/
public static final int TableRowBg = 47;
/**
* Table row background (odd rows)
*/
public static final int TableRowBgAlt = 48;
public static final int TextSelectedBg = 49;
public static final int DragDropTarget = 50;
/**
* Gamepad/keyboard: current highlighted item
*/
public static final int NavHighlight = 51;
/**
* Highlight window when using CTRL+TAB
*/
public static final int NavWindowingHighlight = 52;
/**
* Darken/colorize entire screen behind the CTRL+TAB window list, when active
*/
public static final int NavWindowingDimBg = 53;
/**
* Darken/colorize entire screen behind a modal window, when one is active
*/
public static final int ModalWindowDimBg = 54;
public static final int COUNT = 55;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiCol_")
public Void __;
}
@@ -1,126 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
*/
@BindingSource
public final class ImGuiColorEditFlags {
private ImGuiColorEditFlags() {
}
public static final int None = 0;
/**
* ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).
*/
public static final int NoAlpha = 1 << 1;
/**
* ColorEdit: disable picker when clicking on colored square.
*/
public static final int NoPicker = 1 << 2;
/**
* ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.
*/
public static final int NoOptions = 1 << 3;
/**
* ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs)
*/
public static final int NoSmallPreview = 1 << 4;
/**
* ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square).
*/
public static final int NoInputs = 1 << 5;
/**
* ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.
*/
public static final int NoTooltip = 1 << 6;
/**
* ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).
*/
public static final int NoLabel = 1 << 7;
/**
* ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead.
*/
public static final int NoSidePreview = 1 << 8;
/**
* ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.
*/
public static final int NoDragDrop = 1 << 9;
/**
* ColorButton: disable border (which is enforced by default)
*/
public static final int NoBorder = 1 << 10;
// User Options (right-click on widget to change some of them).
/**
* ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.
*/
public static final int AlphaBar = 1 << 16;
/**
* ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.
*/
public static final int AlphaPreview = 1 << 17;
/**
* ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.
*/
public static final int AlphaPreviewHalf = 1 << 18;
/**
* (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 HDR = 1 << 19;
/**
* [Display]
* <p>
* ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex.
*/
public static final int DisplayRGB = 1 << 20;
/**
* [Display]
*/
public static final int DisplayHSV = 1 << 21;
/**
* [Display]
*/
public static final int DisplayHex = 1 << 22;
/**
* [DataType]
* <p>
* ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255.
*/
public static final int Uint8 = 1 << 23;
/**
* [DataType]
* <p>
* 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 Float = 1 << 24;
/**
* [Picker]
* <p>
* ColorPicker: bar for Hue, rectangle for Sat/Value.
*/
public static final int PickerHueBar = 1 << 25;
/**
* [Picker]
* <p>
* ColorPicker: wheel for Hue, triangle for Sat/Value.
*/
public static final int PickerHueWheel = 1 << 26;
/**
* [Input]
* <p>
* ColorEdit, ColorPicker: input and output data in RGB format.
*/
public static final int InputRGB = 1 << 27;
/**
* [Input]
* <p>
* ColorEdit, ColorPicker: input and output data in HSV format.
*/
public static final int InputHSV = 1 << 28;
/**
* 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;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiColorEditFlags_")
public Void __;
}
@@ -1,40 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::BeginCombo()
*/
@BindingSource
public final class ImGuiComboFlags {
private ImGuiComboFlags() {
}
public static final int None = 0;
/**
* Align the popup toward the left by default
*/
public static final int PopupAlignLeft = 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 HeightSmall = 1 << 1;
/**
* Max ~8 items visible (default)
*/
public static final int HeightRegular = 1 << 2;
/**
* Max ~20 items visible
*/
public static final int HeightLarge = 1 << 3;
/**
* As many fitting items as possible
*/
public static final int HeightLargest = 1 << 4;
/**
* Display on the preview box without the square arrow button
*/
public static final int NoArrowButton = 1 << 5;
/**
* Display only a square arrow button
*/
public static final int NoPreview = 1 << 6;
public static final int HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiComboFlags_")
public Void __;
}
@@ -1,32 +1,18 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Enumeration 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.
*/
@BindingSource
public final class ImGuiCond {
private ImGuiCond() {
}
/**
* No condition (always set the variable), same as Always.
*/
public static final int None = 0;
/**
* No condition (always set the variable)
*/
public static final int Always = 1;
/**
* Set the variable once per runtime session (only the first call will succeed)
*/
public static final int Once = 1 << 1;
/**
* Set the variable if the object/window has no persistently saved data (no entry in .ini file)
*/
public static final int FirstUseEver = 1 << 2;
/**
* Set the variable if the object/window is appearing after being hidden/inactive (or the first time)
*/
public static final int Appearing = 1 << 3;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiCond_")
public Void __;
}
@@ -1,74 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Configuration flags stored in io.ConfigFlags. Set by user/application.
*/
@BindingSource
public final class ImGuiConfigFlags {
private ImGuiConfigFlags() {
}
public static final int None = 0;
/**
* Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[].
*/
public static final int NavEnableKeyboard = 1;
/**
* Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad.
*/
public static final int NavEnableGamepad = 1 << 1;
/**
* 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 NavEnableSetMousePos = 1 << 2;
/**
* Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set.
*/
public static final int NavNoCaptureKeyboard = 1 << 3;
/**
* Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend.
*/
public static final int NoMouse = 1 << 4;
/**
* Instruct backend to not alter mouse cursor shape and visibility.
* Use if the backend 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 static final int NoMouseCursorChange = 1 << 5;
/**
* [BETA] Docking
* Docking enable flags.
*/
public static final int DockingEnable = 1 << 6;
// [BETA] Viewports
// When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable.
/**
* Viewport enable flags (require both ImGuiBackendFlags_PlatformHasViewports + ImGuiBackendFlags_RendererHasViewports set by the respective backends)
*/
public static final int ViewportsEnable = 1 << 10;
/**
* [BETA: Don't use] FIXME-DPI: Reposition and resize imgui windows when the DpiScale of a viewport changed (mostly useful for the main viewport hosting other window).
* Note that resizing the main window itself is up to your application.
*/
public static final int DpiEnableScaleViewports = 1 << 14;
/**
* [BETA: Don't use] FIXME-DPI: Request bitmap-scaled fonts to match DpiScale. This is a very low-quality workaround.
* The correct way to handle DPI is _currently_ to replace the atlas and/or fonts in the Platform_OnChangedViewport callback, but this is all early work in progress.
*/
public static final int DpiEnableScaleFonts = 1 << 15;
// User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core Dear ImGui)
/**
* Application is SRGB-aware.
*/
public static final int IsSRGB = 1 << 20;
/**
* Application is using a touch screen instead of a mouse.
*/
public static final int IsTouchScreen = 1 << 21;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiConfigFlags_")
public Void __;
}
@@ -1,51 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* A primary data type
*/
@BindingSource
public final class ImGuiDataType {
private ImGuiDataType() {
}
/**
* signed char / char (with sensible compilers)
*/
public static final int S8 = 0;
/**
* unsigned char
*/
public static final int U8 = 1;
/**
* short
*/
public static final int S16 = 2;
/**
* unsigned short
*/
public static final int U16 = 3;
/**
* int
*/
public static final int S32 = 4;
/**
* unsigned int
*/
public static final int U32 = 5;
/**
* long long / __int64
*/
public static final int S64 = 6;
/**
* unsigned long long / unsigned __int64
*/
public static final int U64 = 7;
/**
* float
*/
public static final int Float = 8;
/**
* double
*/
public static final int Double = 9;
public static final int COUNT = 10;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiDataType_")
public Void __;
}
@@ -1,16 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* A cardinal direction
*/
@BindingSource
public final class ImGuiDir {
private ImGuiDir() {
}
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;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiDir_")
public Void __;
}
@@ -1,42 +1,17 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::DockSpace(), shared/inherited by child nodes.
* (Some flags can be applied to individual nodes directly)
*/
@SuppressWarnings("HideUtilityClassConstructor")
public class ImGuiDockNodeFlags {
public static final int None = 0;
/**
* Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked.
*/
public static final int KeepAliveOnly = 1;
/**
* Disable Central Node (the node which can stay empty)
*/
public static final int NoCentralNode = 1 << 1;
/**
* Disable docking inside the Central Node, which will be always kept empty.
*/
public static final int NoDockingInCentralNode = 1 << 2;
/**
* Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central
* Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2)
* When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details.
*/
public static final int PassthruCentralNode = 1 << 3;
/**
* Disable splitting the node into smaller nodes.
* Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion).
* Note: when turned off, existing splits will be preserved.
*/
public static final int NoSplit = 1 << 4;
/**
* Disable resizing node using the splitter/separators. Useful with programatically setup dockspaces.
*/
public static final int NoResize = 1 << 5;
/**
* Tab bar will automatically hide when there is a single window in the dock node.
*/
public static final int AutoHideTabBar = 1 << 6;
@BindingSource
public final class ImGuiDockNodeFlags {
private ImGuiDockNodeFlags() {
}
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiDockNodeFlags_")
public Void __;
}
@@ -1,61 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()
*/
@BindingSource
public final class ImGuiDragDropFlags {
private ImGuiDragDropFlags() {
}
public static final int None = 0;
// BeginDragDropSource() flags
/**
* 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 SourceNoPreviewTooltip = 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 SourceNoDisableHover = 1 << 1;
/**
* 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 SourceNoHoldToOpenOthers = 1 << 2;
/**
* 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 SourceAllowNullID = 1 << 3;
/**
* 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 SourceExtern = 1 << 4;
/**
* Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged)
*/
public static final int SourceAutoExpirePayload = 1 << 5;
// AcceptDragDropPayload() flags
/**
* 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 AcceptBeforeDelivery = 1 << 10;
/**
* Do not draw the default highlight rectangle when hovering over target.
*/
public static final int AcceptNoDrawDefaultRect = 1 << 11;
/**
* Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site.
*/
public static final int AcceptNoPreviewTooltip = 1 << 12;
/**
* For peeking ahead and inspecting the payload before delivery.
*/
public static final int AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiDragDropFlags_")
public Void __;
}
@@ -1,39 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::IsWindowFocused()
*/
@BindingSource
public final class ImGuiFocusedFlags {
private ImGuiFocusedFlags() {
}
public static final int None = 0;
/**
* Return true if any children of the window is focused
*/
public static final int ChildWindows = 1;
/**
* Test from root window (top most parent of the current hierarchy)
*/
public static final int RootWindow = 1 << 1;
/**
* 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 'io.WantCaptureMouse' instead! Please read the FAQ!
*/
public static final int AnyWindow = 1 << 2;
/**
* Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
*/
public static final int NoPopupHierarchy = 1 << 3;
/**
* Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
*/
public static final int DockHierarchy = 1 << 4;
public static final int RootAndChildWindows = RootWindow | ChildWindows;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiFocusedFlags_")
public Void __;
}
@@ -1,45 +1,13 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImGuiFreeTypeBuilderFlags {
private ImGuiFreeTypeBuilderFlags() {
}
/**
* Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
*/
public static final int NoHinting = 1;
/**
* Disable auto-hinter.
*/
public static final int NoAutoHint = 1 << 1;
/**
* Indicates that the auto-hinter is preferred over the font's native hinter.
*/
public static final int ForceAutoHint = 1 << 2;
/**
* A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape.
* This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer.
* This preserves inter-glyph spacing in horizontal text.
*/
public static final int LightHinting = 1 << 3;
/**
* Strong hinting algorithm that should only be used for monochrome output.
*/
public static final int MonoHinting = 1 << 4;
/**
* Styling: Should we artificially embolden the font?
*/
public static final int Bold = 1 << 5;
/**
* Styling: Should we slant the font, emulating italic style?
*/
public static final int Oblique = 1 << 6;
/**
* Disable anti-aliasing. Combine this with MonoHinting for best results!
*/
public static final int Monochrome = 1 << 7;
/**
* Enable FreeType color-layered glyphs1
*/
public static final int LoadColor = 1 << 8;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiFreeTypeBuilderFlags_")
public Void __;
}
@@ -1,67 +1,18 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
* Note:if you are trying to check whether your mouse should be dispatched to Dear ImGui or to your app,
* you should use'io.WantCaptureMouse'instead!Please read the FAQ!Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls.
*/
@BindingSource
public final class ImGuiHoveredFlags {
private ImGuiHoveredFlags() {
}
/**
* 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 None = 0;
/**
* IsWindowHovered() only: Return true if any children of the window is hovered
*/
public static final int ChildWindows = 1;
/**
* IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
*/
public static final int RootWindow = 1 << 1;
/**
* IsWindowHovered() only: Return true if any window is hovered
*/
public static final int AnyWindow = 1 << 2;
/**
* IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
*/
public static final int NoPopupHierarchy = 1 << 3;
/**
* IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
*/
public static final int DockHierarchy = 1 << 4;
/**
* Return true even if a popup window is normally blocking access to this item/window
*/
public static final int AllowWhenBlockedByPopup = 1 << 5;
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, //Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
/**
* Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
*/
public static final int AllowWhenBlockedByActiveItem = 1 << 7;
/**
* Return true even if the position is obstructed or overlapped by another window
*/
public static final int AllowWhenOverlapped = 1 << 8;
/**
* Return true even if the item is disabled
*/
public static final int AllowWhenDisabled = 1 << 9;
public static final int RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped;
public static final int RootAndChildWindows = RootWindow | ChildWindows;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiHoveredFlags_")
public Void __;
}
@@ -1,93 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Flags for ImGui::InputText()
*/
@BindingSource
public final class ImGuiInputTextFlags {
private ImGuiInputTextFlags() {
}
public static final int None = 0;
/**
* Allow 0123456789.+-* /
*/
public static final int CharsDecimal = 1;
/**
* Allow 0123456789ABCDEFabcdef
*/
public static final int CharsHexadecimal = 1 << 1;
/**
* Turn a..z into A..Z
*/
public static final int CharsUppercase = 1 << 2;
/**
* Filter out spaces, tabs
*/
public static final int CharsNoBlank = 1 << 3;
/**
* Select entire text when first taking mouse focus
*/
public static final int AutoSelectAll = 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 final int EnterReturnsTrue = 1 << 5;
/**
* Callback on pressing TAB (for completion handling)
*/
public static final int CallbackCompletion = 1 << 6;
/**
* Callback on pressing Up/Down arrows (for history handling)
*/
public static final int CallbackHistory = 1 << 7;
/**
* Callback on each iteration. User code may query cursor position, modify text buffer.
*/
public static final int CallbackAlways = 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 final int CallbackCharFilter = 1 << 9;
/**
* Pressing TAB input a '\t' character into the text field
*/
public static final int AllowTabInput = 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 final int CtrlEnterForNewLine = 1 << 11;
/**
* Disable following the cursor horizontally
*/
public static final int NoHorizontalScroll = 1 << 12;
/**
* Overwrite mode
*/
public static final int AlwaysOverwrite = 1 << 13;
/**
* Read-only mode
*/
public static final int ReadOnly = 1 << 14;
/**
* Password mode, display all characters as '*'
*/
public static final int Password = 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 final int NoUndoRedo = 1 << 16;
/**
* Allow 0123456789.+-* /eE (Scientific notation input)
*/
public static final int CharsScientific = 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 final int CallbackResize = 1 << 18;
/**
* Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active).
*/
public static final int CallbackEdit = 1 << 19;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiInputTextFlags_")
public Void __;
}
@@ -1,51 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
*/
@BindingSource
public final class ImGuiKey {
private ImGuiKey() {
}
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;
/**
* for text edit CTRL+A: select all
*/
public static final int A = 16;
/**
* for text edit CTRL+C: copy
*/
public static final int C = 17;
/**
* for text edit CTRL+V: paste
*/
public static final int V = 18;
/**
* for text edit CTRL+X: cut
*/
public static final int X = 19;
/**
* for text edit CTRL+Y: redo
*/
public static final int Y = 20;
/**
* for text edit CTRL+Z: undo
*/
public static final int Z = 21;
public static final int COUNT = 22;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiKey_")
public Void __;
}
@@ -1,15 +1,16 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, io.KeyShift, io.KeyAlt set by user/backend)
*/
@BindingSource
public final class ImGuiKeyModFlags {
private ImGuiKeyModFlags() {
}
public static final int None = 0;
public static final int Ctrl = 1;
public static final int Shift = 1 << 1;
public static final int Alt = 1 << 2;
public static final int Super = 1 << 3;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiKeyModFlags_")
public Void __;
}
@@ -1,15 +1,17 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Identify a mouse button.
* Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience.
*/
@BindingSource
public final class ImGuiMouseButton {
private ImGuiMouseButton() {
}
public static final int Left = 0;
public static final int Right = 1;
public static final int Middle = 2;
public static final int COUNT = 5;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiMouseButton_")
public Void __;
}
@@ -1,46 +1,17 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* 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
*/
@BindingSource
public final class ImGuiMouseCursor {
private ImGuiMouseCursor() {
}
public static final int None = -1;
public static final int Arrow = 0;
/**
* When hovering over InputText, etc.
*/
public static final int TextInput = 1;
/**
* (Unused by Dear ImGui functions)
*/
public static final int ResizeAll = 2;
/**
* When hovering over an horizontal border
*/
public static final int ResizeNS = 3;
/**
* When hovering over a vertical border or a column
*/
public static final int ResizeEW = 4;
/**
* When hovering over the bottom-left corner of a window
*/
public static final int ResizeNESW = 5;
/**
* When hovering over the bottom-right corner of a window
*/
public static final int ResizeNWSE = 6;
/**
* (Unused by Dear ImGui functions. Use for e.g. hyperlinks)
*/
public static final int Hand = 7;
/**
* When hovering something with disallowed interaction. Usually a crossed circle.
*/
public static final int NotAllowed = 8;
public static final int COUNT = 9;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiMouseCursor_")
public Void __;
}
@@ -1,5 +1,8 @@
package imgui.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
/**
* Gamepad/Keyboard directional navigation
* Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable.
@@ -9,90 +12,11 @@ package imgui.flag;
* Note that io.NavInputs[] is cleared by EndFrame().
* Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets.
*/
@BindingSource
public final class ImGuiNavInput {
private ImGuiNavInput() {
}
/**
* activate / open / toggle / tweak value
* e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard)
*/
public static final int Activate = 0;
/**
* cancel / close / exit
* e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard)
*/
public static final int Cancel = 1;
/**
* text input / on-screen keyboard
* e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard)
*/
public static final int Input = 2;
/**
* tap: toggle menu / hold: focus, move, resize
* e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard)
*/
public static final int Menu = 3;
/**
* move / tweak / resize window (w/ PadMenu)
* e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard)
*/
public static final int DpadLeft = 4;
public static final int DpadRight = 5;
public static final int DpadUp = 6;
public static final int DpadDown = 7;
/**
* scroll / move window (w/ PadMenu)
* e.g. Left Analog Stick Left/Right/Up/Down
*/
public static final int LStickLeft = 8;
public static final int LStickRight = 9;
public static final int LStickUp = 10;
public static final int LStickDown = 11;
/**
* next window (w/ PadMenu)
* e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
*/
public static final int FocusPrev = 12;
/**
* prev window (w/ PadMenu)
* e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
*/
public static final int FocusNext = 13;
/**
* slower tweaks
* e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch)
*/
public static final int TweakSlow = 14;
/**
* faster tweaks
* e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch)
*/
public static final int TweakFast = 15;
// [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them.
// Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[].
/**
* Toggle menu.
*/
public static final int KeyMenu = 16;
/**
* Move left.
*/
public static final int KeyLeft = 17;
/**
* Move right.
*/
public static final int KeyRight = 18;
/**
* Move up.
*/
public static final int KeyUp = 19;
/**
* Move down.
*/
public static final int KeyDown = 20;
public static final int COUNT = 21;
@BindingAstEnum(file = "ast-imgui.json", qualType = "ImGuiNavInput_")
public Void __;
}
Loaded 100 of 323 files, more files were not shown because too many files have changed in this diff. Show more