mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
Add AssetsManager to iOS & Mac & Android & win32 (#1405)
* Add incomplete AssetsManager to iOS & Mac * remove Android.mk refer on Xcode project config * re-add assetmanager for android * re-add assetmanager for win32 project config * remove unused macro define for win32 * remove unused marco define COCOS2D_JAVASCRIPT * added header include for assetsManager * Add CCAsyncTaskPool * Fix AssetsManager event trigger issue * update win32 project config, added CCAsyncTaskPool * add CCAsyncTaskPool to extensions Android.mk
This commit is contained in:
@@ -527,48 +527,4 @@ func
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class EventListenerAssetsManagerEx
|
||||
*/
|
||||
cc.EventListenerAssetsManager = {
|
||||
|
||||
/**
|
||||
* @method init
|
||||
* @param {cc.AssetsManagerEx} arg0
|
||||
* @param {function} arg1
|
||||
* @return {bool}
|
||||
*/
|
||||
init : function (
|
||||
assetsmanagerex,
|
||||
func
|
||||
)
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @param {cc.AssetsManagerEx} arg0
|
||||
* @param {function} arg1
|
||||
* @return {cc.EventListenerAssetsManagerEx}
|
||||
*/
|
||||
create : function (
|
||||
assetsmanagerex,
|
||||
func
|
||||
)
|
||||
{
|
||||
return cc.EventListenerAssetsManagerEx;
|
||||
},
|
||||
|
||||
/**
|
||||
* @method EventListenerAssetsManagerEx
|
||||
* @constructor
|
||||
*/
|
||||
EventListenerAssetsManagerEx : function (
|
||||
)
|
||||
{
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
@@ -260,9 +260,6 @@ static bool js_cocos2dx_extension_EventAssetsManagerEx_constructor(se::State& s)
|
||||
SE_BIND_CTOR(js_cocos2dx_extension_EventAssetsManagerEx_constructor, __jsb_cocos2d_extension_EventAssetsManagerEx_class, js_cocos2d_extension_EventAssetsManagerEx_finalize)
|
||||
|
||||
|
||||
|
||||
extern se::Object* __jsb_cocos2d_EventCustom_proto;
|
||||
|
||||
static bool js_cocos2d_extension_EventAssetsManagerEx_finalize(se::State& s)
|
||||
{
|
||||
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::extension::EventAssetsManagerEx)", s.nativeThisObject());
|
||||
@@ -277,7 +274,7 @@ SE_BIND_FINALIZE_FUNC(js_cocos2d_extension_EventAssetsManagerEx_finalize)
|
||||
|
||||
bool js_register_cocos2dx_extension_EventAssetsManagerEx(se::Object* obj)
|
||||
{
|
||||
auto cls = se::Class::create("EventAssetsManager", obj, __jsb_cocos2d_EventCustom_proto, _SE(js_cocos2dx_extension_EventAssetsManagerEx_constructor));
|
||||
auto cls = se::Class::create("EventAssetsManager", obj, nullptr, _SE(js_cocos2dx_extension_EventAssetsManagerEx_constructor));
|
||||
|
||||
cls->defineFunction("getAssetsManagerEx", _SE(js_cocos2dx_extension_EventAssetsManagerEx_getAssetsManagerEx));
|
||||
cls->defineFunction("getDownloadedFiles", _SE(js_cocos2dx_extension_EventAssetsManagerEx_getDownloadedFiles));
|
||||
@@ -879,6 +876,52 @@ static bool js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle(se::St
|
||||
}
|
||||
SE_BIND_FUNC(js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle)
|
||||
|
||||
static bool js_cocos2dx_extension_AssetsManagerEx_setEventCallback(se::State& s)
|
||||
{
|
||||
cocos2d::extension::AssetsManagerEx* cobj = (cocos2d::extension::AssetsManagerEx*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_cocos2dx_extension_AssetsManagerEx_setVerifyCallback : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 1) {
|
||||
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg0;
|
||||
do {
|
||||
if (args[0].isObject() && args[0].toObject()->isFunction())
|
||||
{
|
||||
se::Value jsThis(s.thisObject());
|
||||
se::Value jsFunc(args[0]);
|
||||
jsThis.toObject()->attachObject(jsFunc.toObject());
|
||||
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx *larg0) -> void {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
|
||||
SE_PRECONDITION2_VOID(ok, "js_cocos2dx_extension_AssetsManagerEx_setEventCallback callback : Error processing arguments");
|
||||
se::Value rval;
|
||||
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
|
||||
se::Object* funcObj = jsFunc.toObject();
|
||||
funcObj->call(args, thisObj, &rval);
|
||||
};
|
||||
arg0 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg0 = nullptr;
|
||||
}
|
||||
} while(false)
|
||||
;
|
||||
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_AssetsManagerEx_setEventCallback : Error processing arguments");
|
||||
cobj->setEventCallback(arg0);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_cocos2dx_extension_AssetsManagerEx_setEventCallback)
|
||||
|
||||
static bool js_cocos2dx_extension_AssetsManagerEx_setMaxConcurrentTask(se::State& s)
|
||||
{
|
||||
cocos2d::extension::AssetsManagerEx* cobj = (cocos2d::extension::AssetsManagerEx*)s.nativeThisObject();
|
||||
@@ -1167,6 +1210,7 @@ bool js_register_cocos2dx_extension_AssetsManagerEx(se::Object* obj)
|
||||
cls->defineFunction("getStoragePath", _SE(js_cocos2dx_extension_AssetsManagerEx_getStoragePath));
|
||||
cls->defineFunction("update", _SE(js_cocos2dx_extension_AssetsManagerEx_update));
|
||||
cls->defineFunction("setVersionCompareHandle", _SE(js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle));
|
||||
cls->defineFunction("setEventCallback", _SE(js_cocos2dx_extension_AssetsManagerEx_setEventCallback));
|
||||
cls->defineFunction("setMaxConcurrentTask", _SE(js_cocos2dx_extension_AssetsManagerEx_setMaxConcurrentTask));
|
||||
cls->defineFunction("getDownloadedBytes", _SE(js_cocos2dx_extension_AssetsManagerEx_getDownloadedBytes));
|
||||
cls->defineFunction("getLocalManifest", _SE(js_cocos2dx_extension_AssetsManagerEx_getLocalManifest));
|
||||
@@ -1187,170 +1231,19 @@ bool js_register_cocos2dx_extension_AssetsManagerEx(se::Object* obj)
|
||||
return true;
|
||||
}
|
||||
|
||||
se::Object* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto = nullptr;
|
||||
se::Class* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class = nullptr;
|
||||
|
||||
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_init(se::State& s)
|
||||
{
|
||||
cocos2d::extension::EventListenerAssetsManagerEx* cobj = (cocos2d::extension::EventListenerAssetsManagerEx*)s.nativeThisObject();
|
||||
SE_PRECONDITION2(cobj, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Invalid Native Object");
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
const cocos2d::extension::AssetsManagerEx* arg0 = nullptr;
|
||||
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg1;
|
||||
ok &= seval_to_native_ptr(args[0], &arg0);
|
||||
do {
|
||||
if (args[1].isObject() && args[1].toObject()->isFunction())
|
||||
{
|
||||
se::Value jsThis(s.thisObject());
|
||||
se::Value jsFunc(args[1]);
|
||||
jsThis.toObject()->attachObject(jsFunc.toObject());
|
||||
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx* larg0) -> void {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
|
||||
se::Value rval;
|
||||
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
|
||||
se::Object* funcObj = jsFunc.toObject();
|
||||
bool succeed = funcObj->call(args, thisObj, &rval);
|
||||
if (!succeed) {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
}
|
||||
};
|
||||
arg1 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1 = nullptr;
|
||||
}
|
||||
} while(false)
|
||||
;
|
||||
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Error processing arguments");
|
||||
bool result = cobj->init(arg0, arg1);
|
||||
ok &= boolean_to_seval(result, &s.rval());
|
||||
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Error processing arguments");
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_init)
|
||||
|
||||
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_create(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
size_t argc = args.size();
|
||||
CC_UNUSED bool ok = true;
|
||||
if (argc == 2) {
|
||||
cocos2d::extension::AssetsManagerEx* arg0 = nullptr;
|
||||
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg1;
|
||||
ok &= seval_to_native_ptr(args[0], &arg0);
|
||||
do {
|
||||
if (args[1].isObject() && args[1].toObject()->isFunction())
|
||||
{
|
||||
se::Value jsThis(s.thisObject());
|
||||
se::Value jsFunc(args[1]);
|
||||
jsFunc.toObject()->root();
|
||||
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx* larg0) -> void {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
CC_UNUSED bool ok = true;
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
|
||||
se::Value rval;
|
||||
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
|
||||
se::Object* funcObj = jsFunc.toObject();
|
||||
bool succeed = funcObj->call(args, thisObj, &rval);
|
||||
if (!succeed) {
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
}
|
||||
};
|
||||
arg1 = lambda;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg1 = nullptr;
|
||||
}
|
||||
} while(false)
|
||||
;
|
||||
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_create : Error processing arguments");
|
||||
auto result = cocos2d::extension::EventListenerAssetsManagerEx::create(arg0, arg1);
|
||||
result->retain();
|
||||
auto obj = se::Object::createObjectWithClass(__jsb_cocos2d_extension_EventListenerAssetsManagerEx_class);
|
||||
obj->setPrivateData(result);
|
||||
s.rval().setObject(obj);
|
||||
return true;
|
||||
}
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_create)
|
||||
|
||||
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
|
||||
|
||||
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor(se::State& s)
|
||||
{
|
||||
cocos2d::extension::EventListenerAssetsManagerEx* cobj = new (std::nothrow) cocos2d::extension::EventListenerAssetsManagerEx();
|
||||
s.thisObject()->setPrivateData(cobj);
|
||||
return true;
|
||||
}
|
||||
SE_BIND_CTOR(js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor, __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class, js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
|
||||
|
||||
|
||||
|
||||
extern se::Object* __jsb_cocos2d_EventListenerCustom_proto;
|
||||
|
||||
static bool js_cocos2d_extension_EventListenerAssetsManagerEx_finalize(se::State& s)
|
||||
{
|
||||
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::extension::EventListenerAssetsManagerEx)", s.nativeThisObject());
|
||||
cocos2d::extension::EventListenerAssetsManagerEx* cobj = (cocos2d::extension::EventListenerAssetsManagerEx*)s.nativeThisObject();
|
||||
if (cobj->getReferenceCount() == 1)
|
||||
cobj->autorelease();
|
||||
else
|
||||
cobj->release();
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FINALIZE_FUNC(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
|
||||
|
||||
bool js_register_cocos2dx_extension_EventListenerAssetsManagerEx(se::Object* obj)
|
||||
{
|
||||
auto cls = se::Class::create("EventListenerAssetsManager", obj, __jsb_cocos2d_EventListenerCustom_proto, _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor));
|
||||
|
||||
cls->defineFunction("init", _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_init));
|
||||
cls->defineStaticFunction("create", _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_create));
|
||||
cls->defineFinalizeFunction(_SE(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize));
|
||||
cls->install();
|
||||
JSBClassType::registerClass<cocos2d::extension::EventListenerAssetsManagerEx>(cls);
|
||||
|
||||
__jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto = cls->getProto();
|
||||
__jsb_cocos2d_extension_EventListenerAssetsManagerEx_class = cls;
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool register_all_cocos2dx_extension(se::Object* obj)
|
||||
{
|
||||
// Get the ns
|
||||
se::Value nsVal;
|
||||
if (!obj->getProperty("cc", &nsVal))
|
||||
if (!obj->getProperty("jsb", &nsVal))
|
||||
{
|
||||
se::HandleObject jsobj(se::Object::createPlainObject());
|
||||
nsVal.setObject(jsobj);
|
||||
obj->setProperty("cc", nsVal);
|
||||
obj->setProperty("jsb", nsVal);
|
||||
}
|
||||
se::Object* ns = nsVal.toObject();
|
||||
|
||||
js_register_cocos2dx_extension_AssetsManagerEx(ns);
|
||||
js_register_cocos2dx_extension_EventListenerAssetsManagerEx(ns);
|
||||
js_register_cocos2dx_extension_Manifest(ns);
|
||||
js_register_cocos2dx_extension_EventAssetsManagerEx(ns);
|
||||
return true;
|
||||
|
||||
@@ -69,12 +69,3 @@ SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_isResuming);
|
||||
SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_create);
|
||||
SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_AssetsManagerEx);
|
||||
|
||||
extern se::Object* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto;
|
||||
extern se::Class* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class;
|
||||
|
||||
bool js_register_cocos2d_extension_EventListenerAssetsManagerEx(se::Object* obj);
|
||||
bool register_all_cocos2dx_extension(se::Object* obj);
|
||||
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_init);
|
||||
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_create);
|
||||
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_EventListenerAssetsManagerEx);
|
||||
|
||||
|
||||
@@ -37,13 +37,6 @@ using namespace cocos2d;
|
||||
using namespace cocos2d::extension;
|
||||
using namespace cocos2d::experimental;
|
||||
|
||||
static bool jsb_cocos2d_extension_empty_func(se::State& s)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FUNC(jsb_cocos2d_extension_empty_func)
|
||||
|
||||
|
||||
static bool js_cocos2dx_extension_loadRemoteImage(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
@@ -243,106 +236,10 @@ static ThreadPool* getThreadPool()
|
||||
return _threadPool;
|
||||
}
|
||||
|
||||
static bool js_cocos2dx_extension_initTextureAsync(se::State& s)
|
||||
{
|
||||
const auto& args = s.args();
|
||||
int argc = (int)args.size();
|
||||
if (argc != 3)
|
||||
{
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 3);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
|
||||
// get texture
|
||||
cocos2d::Texture2D* texture = nullptr;
|
||||
ok = seval_to_native_ptr(args[0], &texture);
|
||||
SE_PRECONDITION2(ok, false, "Converting 'texture' failed!");
|
||||
|
||||
// get url
|
||||
std::string url;
|
||||
ok = seval_to_std_string(args[1], &url);
|
||||
SE_PRECONDITION2(ok, false, "Converting 'url' failed!");
|
||||
|
||||
// get callback
|
||||
se::Value func = args[2];
|
||||
assert(func.isObject() && func.toObject()->isFunction());
|
||||
func.toObject()->root();
|
||||
|
||||
auto onCallback = [=](bool success){
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
se::AutoHandleScope hs;
|
||||
|
||||
se::ValueArray args;
|
||||
args.resize(1);
|
||||
|
||||
args[0].setBoolean(success);
|
||||
func.toObject()->call(args, nullptr);
|
||||
};
|
||||
|
||||
// getDataFromFile isn't thread safe since fullPathForFilename usage in getDataFromFile isn't.
|
||||
// So we should pass full path to getDataFromFile to avoid multi-thread issues.
|
||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(url);
|
||||
|
||||
getThreadPool()->pushTask([texture, onCallback, fullPath](int tid){
|
||||
Data data = FileUtils::getInstance()->getDataFromFile(fullPath);
|
||||
if (!data.isNull())
|
||||
{
|
||||
Image* image = new (std::nothrow) Image();
|
||||
if (image->initWithImageData(data.getBytes(), data.getSize()))
|
||||
{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]() {
|
||||
if (texture->initWithImage(image))
|
||||
{
|
||||
onCallback(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to init texture with image.");
|
||||
onCallback(false);
|
||||
}
|
||||
CC_SAFE_RELEASE(image);
|
||||
});
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to load image.");
|
||||
CC_SAFE_RELEASE(image);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to load file.");
|
||||
}
|
||||
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
|
||||
onCallback(false);
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
SE_BIND_FUNC(js_cocos2dx_extension_initTextureAsync)
|
||||
|
||||
bool register_all_cocos2dx_extension_manual(se::Object* obj)
|
||||
{
|
||||
|
||||
// empty 'retain' 'release' implementation
|
||||
se::Object* protosNeedEmptyRetainRelease[] = {
|
||||
__jsb_cocos2d_extension_AssetsManagerEx_proto,
|
||||
__jsb_cocos2d_extension_Manifest_proto
|
||||
};
|
||||
|
||||
for (const auto& e : protosNeedEmptyRetainRelease)
|
||||
{
|
||||
e->defineFunction("retain", _SE(jsb_cocos2d_extension_empty_func));
|
||||
e->defineFunction("release", _SE(jsb_cocos2d_extension_empty_func));
|
||||
}
|
||||
__jsbObj->defineFunction("loadRemoteImg", _SE(js_cocos2dx_extension_loadRemoteImage));
|
||||
__jsbObj->defineFunction("initRemoteImg", _SE(js_cocos2dx_extension_initRemoteImage));
|
||||
__jsbObj->defineFunction("initTextureAsync", _SE(js_cocos2dx_extension_initTextureAsync));
|
||||
|
||||
se::ScriptEngine::getInstance()->clearException();
|
||||
|
||||
|
||||
@@ -2548,6 +2548,20 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret)
|
||||
{
|
||||
assert(ret != nullptr);
|
||||
se::HandleObject obj(se::Object::createPlainObject());
|
||||
obj->setProperty("md5", se::Value(v.md5));
|
||||
obj->setProperty("path", se::Value(v.path));
|
||||
obj->setProperty("compressed", se::Value(v.compressed));
|
||||
obj->setProperty("size", se::Value(v.size));
|
||||
obj->setProperty("downloadState", se::Value(v.downloadState));
|
||||
ret->setObject(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//FIXME: why v has to be a pointer?
|
||||
//bool uniform_to_seval(const cocos2d::Uniform* v, se::Value* ret)
|
||||
//{
|
||||
@@ -2576,20 +2590,6 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
//bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret)
|
||||
//{
|
||||
// assert(ret != nullptr);
|
||||
// se::HandleObject obj(se::Object::createPlainObject());
|
||||
// obj->setProperty("md5", se::Value(v.md5));
|
||||
// obj->setProperty("path", se::Value(v.path));
|
||||
// obj->setProperty("compressed", se::Value(v.compressed));
|
||||
// obj->setProperty("size", se::Value(v.size));
|
||||
// obj->setProperty("downloadState", se::Value(v.downloadState));
|
||||
// ret->setObject(obj);
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
//bool AffineTransform_to_seval(const cocos2d::AffineTransform& v, se::Value* ret)
|
||||
//{
|
||||
// assert(ret != nullptr);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "renderer/gfx/GFX.h"
|
||||
#include "renderer/renderer/Renderer.h"
|
||||
#include "network/CCDownloader.h"
|
||||
//#include "extensions/cocos-ext.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
//#include "Box2D/Box2D.h"
|
||||
|
||||
#define SE_PRECONDITION2_VOID(condition, ...) \
|
||||
@@ -275,7 +275,7 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
|
||||
bool EffectProperty_to_seval(const cocos2d::renderer::Effect::Property& v, se::Value* ret);
|
||||
//bool uniform_to_seval(const cocos2d::Uniform* v, se::Value* ret);
|
||||
//bool Quaternion_to_seval(const cocos2d::Quaternion& v, se::Value* ret);
|
||||
//bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret);
|
||||
bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret);
|
||||
//bool AffineTransform_to_seval(const cocos2d::AffineTransform& v, se::Value* ret);
|
||||
////bool Viewport_to_seval(const cocos2d::experimental::Viewport& v, se::Value* ret);
|
||||
bool Data_to_seval(const cocos2d::Data& v, se::Value* ret);
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_gfx_auto.hpp"
|
||||
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
|
||||
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.hpp"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_node.hpp"
|
||||
#include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
|
||||
@@ -93,6 +92,7 @@ bool jsb_register_all_modules()
|
||||
se->addRegisterCallback(register_all_cocos2dx);
|
||||
se->addRegisterCallback(register_all_cocos2dx_manual);
|
||||
se->addRegisterCallback(register_platform_bindings);
|
||||
se->addRegisterCallback(register_all_cocos2dx_extension);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
se->addRegisterCallback(register_javascript_objc_bridge);
|
||||
|
||||
Reference in New Issue
Block a user