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:
1 parent
e64df5a433
commit
8a8cd22ed6
323 files changed
+113518
-15318
No files matched your search
@@ -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;
|
||||
*/
|
||||
}
|
||||
Reference in new issue
Block a user