This commit is contained in:
xsl
2025-12-24 10:20:53 +08:00
parent 1f9e4939b9
commit 4c5a05ae21
266 changed files with 568 additions and 377 deletions
+32 -15
View File
@@ -53,6 +53,12 @@ void CppCallback()
g_app->changeMotionList(motions, CppAnimationFinishedCallback, true);
}
void CppCallback2()
{
vector<string> motions = { "11" };
g_app->changeMotionList(motions, CppAnimationFinishedCallback, true);
}
// 读取JSON文件并填充到motions容器中
void loadMotions(const std::string& filePath, std::map<std::string, Motion>& motions) {
// 读取json文件
@@ -118,8 +124,8 @@ int main() {
//std::wstring content = ReadFileWithChinesePath(chinese_path);
InitArg init_arg;
Motion motion;
motion.name = "4";
//Motion motion;
//motion.name = "4";
//motion.png_names.push_back("4.png");
//for (int i = 1; i < 61; ++i)
//{
@@ -152,15 +158,15 @@ int main() {
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;
}
//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;
//}
MotionList s_motions;
s_motions.motions.push_back(motions["4"]);
@@ -170,17 +176,28 @@ int main() {
auto s = j.dump();
app.preLoadMotionList(s, CppCallback);
threadRun = true;
std::thread t(threadFunction);
//threadRun = true;
//std::thread t(threadFunction);
app.mainLoop();
threadRun = false;
t.join();
//threadRun = false;
//t.join();
//try {
// app.mainLoop();
//} catch (const std::exception& e) {
// std::cerr << e.what() << std::endl;
// return EXIT_FAILURE;
//}
s_motions.motions.push_back(motions["4"]);
s_motions.motions.push_back(motions["5"]);
s_motions.motions.push_back(motions["13"]);
s_motions.motions.push_back(motions["11"]);
j = s_motions;
s = j.dump();
app.preLoadMotionList(s, CppCallback2);
app.mainLoop();
app.cleanup();
return EXIT_SUCCESS;
}