save code
This commit is contained in:
@@ -29,12 +29,16 @@ void handle_cmd(android_app *pApp, int32_t cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
const int ArgLen = 128*1024;
|
||||
char g_InitArgString[ArgLen] = {0};
|
||||
|
||||
void android_main(struct android_app *pApp) {
|
||||
aout << "Welcome to android_main" << std::endl;
|
||||
g_android_app = pApp;
|
||||
g_assetManager = pApp->activity->assetManager;
|
||||
FaceApp application;
|
||||
g_Application = &application;
|
||||
application.SetInitArg(g_InitArgString);
|
||||
pApp->onAppCmd = handle_cmd;
|
||||
|
||||
android_app_set_motion_event_filter(pApp, nullptr);
|
||||
@@ -119,4 +123,18 @@ Java_com_hmwl_face_1sdk_FaceActivity_passDataToNative(JNIEnv *env, jobject thiz,
|
||||
|
||||
// 或者直接将指针传递给Vulkan
|
||||
ReceiveFacePoint(pos, point_count, width, height);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_hmwl_face_1sdk_FaceActivity_SetCppInitArg(JNIEnv *env, jobject thiz, jstring json) {
|
||||
// TODO: implement SetCppInitArg()
|
||||
const char *nativeString = env->GetStringUTFChars(json, nullptr);
|
||||
jsize len = env->GetStringUTFLength(json);
|
||||
if(len > ArgLen)
|
||||
{
|
||||
aout << "ArgLen to long:" << len << std::endl;
|
||||
return;
|
||||
}
|
||||
memcpy(g_InitArgString, nativeString, len);
|
||||
}
|
||||
Reference in New Issue
Block a user