Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change pointers casting type #265

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified buildSrc/scripts/publish.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/tool/generator/api/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const val A_TYPE_VALUE_ACCESSOR_SETTER = "SETTER"
const val A_TYPE_VALUE_ACCESSOR_GETTER = "GETTER"

const val PTR_JVM_FIELD = "ptr"
const val PTR_JNI_CAST = "intptr_t"
const val PTR_JNI_CAST = "uintptr_t"
const val PTR_JNI_THIS = "THIS"

const val PARAM_ARR_LEN_POSTFIX = "Count"
Expand Down
4 changes: 2 additions & 2 deletions imgui-binding/src/generated/java/imgui/ImDrawData.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ImVec4 getCmdListCmdBufferClipRect(final int cmdListIdx, final int cmdBuf
* Ignore if never using images or multiple fonts atlas.
*/
public native int getCmdListCmdBufferTextureId(int cmdListIdx, int cmdBufferIdx); /*
return (intptr_t)THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
return (uintptr_t)THIS->CmdLists[cmdListIdx]->CmdBuffer[cmdBufferIdx].GetTexID();
*/

/**
Expand Down Expand Up @@ -326,7 +326,7 @@ public ImGuiViewport getOwnerViewport() {
}

private native long nGetOwnerViewport(); /*
return (intptr_t)THIS->OwnerViewport;
return (uintptr_t)THIS->OwnerViewport;
*/

// Functions
Expand Down
102 changes: 51 additions & 51 deletions imgui-binding/src/generated/java/imgui/ImDrawList.java

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions imgui-binding/src/generated/java/imgui/ImFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImFont());
return (uintptr_t)(new ImFont());
*/

// TODO IndexAdvanceX
Expand Down Expand Up @@ -95,7 +95,7 @@ public void setFallbackGlyph(final ImFontGlyph value) {
}

private native long nGetFallbackGlyph(); /*
return (intptr_t)THIS->FallbackGlyph;
return (uintptr_t)THIS->FallbackGlyph;
*/

private native void nSetFallbackGlyph(long value); /*
Expand Down Expand Up @@ -277,15 +277,15 @@ public ImFontGlyph findGlyph(final int c) {
}

private native long nFindGlyph(int c); /*
return (intptr_t)THIS->FindGlyph((ImWchar)c);
return (uintptr_t)THIS->FindGlyph((ImWchar)c);
*/

public ImFontGlyph findGlyphNoFallback(final int c) {
return new ImFontGlyph(nFindGlyphNoFallback(c));
}

private native long nFindGlyphNoFallback(int c); /*
return (intptr_t)THIS->FindGlyphNoFallback((ImWchar)c);
return (uintptr_t)THIS->FindGlyphNoFallback((ImWchar)c);
*/

