基本调通 回调
This commit is contained in:
+32
-13
@@ -39,6 +39,12 @@ std::wstring ReadFileWithChinesePath(const std::wstring& filePath) {
|
||||
return AppBase::UTF8ToWideString(context);
|
||||
}
|
||||
|
||||
FaceApp* g_app;
|
||||
|
||||
void CppCallback(const string& motion_type)
|
||||
{
|
||||
g_app->changeMotion(motion_type.c_str());
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
@@ -51,23 +57,23 @@ int main() {
|
||||
Motion motion;
|
||||
motion.type = "4";
|
||||
motion.png_names.push_back("4.png");
|
||||
//for (int i = 0; i < 25; ++i)
|
||||
//{
|
||||
// if (i < 10)
|
||||
// {
|
||||
// motion.png_names.push_back("00000" + std::to_string(i) + ".png");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// motion.png_names.push_back("0000" + std::to_string(i) + ".png");
|
||||
for (int i = 0; i < 25; ++i)
|
||||
{
|
||||
if (i < 10)
|
||||
{
|
||||
motion.png_names.push_back("00000" + std::to_string(i) + ".png");
|
||||
}
|
||||
else
|
||||
{
|
||||
motion.png_names.push_back("0000" + std::to_string(i) + ".png");
|
||||
|
||||
// }
|
||||
//
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
init_arg.motion = motion;
|
||||
//init_arg.motion = motion;
|
||||
|
||||
|
||||
init_arg.action_fps = 10;
|
||||
@@ -76,9 +82,22 @@ int main() {
|
||||
string json_str = json(init_arg).dump();
|
||||
|
||||
FaceApp app;
|
||||
g_app = &app;
|
||||
app.SetInitArg(json_str.c_str());
|
||||
app.initVulkan();
|
||||
app._running = true;
|
||||
auto motion_json = json(motion);
|
||||
if (!motion_json.is_object()) {
|
||||
std::cout << "Invalid JSON structure" << std::endl;
|
||||
}
|
||||
std::string motion_str = motion_json.dump();
|
||||
// 添加完整性检查
|
||||
if (motion_str.empty()) {
|
||||
std::cout << "Warning: Empty motion string" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
app.preReadyMotion(motion_str, CppCallback);
|
||||
app.mainLoop();
|
||||
//try {
|
||||
// app.mainLoop();
|
||||
|
||||
Reference in New Issue
Block a user