[cocos2d-x] 修复 include 等在编译模拟器时发现的问题

This commit is contained in:
打包机 2022-07-05 15:05:12 +08:00
parent 77b81db091
commit 4d40ad2ed7
3 changed files with 28 additions and 26 deletions

View File

@ -32,6 +32,8 @@
#include <spine/Vector.h>
#include <spine/SpineString.h>
#include <vector>
#include <map>
namespace spine {
class Attachment;

View File

@ -672,32 +672,6 @@ bool seval_to_spine_Vector_T_ptr(const se::Value& v, spine::Vector<T*>* ret)
return true;
}
bool spine_skin_attachments_to_seval(std::vector<std::map<std::string, spine::Attachment*>>& v, se::Value* ret) {
assert(ret != nullptr);
bool ok = true;
se::HandleObject arr(se::Object::createArrayObject(v.size()));
int i = 0;
for (const auto &vv : v)
{
se::HandleObject obj(se::Object::createPlainObject());
se::Value tmp;
for (const auto& e : vv) {
native_ptr_to_rooted_seval<spine::Attachment>(e.second, &tmp);
obj->setProperty(e.first.c_str(), tmp);
}
arr->setArrayElement(i, se::Value(obj));
i++;
}
ret->setObject(arr, true);
return ok;
}
bool seval_to_spine_Vector_String(const se::Value& v, spine::Vector<spine::String>* ret);
bool spine_Vector_String_to_seval(const spine::Vector<spine::String>& v, se::Value* ret);
#endif

View File

@ -235,6 +235,32 @@ static bool js_register_spine_retainSkeletonData(se::State& s)
}
SE_BIND_FUNC(js_register_spine_retainSkeletonData)
bool spine_skin_attachments_to_seval(std::vector<std::map<std::string, spine::Attachment*>>& v, se::Value* ret) {
assert(ret != nullptr);
bool ok = true;
se::HandleObject arr(se::Object::createArrayObject(v.size()));
int i = 0;
for (const auto &vv : v)
{
se::HandleObject obj(se::Object::createPlainObject());
se::Value tmp;
for (const auto& e : vv) {
native_ptr_to_rooted_seval<spine::Attachment>(e.second, &tmp);
obj->setProperty(e.first.c_str(), tmp);
}
arr->setArrayElement(i, se::Value(obj));
i++;
}
ret->setObject(arr, true);
return ok;
}
static bool js_cocos2dx_spine_Skin_getAttachmentsForJSB(se::State& s) {
spine::Skin* cobj = (spine::Skin*)s.nativeThisObject();
SE_PRECONDITION2(