public float getCharAdvance(final int c) {
Expand Down
58 changes: 29 additions & 29 deletions imgui-binding/src/generated/java/imgui/ImFontAtlas.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions imgui-binding/src/generated/java/imgui/ImFontConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected long create() {
private native long nCreate(); /*
ImFontConfig* cfg = new ImFontConfig();
cfg->FontDataOwnedByAtlas = false;
return (intptr_t)cfg;
return (uintptr_t)cfg;
*/

/**
Expand Down Expand Up @@ -524,7 +524,7 @@ public void setDstFont(final ImFont value) {
}

private native long nGetDstFont(); /*
return (intptr_t)THIS->DstFont;
return (uintptr_t)THIS->DstFont;
*/

private native void nSetDstFont(long value); /*
Expand Down
2 changes: 1 addition & 1 deletion imgui-binding/src/generated/java/imgui/ImFontGlyph.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImFontGlyph());
return (uintptr_t)(new ImFontGlyph());
*/

/**
Expand Down
134 changes: 67 additions & 67 deletions imgui-binding/src/generated/java/imgui/ImGui.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions imgui-binding/src/generated/java/imgui/ImGuiIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public void setFonts(final ImFontAtlas value) {
}

private native long nGetFonts(); /*
return (intptr_t)THIS->Fonts;
return (uintptr_t)THIS->Fonts;
*/

private native void nSetFonts(long value); /*
Expand Down Expand Up @@ -455,7 +455,7 @@ public void setFontDefault(final ImFont value) {
}

private native long nGetFontDefault(); /*
return (intptr_t)THIS->FontDefault;
return (uintptr_t)THIS->FontDefault;
*/

private native void nSetFontDefault(long value); /*
Expand Down
2 changes: 1 addition & 1 deletion imgui-binding/src/generated/java/imgui/ImGuiKeyData.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImGuiKeyData());
return (uintptr_t)(new ImGuiKeyData());
*/

/**
Expand Down
22 changes: 11 additions & 11 deletions imgui-binding/src/generated/java/imgui/ImGuiPlatformIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static void init() {
void PlatformStub##name(ImGuiViewport* vp) {\
if (platformCallback##name != NULL) {\
JNIEnv* env = Jni::GetEnv();\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);\
Jni::CallImPlatformFuncViewport(env, platformCallback##name, jTmpViewport);\
}\
}\
Expand Down Expand Up @@ -155,7 +155,7 @@ static void init() {
void PlatformStub##name(ImGuiViewport* vp, ImVec2 pos) {\
if (platformCallback##name != NULL) {\
JNIEnv* env = Jni::GetEnv();\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);\
Jni::ImVec2Cpy(env, pos, jTmpImVec2);\
Jni::CallImPlatformFuncViewportImVec2(env, platformCallback##name, jTmpViewport, jTmpImVec2);\
}\
Expand Down Expand Up @@ -185,7 +185,7 @@ static void init() {
ImVec2 dst;\
if (platformCallback##name != NULL) {\
JNIEnv* env = Jni::GetEnv();\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);\
Jni::CallImPlatformFuncViewportSuppImVec2(env, platformCallback##name, jTmpViewport, jTmpImVec2);\
Jni::ImVec2Cpy(env, jTmpImVec2, &dst);\
}\
Expand Down Expand Up @@ -248,7 +248,7 @@ static void init() {
bool PlatformStub##name(ImGuiViewport* vp) {\
if (platformCallback##name != NULL) {\
JNIEnv* env = Jni::GetEnv();\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);\
return Jni::CallImPlatformFuncViewportSuppBoolean(env, platformCallback##name, jTmpViewport);\
}\
return false;\
Expand Down Expand Up @@ -287,7 +287,7 @@ static void init() {
void PlatformStubSetWindowTitle(ImGuiViewport* vp, const char* str) {
if (platformCallbackSetWindowTitle != NULL) {
JNIEnv* env = Jni::GetEnv();
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);
Jni::CallImPlatformFuncViewportString(env, platformCallbackSetWindowTitle, jTmpViewport, str);
}
}
Expand All @@ -309,7 +309,7 @@ void PlatformStubSetWindowTitle(ImGuiViewport* vp, const char* str) {
void PlatformStubSetWindowAlpha(ImGuiViewport* vp, float alpha) {
if (platformCallbackSetWindowAlpha != NULL) {
JNIEnv* env = Jni::GetEnv();
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);
Jni::CallImPlatformFuncViewportFloat(env, platformCallbackSetWindowAlpha, jTmpViewport, alpha);
}
}
Expand Down Expand Up @@ -364,7 +364,7 @@ void PlatformStubSetWindowAlpha(ImGuiViewport* vp, float alpha) {
float PlatformStubGetWindowDpiScale(ImGuiViewport* vp) {
if (platformCallbackGetWindowDpiScale != NULL) {
JNIEnv* env = Jni::GetEnv();
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);
return Jni::CallImPlatformFuncViewportSuppFloat(env, platformCallbackGetWindowDpiScale, jTmpViewport);
}
return false;
Expand Down Expand Up @@ -401,7 +401,7 @@ float PlatformStubGetWindowDpiScale(ImGuiViewport* vp) {
void RendererStub##name(ImGuiViewport* vp) {\
if (rendererCallback##name != NULL) {\
JNIEnv* env = Jni::GetEnv();\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);\
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);\
Jni::CallImPlatformFuncViewport(env, rendererCallback##name, jTmpViewport);\
}\
}\
Expand Down Expand Up @@ -442,7 +442,7 @@ float PlatformStubGetWindowDpiScale(ImGuiViewport* vp) {
void RendererStubSetWindowSize(ImGuiViewport* vp, ImVec2 pos) {
if (rendererCallbackSetWindowSize != NULL) {
JNIEnv* env = Jni::GetEnv();
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (intptr_t)vp);
env->SetLongField(jTmpViewport, Jni::GetBindingStructPtrID(), (uintptr_t)vp);
Jni::ImVec2Cpy(env, pos, jTmpImVec2);
Jni::CallImPlatformFuncViewportImVec2(env, rendererCallbackSetWindowSize, jTmpViewport, jTmpImVec2);
}
Expand Down Expand Up @@ -519,7 +519,7 @@ public ImGuiPlatformMonitor getMonitors(final int idx) {
}

private native long nGetMonitors(int idx); /*
return (intptr_t)&IMGUI_PLATFORM_IO->Monitors[idx];
return (uintptr_t)&IMGUI_PLATFORM_IO->Monitors[idx];
*/

// Viewports list (the list is updated by calling ImGui::EndFrame or ImGui::Render)
Expand All @@ -535,6 +535,6 @@ public ImGuiViewport getViewports(final int idx) {
}

private native long nGetViewports(int idx); /*
return (intptr_t)IMGUI_PLATFORM_IO->Viewports[idx];
return (uintptr_t)IMGUI_PLATFORM_IO->Viewports[idx];
*/
}
2 changes: 1 addition & 1 deletion imgui-binding/src/generated/java/imgui/ImGuiStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImGuiStorage());
return (uintptr_t)(new ImGuiStorage());
*/

// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)
Expand Down
2 changes: 1 addition & 1 deletion imgui-binding/src/generated/java/imgui/ImGuiStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImGuiStyle());
return (uintptr_t)(new ImGuiStyle());
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ImGuiTableColumnSortSpecs[] getSpecs() {
int specsCount = THIS->SpecsCount;
jlong jBuf[specsCount];
for (int i = 0; i < specsCount; i++) {
jBuf[i] = (intptr_t)specs;
jBuf[i] = (uintptr_t)specs;
specs++;
}
jlongArray result = env->NewLongArray(specsCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected long create() {
*/

private native long nCreate(String defaultFilter); /*
return (intptr_t)(new ImGuiTextFilter(defaultFilter));
return (uintptr_t)(new ImGuiTextFilter(defaultFilter));
*/

public boolean draw() {
Expand Down
6 changes: 3 additions & 3 deletions imgui-binding/src/generated/java/imgui/ImGuiViewport.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public void setDrawData(final ImDrawData value) {
}

private native long nGetDrawData(); /*
return (intptr_t)THIS->DrawData;
return (uintptr_t)THIS->DrawData;
*/

private native void nSetDrawData(long value); /*
Expand Down Expand Up @@ -442,7 +442,7 @@ public void setDrawData(final ImDrawData value) {
* void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*)
*/
public native long getPlatformHandle(); /*
return (intptr_t)THIS->PlatformHandle;
return (uintptr_t)THIS->PlatformHandle;
*/

/**
Expand All @@ -456,7 +456,7 @@ public void setDrawData(final ImDrawData value) {
* 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)THIS->PlatformHandleRaw;
return (uintptr_t)THIS->PlatformHandleRaw;
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected long create() {
*/

private native long nCreate(); /*
return (intptr_t)(new ImGuiWindowClass());
return (uintptr_t)(new ImGuiWindowClass());
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,6 @@ public static long getUserDatas() {
}

private static native long nGetUserDatas(); /*
return (intptr_t)ImGuiFileDialog::Instance()->GetUserDatas();
return (uintptr_t)ImGuiFileDialog::Instance()->GetUserDatas();
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static ImNodesContext createContext() {
}

private static native long nCreateContext(); /*
return (intptr_t)ImNodes::CreateContext();
return (uintptr_t)ImNodes::CreateContext();
*/

public static void destroyContext() {
Expand All @@ -62,7 +62,7 @@ public static ImNodesContext getCurrentContext() {
}

private static native long nGetCurrentContext(); /*
return (intptr_t)ImNodes::GetCurrentContext();
return (uintptr_t)ImNodes::GetCurrentContext();
*/

public static void setCurrentContext(final ImNodesContext ctx) {
Expand All @@ -78,7 +78,7 @@ public static ImNodesEditorContext editorContextCreate() {
}

private static native long nEditorContextCreate(); /*
return (intptr_t)ImNodes::EditorContextCreate();
return (uintptr_t)ImNodes::EditorContextCreate();
*/

public static void editorContextFree(final ImNodesEditorContext context) {
Expand Down Expand Up @@ -156,7 +156,7 @@ public static ImNodesIO getIO() {
}

private static native long nGetIO(); /*
return (intptr_t)&ImNodes::GetIO();
return (uintptr_t)&ImNodes::GetIO();
*/

private static final ImNodesStyle _GETSTYLE_1 = new ImNodesStyle(0);
Expand All @@ -170,7 +170,7 @@ public static ImNodesStyle getStyle() {
}

private static native long nGetStyle(); /*
return (intptr_t)&ImNodes::GetStyle();
return (uintptr_t)&ImNodes::GetStyle();
*/

// Style presets matching the dear imgui styles of the same name.
Expand Down
Loading