36张图片打包
This commit is contained in:
@@ -12,7 +12,7 @@ using namespace std;
|
||||
extern "C" {
|
||||
|
||||
android_app* g_android_app = nullptr;
|
||||
Application* g_Application = nullptr;
|
||||
FaceApp* g_Application = nullptr;
|
||||
AAssetManager* g_assetManager = nullptr;
|
||||
|
||||
void handle_cmd(android_app *pApp, int32_t cmd) {
|
||||
@@ -143,4 +143,20 @@ Java_com_hmwl_face_1sdk_FaceActivity_SetCppInitArg(JNIEnv *env, jobject thiz, js
|
||||
return;
|
||||
}
|
||||
memcpy(g_InitArgString, nativeString, len);
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_hmwl_face_1sdk_FaceActivity_ChangeStateCpp(JNIEnv *env, jobject thiz, jstring json) {
|
||||
// TODO: implement ChangeStateCpp()
|
||||
const char *nativeString = env->GetStringUTFChars(json, nullptr);
|
||||
jsize len = env->GetStringUTFLength(json);
|
||||
if(len > ArgLen)
|
||||
{
|
||||
aout << "ArgLen to long:" << len << std::endl;
|
||||
return;
|
||||
}
|
||||
if(g_Application->isInited())
|
||||
{
|
||||
g_Application->changeMotion(nativeString);
|
||||
}
|
||||
}
|
||||
@@ -171,31 +171,6 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
int action = event.getActionMasked();
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
Log.d(TAG, "Java Layer: Touch DOWN at (" + x + ", " + y + ")");
|
||||
// ✅ 你可以在这里做些事,比如发消息给 C++,或 UI 反馈
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
Log.d(TAG, "Java Layer: Touch MOVE");
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
Log.d(TAG, "Java Layer: Touch UP");
|
||||
break;
|
||||
}
|
||||
|
||||
// ⚠️ 关键:返回 false 才能让事件继续传递给 Native 层(C++)
|
||||
// 如果返回 true,表示事件已被消费,C++ 层将收不到!
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
@@ -290,7 +265,10 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
|
||||
{
|
||||
SetCppInitArg(json);
|
||||
}
|
||||
|
||||
protected native void ChangeStateCpp(String json);
|
||||
protected void ChangeState(String json){
|
||||
Log.i("FaceActivity", "ChangeState:" + json);
|
||||
ChangeStateCpp(json);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@ package com.hmwl.face_sdk;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Motion {
|
||||
public String type;
|
||||
public String technique;
|
||||
public String step;
|
||||
public String show_type;
|
||||
public String png_name;
|
||||
public String type = "no";
|
||||
public String technique = "no";
|
||||
public String step = "no";
|
||||
public String show_type = "no";
|
||||
public String png_name = "no";
|
||||
public int png_num;
|
||||
|
||||
public JSONObject toJsonObject() {
|
||||
|
||||
Reference in New Issue
Block a user