Add ImPlatformIO, ImGuiViewport

This commit is contained in:
SpaiR committed 2020-08-29 15:33:15 +03:00
1 parent dce574ef76
commit 8494bd8361
14 files changed
+773 -5

No files matched your search

@@ -5,6 +5,14 @@ jmethodID jImListClipperCallbackAcceptMID;
jmethodID jImStrConsumerAcceptMID;
jmethodID jImStrSupplierGetMID;
jmethodID jImPlatformFuncViewportAcceptMID;
jmethodID jImPlatformFuncViewportFloatAcceptMID;
jmethodID jImPlatformFuncViewportImVec2AcceptMID;
jmethodID jImPlatformFuncViewportStringAcceptMID;
jmethodID jImPlatformFuncViewportSuppImVec2GetMID;
jmethodID jImPlatformFuncViewportSuppBooleanGetMID;
jmethodID jImPlatformFuncViewportSuppFloatGetMID;
namespace Jni
{
void InitCallbacks(JNIEnv* env) {
@@ -16,6 +24,27 @@ namespace Jni
jclass jImStrSupplier = env->FindClass("imgui/callback/ImStrSupplier");
jImStrSupplierGetMID = env->GetMethodID(jImStrSupplier, "get", "()Ljava/lang/String;");
jclass jImPlatformFuncViewport = env->FindClass("imgui/callback/ImPlatformFuncViewport");
jImPlatformFuncViewportAcceptMID = env->GetMethodID(jImPlatformFuncViewport, "accept", "(Limgui/ImGuiViewport;)V");
jclass jImPlatformFuncViewportFloat = env->FindClass("imgui/callback/ImPlatformFuncViewportFloat");
jImPlatformFuncViewportFloatAcceptMID = env->GetMethodID(jImPlatformFuncViewportFloat, "accept", "(Limgui/ImGuiViewport;F)V");
jclass jImPlatformFuncViewportImVec2 = env->FindClass("imgui/callback/ImPlatformFuncViewportImVec2");
jImPlatformFuncViewportImVec2AcceptMID = env->GetMethodID(jImPlatformFuncViewportImVec2, "accept", "(Limgui/ImGuiViewport;Limgui/ImVec2;)V");
jclass jImPlatformFuncViewportString = env->FindClass("imgui/callback/ImPlatformFuncViewportString");
jImPlatformFuncViewportStringAcceptMID = env->GetMethodID(jImPlatformFuncViewportString, "accept", "(Limgui/ImGuiViewport;Ljava/lang/String;)V");
jclass jImPlatformFuncViewportSuppImVec2 = env->FindClass("imgui/callback/ImPlatformFuncViewportSuppImVec2");
jImPlatformFuncViewportSuppImVec2GetMID = env->GetMethodID(jImPlatformFuncViewportSuppImVec2, "get", "(Limgui/ImGuiViewport;Limgui/ImVec2;)V");
jclass jImPlatformFuncViewportSuppBoolean = env->FindClass("imgui/callback/ImPlatformFuncViewportSuppBoolean");
jImPlatformFuncViewportSuppBooleanGetMID = env->GetMethodID(jImPlatformFuncViewportSuppBoolean, "get", "(Limgui/ImGuiViewport;)Z");
jclass jImPlatformFuncViewportSuppFloat = env->FindClass("imgui/callback/ImPlatformFuncViewportSuppFloat");
jImPlatformFuncViewportSuppFloatGetMID = env->GetMethodID(jImPlatformFuncViewportSuppFloat, "get", "(Limgui/ImGuiViewport;)F");
}
void CallImListClipperCallback(JNIEnv* env, jobject consumer, int index) {
@@ -29,4 +58,32 @@ namespace Jni
jstring CallImStrSupplier(JNIEnv* env, jobject supplier) {
return (jstring)env->CallObjectMethod(supplier, jImStrSupplierGetMID);
}
void CallImPlatformFuncViewport(JNIEnv* env, jobject func, jobject vp) {
env->CallVoidMethod(func, jImPlatformFuncViewportAcceptMID, vp);
}
void CallImPlatformFuncViewportFloat(JNIEnv* env, jobject func, jobject vp, float f) {
env->CallVoidMethod(func, jImPlatformFuncViewportFloatAcceptMID, vp, f);
}
void CallImPlatformFuncViewportImVec2(JNIEnv* env, jobject func, jobject vp, jobject imVec2) {
env->CallVoidMethod(func, jImPlatformFuncViewportImVec2AcceptMID, vp, imVec2);
}
void CallImPlatformFuncViewportString(JNIEnv* env, jobject func, jobject vp, const char* str) {
env->CallVoidMethod(func, jImPlatformFuncViewportStringAcceptMID, env->NewStringUTF(str));
}
void CallImPlatformFuncViewportSuppImVec2(JNIEnv* env, jobject func, jobject vp, jobject imVec2) {
env->CallVoidMethod(func, jImPlatformFuncViewportSuppImVec2GetMID, vp, imVec2);
}
jboolean CallImPlatformFuncViewportSuppBoolean(JNIEnv* env, jobject func, jobject vp) {
return (jboolean)env->CallBooleanMethod(func, jImPlatformFuncViewportSuppBooleanGetMID, vp);
}
jfloat CallImPlatformFuncViewportSuppFloat(JNIEnv* env, jobject func, jobject vp) {
return (jfloat)env->CallFloatMethod(func, jImPlatformFuncViewportSuppFloatGetMID, vp);
}
}