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

@@ -0,0 +1,17 @@
package imgui.callback;
import imgui.ImGuiInputTextCallbackData;
import java.util.function.Consumer;
/**
* Callback to use in {@link imgui.ImGui#inputText(String, imgui.type.ImString, int, ImGuiInputTextCallback)}.
*/
public abstract class ImGuiInputTextCallback implements Consumer<ImGuiInputTextCallbackData> {
/**
* This function will be called by the native Callback and wrapped.
*/
public final void accept(final long ptr) {
accept(new ImGuiInputTextCallbackData(ptr));
}
}
@@ -0,0 +1,8 @@
package imgui.callback;
/**
* Callback for {@link imgui.ImGuiListClipper} class.
*/
public abstract class ImListClipperCallback {
public abstract void accept(int index);
}
@@ -0,0 +1,10 @@
package imgui.callback;
import imgui.ImGuiViewport;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*)
*/
public abstract class ImPlatformFuncViewport {
public abstract void accept(ImGuiViewport vp);
}
@@ -0,0 +1,10 @@
package imgui.callback;
import imgui.ImGuiViewport;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*, String)
*/
public abstract class ImPlatformFuncViewportFloat {
public abstract void accept(ImGuiViewport vp, float f);
}
@@ -0,0 +1,11 @@
package imgui.callback;
import imgui.ImGuiViewport;
import imgui.ImVec2;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*, ImVec2)
*/
public abstract class ImPlatformFuncViewportImVec2 {
public abstract void accept(ImGuiViewport vp, ImVec2 imVec2);
}
@@ -0,0 +1,10 @@
package imgui.callback;
import imgui.ImGuiViewport;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*, String)
*/
public abstract class ImPlatformFuncViewportString {
public abstract void accept(ImGuiViewport vp, String str);
}
@@ -0,0 +1,10 @@
package imgui.callback;
import imgui.ImGuiViewport;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*) - Boolean
*/
public abstract class ImPlatformFuncViewportSuppBoolean {
public abstract boolean get(ImGuiViewport vp);
}
@@ -0,0 +1,10 @@
package imgui.callback;
import imgui.ImGuiViewport;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*) - Boolean
*/
public abstract class ImPlatformFuncViewportSuppFloat {
public abstract float get(ImGuiViewport vp);
}
@@ -0,0 +1,11 @@
package imgui.callback;
import imgui.ImGuiViewport;
import imgui.ImVec2;
/**
* Callback to represent ImGuiPlatformIO function with args: (ImGuiViewport*) - ImVec2
*/
public abstract class ImPlatformFuncViewportSuppImVec2 {
public abstract void get(ImGuiViewport vp, ImVec2 dstImVec2);
}
@@ -0,0 +1,8 @@
package imgui.callback;
/**
* Callback to supply Java string form native code.
*/
public abstract class ImStrConsumer {
public abstract void accept(String str);
}
@@ -0,0 +1,8 @@
package imgui.callback;
/**
* Callback to get Java string from native code.
*/
public abstract class ImStrSupplier {
public abstract String get();
}