Merge pull request #15 from pandamicro/spritepolygon

Add SpritePolygon JSB bindingsJSB bindings
This commit is contained in:
Hao Wu 2015-06-15 15:47:02 +08:00
commit b4ca8c1489
18 changed files with 792 additions and 476 deletions

View File

@ -74,10 +74,10 @@ public class Cocos2dxHelper {
private static Activity sActivity = null;
private static Cocos2dxHelperListener sCocos2dxHelperListener;
private static Set<OnActivityResultListener> onActivityResultListeners = new LinkedHashSet<OnActivityResultListener>();
//Enhance API modification begin
//Enhance API modification begin
private static IGameTuningService mGameServiceBinder = null;
private static final int BOOST_TIME = 7;
//Enhance API modification end
//Enhance API modification end
// ===========================================================
// Constructors
@ -116,26 +116,26 @@ public class Cocos2dxHelper {
sInited = true;
//Enhance API modification begin
Intent serviceIntent = new Intent(IGameTuningService.class.getName());
serviceIntent.setPackage("com.enhance.gameservice");
Intent serviceIntent = new Intent(IGameTuningService.class.getName());
serviceIntent.setPackage("com.enhance.gameservice");
boolean suc = activity.getApplicationContext().bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE);
//Enhance API modification end
}
}
//Enhance API modification begin
private static ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
mGameServiceBinder = IGameTuningService.Stub.asInterface(service);
fastLoading(BOOST_TIME);
}
private static ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
mGameServiceBinder = IGameTuningService.Stub.asInterface(service);
fastLoading(BOOST_TIME);
}
public void onServiceDisconnected(ComponentName name) {
sActivity.getApplicationContext().unbindService(connection);
}
};
//Enhance API modification end
public void onServiceDisconnected(ComponentName name) {
sActivity.getApplicationContext().unbindService(connection);
}
};
//Enhance API modification end
public static Activity getActivity() {
return sActivity;
}
@ -530,64 +530,64 @@ public class Cocos2dxHelper {
}
//Enhance API modification begin
public static int setResolutionPercent(int per) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setPreferredResolution(per);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int setResolutionPercent(int per) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setPreferredResolution(per);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int setFPS(int fps) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setFramePerSecond(fps);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int setFPS(int fps) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setFramePerSecond(fps);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int fastLoading(int sec) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.boostUp(sec);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int fastLoading(int sec) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.boostUp(sec);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int getTemperature() {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.getAbstractTemperature();
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int getTemperature() {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.getAbstractTemperature();
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int setLowPowerMode(boolean enable) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setGamePowerSaving(enable);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
//Enhance API modification end
public static int setLowPowerMode(boolean enable) {
try {
if (mGameServiceBinder != null) {
return mGameServiceBinder.setGamePowerSaving(enable);
}
return -1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
//Enhance API modification end
}

View File

@ -69,7 +69,6 @@ set(JSBINDING_SRC
manual/spine/jsb_cocos2dx_spine_manual.cpp
manual/ui/jsb_cocos2dx_ui_manual.cpp
manual/3d/jsb_cocos2dx_3d_manual.cpp
manual/experimental/jsb_cocos2dx_experimental_manual.cpp
manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp
${cocos_root}/cocos/storage/local-storage/LocalStorage.cpp
)

View File

@ -3913,7 +3913,135 @@ bool js_cocos2dx_ccquatMultiply(JSContext *cx, uint32_t argc, jsval *vp)
return false;
}
bool js_cocos2dx_CCSprite_textureLoaded(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_Sprite_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
do {
if (argc == 1) {
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Sprite* ret = cocos2d::Sprite::create(arg0);
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
} while (0);
do {
if (argc == 0) {
cocos2d::Sprite* ret = cocos2d::Sprite::create();
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
} while (0);
do {
if (argc == 2) {
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
if (!ok) { ok = true; break; }
cocos2d::Rect arg1;
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
if (!ok) { ok = true; break; }
cocos2d::Sprite* ret = cocos2d::Sprite::create(arg0, arg1);
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
} while (0);
JS_ReportError(cx, "js_cocos2dx_Sprite_create : wrong number of arguments");
return false;
}
bool js_cocos2dx_Sprite_initWithPolygon(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithPolygon : Invalid Native Object");
if (argc == 1) {
cocos2d::PolygonInfo *arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::PolygonInfo*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_initWithPolygon : Error processing arguments");
bool ret = cobj->initWithPolygon(*arg0);
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Sprite_initWithPolygon : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Sprite_setPolygonInfo(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setPolygonInfo : Invalid Native Object");
if (argc == 1) {
cocos2d::PolygonInfo *arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JSObject *tmpObj = args.get(0).toObjectOrNull();
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::PolygonInfo*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setPolygonInfo : Error processing arguments");
cobj->setPolygonInfo(*arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Sprite_setPolygonInfo : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Sprite_textureLoaded(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
@ -5392,12 +5520,440 @@ bool js_cocos2dx_Scene_getPhysics3DWorld(JSContext *cx, uint32_t argc, jsval *vp
}
#endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
JSClass *jsb_cocos2d_PolygonInfo_class;
JSObject *jsb_cocos2d_PolygonInfo_prototype;
bool js_cocos2dx_PolygonInfo_getArea(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getArea : Invalid Native Object");
if (argc == 0)
{
const float ret = cobj->getArea();
jsval jsret = JSVAL_NULL;
jsret = DOUBLE_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getArea : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getTriaglesCount : Invalid Native Object");
if (argc == 0)
{
const unsigned int ret = cobj->getTriaglesCount();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getTriaglesCount : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_PolygonInfo_getVertCount(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getVertCount : Invalid Native Object");
if (argc == 0)
{
const unsigned int ret = cobj->getVertCount();
jsval jsret = JSVAL_NULL;
jsret = uint32_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getVertCount : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
// PolygonInfo.rect
bool js_get_PolygonInfo_rect(JSContext* cx, uint32_t argc, jsval* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
if (cobj)
{
jsval ret = ccrect_to_jsval(cx, cobj->rect);
if (ret != JSVAL_NULL)
{
args.rval().set(ret);
return true;
}
CCLOGERROR("js_get_PolygonInfo_rect : Fail to retrieve property from PolygonInfo.");
return false;
}
JS_ReportError(cx, "js_get_PolygonInfo_rect : Invalid native object.");
return false;
}
bool js_set_PolygonInfo_rect(JSContext* cx, uint32_t argc, jsval* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
if (cobj)
{
JS::RootedValue jsrect(cx, args.get(0));
jsval_to_ccrect(cx, jsrect, &cobj->rect);
return true;
}
JS_ReportError(cx, "js_set_PolygonInfo_rect : Invalid native object.");
return false;
}
// PolygonInfo.filename
bool js_get_PolygonInfo_filename(JSContext* cx, uint32_t argc, jsval* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
if (cobj)
{
jsval ret = std_string_to_jsval(cx, cobj->filename);
if (ret != JSVAL_NULL)
{
args.rval().set(ret);
return true;
}
CCLOGERROR("js_get_PolygonInfo_filename : Fail to retrieve property from PolygonInfo.");
return false;
}
JS_ReportError(cx, "js_get_PolygonInfo_filename : Invalid native object.");
return false;
}
bool js_set_PolygonInfo_filename(JSContext* cx, uint32_t argc, jsval* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
if (cobj)
{
JS::RootedValue jsstr(cx, args.get(0));
jsval_to_std_string(cx, jsstr, &cobj->filename);
return true;
}
JS_ReportError(cx, "js_set_PolygonInfo_filename : Invalid native object.");
return false;
}
bool js_cocos2dx_PolygonInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
cocos2d::PolygonInfo* cobj = new (std::nothrow) cocos2d::PolygonInfo();
TypeTest<cocos2d::PolygonInfo> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
// JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
JS::RootedObject proto(cx, typeClass->proto.get());
JS::RootedObject parent(cx, typeClass->parentProto.get());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
jsb_new_proxy(cobj, obj);
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
void js_cocos2d_PolygonInfo_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (PolygonInfo)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
jsproxy = jsb_get_js_proxy(obj);
if (jsproxy)
{
nproxy = jsb_get_native_proxy(jsproxy->ptr);
cocos2d::PolygonInfo *nobj = static_cast<cocos2d::PolygonInfo *>(nproxy->ptr);
if (nobj)
delete nobj;
jsb_remove_proxy(nproxy, jsproxy);
}
}
void js_register_cocos2dx_PolygonInfo(JSContext *cx, JS::HandleObject global)
{
jsb_cocos2d_PolygonInfo_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_PolygonInfo_class->name = "PolygonInfo";
jsb_cocos2d_PolygonInfo_class->addProperty = JS_PropertyStub;
jsb_cocos2d_PolygonInfo_class->delProperty = JS_DeletePropertyStub;
jsb_cocos2d_PolygonInfo_class->getProperty = JS_PropertyStub;
jsb_cocos2d_PolygonInfo_class->setProperty = JS_StrictPropertyStub;
jsb_cocos2d_PolygonInfo_class->enumerate = JS_EnumerateStub;
jsb_cocos2d_PolygonInfo_class->resolve = JS_ResolveStub;
jsb_cocos2d_PolygonInfo_class->convert = JS_ConvertStub;
jsb_cocos2d_PolygonInfo_class->finalize = js_cocos2d_PolygonInfo_finalize;
jsb_cocos2d_PolygonInfo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] =
{
JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_PSGS("rect", js_get_PolygonInfo_rect, js_set_PolygonInfo_rect, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_PSGS("filename", js_get_PolygonInfo_filename, js_set_PolygonInfo_filename, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_PS_END
};
static JSFunctionSpec funcs[] =
{
JS_FN("getArea", js_cocos2dx_PolygonInfo_getArea, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTriaglesCount", js_cocos2dx_PolygonInfo_getTriaglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVertCount", js_cocos2dx_PolygonInfo_getVertCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
JSFunctionSpec *st_funcs = NULL;
jsb_cocos2d_PolygonInfo_prototype = JS_InitClass(
cx, global,
JS::NullPtr(), // parent proto
jsb_cocos2d_PolygonInfo_class,
js_cocos2dx_PolygonInfo_constructor, 0, // constructor
properties,
funcs,
NULL, // no static properties
st_funcs);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::PolygonInfo> t;
js_type_class_t *p;
std::string typeName = t.s_name();
if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
{
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
p->jsclass = jsb_cocos2d_PolygonInfo_class;
p->proto = jsb_cocos2d_PolygonInfo_prototype;
p->parentProto = NULL;
_js_global_type_map.insert(std::make_pair(typeName, p));
}
}
JSClass *jsb_cocos2d_AutoPolygon_class;
JSObject *jsb_cocos2d_AutoPolygon_prototype;
bool js_cocos2dx_AutoPolygon_generatePolygon(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 1) {
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments");
cocos2d::PolygonInfo* ret = new cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0));
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PolygonInfo>(cx, ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
if (argc == 2) {
std::string arg0;
cocos2d::Rect arg1;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments");
cocos2d::PolygonInfo* ret = new cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1));
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PolygonInfo>(cx, ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
if (argc == 3) {
std::string arg0;
cocos2d::Rect arg1;
double arg2;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments");
cocos2d::PolygonInfo* ret = new cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2));
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PolygonInfo>(cx, ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
if (argc == 4) {
std::string arg0;
cocos2d::Rect arg1;
double arg2;
double arg3;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2);
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments");
cocos2d::PolygonInfo* ret = new cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2, arg3));
jsval jsret = JSVAL_NULL;
do {
if (ret) {
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::PolygonInfo>(cx, ret);
jsret = OBJECT_TO_JSVAL(jsProxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_AutoPolygon_generatePolygon : wrong number of arguments");
return false;
}
bool js_cocos2dx_AutoPolygon_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_constructor : Error processing arguments");
cocos2d::AutoPolygon* cobj = new (std::nothrow) cocos2d::AutoPolygon(arg0);
TypeTest<cocos2d::AutoPolygon> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
// JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
JS::RootedObject proto(cx, typeClass->proto.get());
JS::RootedObject parent(cx, typeClass->parentProto.get());
JS::RootedObject obj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
args.rval().set(OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
jsb_new_proxy(cobj, obj);
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
return true;
}
void js_cocos2d_AutoPolygon_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (AutoPolygon)", obj);
js_proxy_t* nproxy;
js_proxy_t* jsproxy;
jsproxy = jsb_get_js_proxy(obj);
if (jsproxy) {
nproxy = jsb_get_native_proxy(jsproxy->ptr);
cocos2d::AutoPolygon *nobj = static_cast<cocos2d::AutoPolygon *>(nproxy->ptr);
if (nobj)
delete nobj;
jsb_remove_proxy(nproxy, jsproxy);
}
}
void js_register_cocos2dx_AutoPolygon(JSContext *cx, JS::HandleObject global) {
jsb_cocos2d_AutoPolygon_class = (JSClass *)calloc(1, sizeof(JSClass));
jsb_cocos2d_AutoPolygon_class->name = "AutoPolygon";
jsb_cocos2d_AutoPolygon_class->addProperty = JS_PropertyStub;
jsb_cocos2d_AutoPolygon_class->delProperty = JS_DeletePropertyStub;
jsb_cocos2d_AutoPolygon_class->getProperty = JS_PropertyStub;
jsb_cocos2d_AutoPolygon_class->setProperty = JS_StrictPropertyStub;
jsb_cocos2d_AutoPolygon_class->enumerate = JS_EnumerateStub;
jsb_cocos2d_AutoPolygon_class->resolve = JS_ResolveStub;
jsb_cocos2d_AutoPolygon_class->convert = JS_ConvertStub;
jsb_cocos2d_AutoPolygon_class->finalize = js_cocos2d_AutoPolygon_finalize;
jsb_cocos2d_AutoPolygon_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
JS_PSG("__nativeObj", js_is_native_obj, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_PS_END
};
static JSFunctionSpec funcs[] = {
JS_FS_END
};
static JSFunctionSpec st_funcs[] = {
JS_FN("generatePolygon", js_cocos2dx_AutoPolygon_generatePolygon, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
jsb_cocos2d_AutoPolygon_prototype = JS_InitClass(
cx, global,
JS::NullPtr(), // parent proto
jsb_cocos2d_AutoPolygon_class,
js_cocos2dx_AutoPolygon_constructor, 0, // constructor
properties,
funcs,
NULL, // no static properties
st_funcs);
// make the class enumerable in the registered namespace
// bool found;
//FIXME: Removed in Firefox v27
// JS_SetPropertyAttributes(cx, global, "AutoPolygon", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<cocos2d::AutoPolygon> t;
js_type_class_t *p;
std::string typeName = t.s_name();
if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
{
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
p->jsclass = jsb_cocos2d_AutoPolygon_class;
p->proto = jsb_cocos2d_AutoPolygon_prototype;
p->parentProto = NULL;
_js_global_type_map.insert(std::make_pair(typeName, p));
}
}
void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
{
JS::RootedObject ccObj(cx);
JS::RootedObject jsbObj(cx);
JS::RootedValue tmpVal(cx);
JS::RootedObject tmpObj(cx);
get_or_create_js_obj(cx, global, "cc", &ccObj);
get_or_create_js_obj(cx, global, "jsb", &jsbObj);
js_register_cocos2dx_PolygonInfo(cx, jsbObj);
js_register_cocos2dx_AutoPolygon(cx, jsbObj);
JS_GetProperty(cx, ccObj, "PlistParser", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
@ -5559,8 +6115,13 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
tmpObj.set(jsb_cocos2d_CatmullRomTo_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", JSB_CatmullRomBy_initWithDuration, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "Sprite", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_Sprite_create, 0, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_Sprite_prototype);
JS_DefineFunction(cx, tmpObj, "textureLoaded", js_cocos2dx_CCSprite_textureLoaded, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "initWithPolygon", js_cocos2dx_Sprite_initWithPolygon, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setPolygonInfo", js_cocos2dx_Sprite_setPolygonInfo, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "textureLoaded", js_cocos2dx_Sprite_textureLoaded, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_SpriteBatchNode_prototype);
JS_DefineFunction(cx, tmpObj, "getDescendants", js_cocos2dx_SpriteBatchNode_getDescendants, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);

View File

@ -1,253 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "jsb_cocos2dx_experimental_manual.h"
#include "cocos2d_specifics.hpp"
#include "2d/SpritePolygon.h"
bool jsval_to_vector_vec2(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::Vec2>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::Vec2 vec2;
ok &= jsval_to_vector2(cx, value, &vec2);
ret->push_back(vec2);
}
}
return ok;
}
bool jsval_to_vector_unsigned_short(JSContext* cx, JS::HandleValue v, std::vector<unsigned short>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
unsigned short index;
ok &= jsval_to_uint16(cx, value, &index);
ret->push_back(index);
}
}
return ok;
}
bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret)
{
JS::RootedObject tmp(cx);
JS::RootedValue jsx(cx);
JS::RootedValue jsy(cx);
double x, y;
bool ok = vp.isObject() &&
JS_ValueToObject(cx, vp, &tmp) &&
JS_GetProperty(cx, tmp, "x", &jsx) &&
JS_GetProperty(cx, tmp, "y", &jsy) &&
JS::ToNumber(cx, jsx, &x) &&
JS::ToNumber(cx, jsy, &y) &&
!isnan(x) && !isnan(y);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->u = (GLfloat)x;
ret->v = (GLfloat)y;
return true;
}
bool jsval_to_v3fc4bt2f(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F* ret)
{
JS::RootedObject object(cx, v.toObjectOrNull());
cocos2d::Vec3 v3;
cocos2d::Color4B color;
cocos2d::Tex2F t2;
JS::RootedValue jsv3(cx);
JS::RootedValue jscolor(cx);
JS::RootedValue jst2(cx);
bool ok = JS_GetProperty(cx, object, "v3f", &jsv3) &&
JS_GetProperty(cx, object, "c4b", &jscolor) &&
JS_GetProperty(cx, object, "t2f", &jst2) &&
jsval_to_vector3(cx, jsv3, &v3) &&
jsval_to_cccolor4b(cx, jscolor, &color) &&
jsval_to_cctex2f(cx, jst2, &t2);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->vertices = v3;
ret->colors = color;
ret->texCoords = t2;
return true;
}
bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::V3F_C4B_T2F>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::V3F_C4B_T2F vert;
ok &= jsval_to_v3fc4bt2f(cx, value, &vert);
ret->push_back(vert);
}
}
return ok;
}
bool js_cocos2dx_SpritePolygon_create(JSContext *cx, uint32_t argc, jsval *vp)
{
if(argc == 1)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
auto sprite = cocos2d::experimental::SpritePolygon::create(file);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}
if(argc == 2)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::Vec2> verts;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_vec2(cx, args.get(1), &verts);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}
if(argc == 3)
{
do
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::Vec2> verts;
std::vector<unsigned short> indices;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_vec2(cx, args.get(1), &verts);
ok &= jsval_to_vector_unsigned_short(cx, args.get(2), &indices);
if(!ok)
break;
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts, indices);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}while (0);
do
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::V3F_C4B_T2F> verts;
std::vector<unsigned short> indices;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_v3fc4bt2f(cx, args.get(1), &verts);
ok &= jsval_to_vector_unsigned_short(cx, args.get(2), &indices);
if(!ok)
break;
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts, indices);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}while(0);
JS_ReportError(cx, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
}
JS_ReportError(cx, "js_cocos2dx_SpritePolygon_create : wrong number of arguments: %d", argc);
return false;
}
void register_all_cocos2dx_experimental_manual(JSContext *cx, JS::HandleObject global)
{
JS::RootedObject ccObj(cx);
get_or_create_js_obj(cx, global, "ccexp", &ccObj);
JS::RootedValue tmpVal(cx);
JS_GetProperty(cx, ccObj, "SpritePolygon", &tmpVal);
JS::RootedObject tmpObj(cx, tmpVal.toObjectOrNull());
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_SpritePolygon_create, 1, JSPROP_READONLY | JSPROP_PERMANENT);
}

View File

@ -1,35 +0,0 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __jsb_cococs2dx_experimental_h__
#define __jsb_cococs2dx_experimental_h__
#include "jsapi.h"
void register_all_cocos2dx_experimental_manual(JSContext *cx, JS::HandleObject global);
#endif

View File

@ -1565,6 +1565,134 @@ bool jsval_to_blendfunc(JSContext *cx, JS::HandleValue vp, cocos2d::BlendFunc* r
return true;
}
bool jsval_to_vector_vec2(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::Vec2>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::Vec2 vec2;
ok &= jsval_to_vector2(cx, value, &vec2);
ret->push_back(vec2);
}
}
return ok;
}
bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret)
{
JS::RootedObject tmp(cx);
JS::RootedValue jsx(cx);
JS::RootedValue jsy(cx);
double x, y;
bool ok = vp.isObject() &&
JS_ValueToObject(cx, vp, &tmp) &&
JS_GetProperty(cx, tmp, "x", &jsx) &&
JS_GetProperty(cx, tmp, "y", &jsy) &&
JS::ToNumber(cx, jsx, &x) &&
JS::ToNumber(cx, jsy, &y) &&
!isnan(x) && !isnan(y);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->u = (GLfloat)x;
ret->v = (GLfloat)y;
return true;
}
bool jsval_to_v3fc4bt2f(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F* ret)
{
JS::RootedObject object(cx, v.toObjectOrNull());
cocos2d::Vec3 v3;
cocos2d::Color4B color;
cocos2d::Tex2F t2;
JS::RootedValue jsv3(cx);
JS::RootedValue jscolor(cx);
JS::RootedValue jst2(cx);
bool ok = JS_GetProperty(cx, object, "v3f", &jsv3) &&
JS_GetProperty(cx, object, "c4b", &jscolor) &&
JS_GetProperty(cx, object, "t2f", &jst2) &&
jsval_to_vector3(cx, jsv3, &v3) &&
jsval_to_cccolor4b(cx, jscolor, &color) &&
jsval_to_cctex2f(cx, jst2, &t2);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->vertices = v3;
ret->colors = color;
ret->texCoords = t2;
return true;
}
bool jsval_to_v3fc4bt2f_quad(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F_Quad* ret)
{
JS::RootedObject object(cx, v.toObjectOrNull());
cocos2d::V3F_C4B_T2F tl;
cocos2d::V3F_C4B_T2F bl;
cocos2d::V3F_C4B_T2F tr;
cocos2d::V3F_C4B_T2F br;
JS::RootedValue jstl(cx);
JS::RootedValue jsbl(cx);
JS::RootedValue jstr(cx);
JS::RootedValue jsbr(cx);
bool ok = JS_GetProperty(cx, object, "tl", &jstl) &&
JS_GetProperty(cx, object, "bl", &jsbl) &&
JS_GetProperty(cx, object, "tr", &jstr) &&
JS_GetProperty(cx, object, "br", &jsbr) &&
jsval_to_v3fc4bt2f(cx, jstl, &tl) &&
jsval_to_v3fc4bt2f(cx, jsbl, &bl) &&
jsval_to_v3fc4bt2f(cx, jstr, &tr) &&
jsval_to_v3fc4bt2f(cx, jsbr, &br);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->tl = tl;
ret->bl = bl;
ret->tr = tr;
ret->br = br;
return true;
}
bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::V3F_C4B_T2F>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::V3F_C4B_T2F vert;
ok &= jsval_to_v3fc4bt2f(cx, value, &vert);
ret->push_back(vert);
}
}
return ok;
}
// native --> jsval
jsval ccarray_to_jsval(JSContext* cx, __Array *arr)
@ -2603,3 +2731,21 @@ jsval blendfunc_to_jsval(JSContext *cx, const cocos2d::BlendFunc& v)
}
return JSVAL_NULL;
}
jsval vector_vec2_to_jsval(JSContext *cx, const std::vector<cocos2d::Vec2>& v)
{
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, v.size()));
int i = 0;
for (const cocos2d::Vec2 obj : v)
{
JS::RootedValue arrElement(cx);
arrElement = vector2_to_jsval(cx, obj);
if (!JS_SetElement(cx, jsretArr, i, arrElement)) {
break;
}
++i;
}
return OBJECT_TO_JSVAL(jsretArr);
}

View File

@ -187,6 +187,11 @@ bool jsval_to_vector2(JSContext *cx, JS::HandleValue vp, cocos2d::Vec2* ret);
bool jsval_to_vector3(JSContext *cx, JS::HandleValue vp, cocos2d::Vec3* ret);
bool jsval_to_vector4(JSContext *cx, JS::HandleValue vp, cocos2d::Vec4* ret);
bool jsval_to_blendfunc(JSContext *cx, JS::HandleValue vp, cocos2d::BlendFunc* ret);
bool jsval_to_vector_vec2(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::Vec2>* ret);
bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret);
bool jsval_to_v3fc4bt2f(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F* ret);
bool jsval_to_v3fc4bt2f_quad(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F_Quad* ret);
bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::V3F_C4B_T2F>* ret);
template <class T>
bool jsval_to_ccmap_string_key(JSContext *cx, JS::HandleValue v, cocos2d::Map<std::string, T>* ret)
@ -333,6 +338,7 @@ jsval matrix_to_jsval(JSContext *cx, const cocos2d::Mat4& v);
jsval vector2_to_jsval(JSContext *cx, const cocos2d::Vec2& v);
jsval vector3_to_jsval(JSContext *cx, const cocos2d::Vec3& v);
jsval blendfunc_to_jsval(JSContext *cx, const cocos2d::BlendFunc& v);
jsval vector_vec2_to_jsval(JSContext *cx, const std::vector<cocos2d::Vec2>& v);
#endif /* __JS_MANUAL_CONVERSIONS_H__ */

View File

@ -74,7 +74,6 @@ LOCAL_SRC_FILES := ../auto/jsb_cocos2dx_3d_auto.cpp \
../manual/network/XMLHTTPRequest.cpp \
../manual/spine/jsb_cocos2dx_spine_manual.cpp \
../manual/ui/jsb_cocos2dx_ui_manual.cpp \
../manual/experimental/jsb_cocos2dx_experimental_manual.cpp \
../manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp

View File

@ -154,14 +154,6 @@
426390051B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */; };
426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */; };
426390071B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */; };
42AD256C1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */; };
42AD256F1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */; };
42AD25731AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */; };
42AD25741AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */; };
42AD25751AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */; };
42AD25761AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */; };
4B22F4AA1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B22F4A71B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.cpp */; };
4B22F4AB1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B22F4A81B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h */; };
4B22F4AC1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B22F4A81B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h */; };
@ -285,10 +277,6 @@
42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_physics3d_auto.hpp; sourceTree = "<group>"; };
426390021B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_physics3d_manual.cpp; sourceTree = "<group>"; };
426390031B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_physics3d_manual.h; sourceTree = "<group>"; };
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental.cpp; sourceTree = "<group>"; };
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental.hpp; sourceTree = "<group>"; };
42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_manual.cpp; path = experimental/jsb_cocos2dx_experimental_manual.cpp; sourceTree = "<group>"; };
42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_cocos2dx_experimental_manual.h; path = experimental/jsb_cocos2dx_experimental_manual.h; sourceTree = "<group>"; };
4B22F4A71B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_webView_manual.cpp; path = experimental/jsb_cocos2dx_experimental_webView_manual.cpp; sourceTree = "<group>"; };
4B22F4A81B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_cocos2dx_experimental_webView_manual.h; path = experimental/jsb_cocos2dx_experimental_webView_manual.h; sourceTree = "<group>"; };
4BE089E01ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_webView_auto.cpp; sourceTree = "<group>"; };
@ -371,8 +359,6 @@
4BE089E11ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp */,
42638FFB1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp */,
42638FFC1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp */,
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */,
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */,
420BBCEE1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp */,
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */,
BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */,
@ -592,8 +578,6 @@
B38AD5691B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.h */,
4B22F4A71B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.cpp */,
4B22F4A81B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h */,
42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */,
42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */,
);
name = experimental;
sourceTree = "<group>";
@ -651,10 +635,8 @@
1A119EEF18BDF19200352BAA /* js_bindings_system_functions.h in Headers */,
1A119EDD18BDF19200352BAA /* js_manual_conversions.h in Headers */,
1A119EFD18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
42AD25751AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */,
1AB5E63518D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
1A119EE318BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */,
42638FFF1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
0541A74F1973876100E45470 /* JavaScriptObjCBridge.h in Headers */,
426390061B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.h in Headers */,
@ -693,7 +675,6 @@
1A119EB618BDF19200352BAA /* js_bindings_chipmunk_manual.h in Headers */,
1A119EFA18BDF19200352BAA /* jsb_websocket.h in Headers */,
1A119E9218BDF19200352BAA /* jsb_cocos2dx_extension_auto.hpp in Headers */,
42AD25761AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */,
4B22F4AC1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */,
1A119E8C18BDF19200352BAA /* jsb_cocos2dx_builder_auto.hpp in Headers */,
4BE089E51ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp in Headers */,
@ -710,7 +691,6 @@
1A119ECC18BDF19200352BAA /* jsb_cocos2dx_extension_manual.h in Headers */,
1A119EF018BDF19200352BAA /* js_bindings_system_functions.h in Headers */,
1A119EDE18BDF19200352BAA /* js_manual_conversions.h in Headers */,
42AD256F1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */,
1A119EFE18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
1AB5E63618D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
1A119EE418BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
@ -814,13 +794,11 @@
0541A7501973876100E45470 /* JavaScriptObjCBridge.mm in Sources */,
1A119EB318BDF19200352BAA /* js_bindings_chipmunk_manual.cpp in Sources */,
1A119EE918BDF19200352BAA /* jsb_opengl_registration.cpp in Sources */,
42AD25731AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */,
1A119EF718BDF19200352BAA /* jsb_websocket.cpp in Sources */,
1A119ED318BDF19200352BAA /* js_bindings_core.cpp in Sources */,
1A119EC118BDF19200352BAA /* js_bindings_ccbreader.cpp in Sources */,
1A119EFB18BDF19200352BAA /* XMLHTTPRequest.cpp in Sources */,
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
42AD256C1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */,
1A119EC518BDF19200352BAA /* jsb_cocos2dx_studio_manual.cpp in Sources */,
1A119E8F18BDF19200352BAA /* jsb_cocos2dx_extension_auto.cpp in Sources */,
1A119ED718BDF19200352BAA /* js_bindings_opengl.cpp in Sources */,
@ -871,7 +849,6 @@
1A119E9C18BDF19200352BAA /* jsb_cocos2dx_spine_auto.cpp in Sources */,
4BE089E41ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp in Sources */,
1A119EF418BDF19200352BAA /* js_bindings_system_registration.cpp in Sources */,
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */,
B38AD56E1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.cpp in Sources */,
1A119EBC18BDF19200352BAA /* cocos2d_specifics.cpp in Sources */,
426390051B0EC1C6004C53A2 /* jsb_cocos2dx_physics3d_manual.cpp in Sources */,
@ -879,7 +856,6 @@
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */,
42AD25741AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */,
BA623E13191A195F00761F37 /* pluginxUTF8.cpp in Sources */,
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
1A119EB818BDF19200352BAA /* js_bindings_chipmunk_registration.cpp in Sources */,

View File

@ -30,7 +30,6 @@
<ClCompile Include="..\manual\cocosbuilder\js_bindings_ccbreader.cpp" />
<ClCompile Include="..\manual\cocostudio\jsb_cocos2dx_studio_conversions.cpp" />
<ClCompile Include="..\manual\cocostudio\jsb_cocos2dx_studio_manual.cpp" />
<ClCompile Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp" />
<ClCompile Include="..\manual\extension\jsb_cocos2dx_extension_manual.cpp" />
<ClCompile Include="..\manual\jsb_event_dispatcher_manual.cpp" />
<ClCompile Include="..\manual\jsb_opengl_functions.cpp" />
@ -72,7 +71,6 @@
<ClInclude Include="..\manual\cocosbuilder\js_bindings_ccbreader.h" />
<ClInclude Include="..\manual\cocostudio\jsb_cocos2dx_studio_conversions.h" />
<ClInclude Include="..\manual\cocostudio\jsb_cocos2dx_studio_manual.h" />
<ClInclude Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.h" />
<ClInclude Include="..\manual\extension\jsb_cocos2dx_extension_manual.h" />
<ClInclude Include="..\manual\jsb_event_dispatcher_manual.h" />
<ClInclude Include="..\manual\jsb_helper.h" />

View File

@ -146,9 +146,6 @@
<ClCompile Include="..\auto\jsb_cocos2dx_experimental.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp">
<Filter>manual\experimental</Filter>
</ClCompile>
<ClCompile Include="..\auto\jsb_cocos2dx_physics3d_auto.cpp">
<Filter>auto</Filter>
</ClCompile>
@ -280,9 +277,6 @@
<ClInclude Include="..\auto\jsb_cocos2dx_experimental.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\experimental\jsb_cocos2dx_experimental_manual.h">
<Filter>manual\experimental</Filter>
</ClInclude>
<ClInclude Include="..\auto\jsb_cocos2dx_physics3d_auto.hpp">
<Filter>auto</Filter>
</ClInclude>

View File

@ -36,7 +36,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocosbuilder\js_bindings_ccbreader.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocostudio\jsb_cocos2dx_studio_conversions.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocostudio\jsb_cocos2dx_studio_manual.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\extension\jsb_cocos2dx_extension_manual.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\jsb_event_dispatcher_manual.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\jsb_helper.h" />
@ -80,7 +79,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocosbuilder\js_bindings_ccbreader.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocostudio\jsb_cocos2dx_studio_conversions.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\cocostudio\jsb_cocos2dx_studio_manual.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\extension\jsb_cocos2dx_extension_manual.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\jsb_event_dispatcher_manual.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\jsb_opengl_functions.cpp" />

View File

@ -125,9 +125,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_experimental.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.h">
<Filter>manual\experimental</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.hpp">
<Filter>auto</Filter>
</ClInclude>
@ -238,9 +235,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_experimental.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\manual\experimental\jsb_cocos2dx_experimental_manual.cpp">
<Filter>manual\experimental</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\auto\jsb_cocos2dx_physics3d_auto.cpp">
<Filter>auto</Filter>
</ClCompile>

View File

@ -9,10 +9,8 @@
#include "jsb_cocos2dx_spine_auto.hpp"
#include "jsb_cocos2dx_3d_auto.hpp"
#include "jsb_cocos2dx_3d_extension_auto.hpp"
#include "jsb_cocos2dx_experimental.hpp"
#include "jsb_cocos2dx_physics3d_auto.hpp"
#include "physics3d/jsb_cocos2dx_physics3d_manual.h"
#include "experimental/jsb_cocos2dx_experimental_manual.h"
#include "3d/jsb_cocos2dx_3d_manual.h"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "cocostudio/jsb_cocos2dx_studio_manual.h"
@ -116,9 +114,6 @@ bool AppDelegate::applicationDidFinishLaunching()
sc->addRegisterCallback(register_all_cocos2dx_3d_manual);
sc->addRegisterCallback(register_all_cocos2dx_3d_extension);
sc->addRegisterCallback(register_all_cocos2dx_experimental);
sc->addRegisterCallback(register_all_cocos2dx_experimental_manual);
sc->addRegisterCallback(register_all_cocos2dx_physics3d);
sc->addRegisterCallback(register_all_cocos2dx_physics3d_manual);

View File

@ -22,12 +22,12 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h %(cocosdir)s/cocos/2d/SpritePolygonCache.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool SpritePolygonCache Properties Material Technique RenderState Pass
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool Properties Material Technique RenderState Pass
classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram
@ -39,7 +39,7 @@ classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame
# functions from all classes.
skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserData getGLServerState .*schedule setContentSize setAnchorPoint setColor pause resume setAdditionalTransform convertToWorldSpace],
Sprite::[getQuad ^setPosition$],
Sprite::[getQuad ^setPosition$ create setPolygonInfo initWithPolygon getPolygonInfo],
NodeGrid::[setGrid],
SpriteBatchNode::[getDescendants],
MotionStreak::[draw update],
@ -103,7 +103,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
CardinalSpline.*::[create actionWithDuration setPoints initWithDuration],
Scheduler::[pause resume ^unschedule$ unscheduleUpdate unscheduleAllForTarget schedule isTargetPaused isScheduled],
TextureCache::[addPVRTCImage],
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener],
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener operator.+],
FileUtils::[getFileData getDataFromFile setFilenameLookupDictionary destroyInstance getFullPathCache],
Application::[^application.* ^run$ getCurrentLanguageCode setAnimationInterval],
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
@ -136,7 +136,6 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
BillBoard::[*],
Camera::[unproject isVisibleInFrustum],
ClippingNode::[init],
SpritePolygonCache::[addSpritePolygonCache getSpritePolygonCache],
RenderState::[setStateBlock]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
@ -183,7 +182,7 @@ base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool SpritePolygonCache
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -1,60 +0,0 @@
[cocos2dx_experimental]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_experimental
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = ccexp
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/2d/SpritePolygon.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = SpritePolygon
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = SpritePolygon::[create initWithVerts initWithRect initWithPoly2tri initWithCache]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -144,7 +144,6 @@ def main():
'cocos2dx_3d_ext.ini' : ('cocos2dx_3d_extension', 'jsb_cocos2dx_3d_extension_auto'), \
'cocos2dx_experimental_webView.ini' : ('cocos2dx_experimental_webView', 'jsb_cocos2dx_experimental_webView_auto'), \
'cocos2dx_experimental_video.ini' : ('cocos2dx_experimental_video', 'jsb_cocos2dx_experimental_video_auto'), \
'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'jsb_cocos2dx_experimental'), \
'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'jsb_cocos2dx_physics3d_auto')
}
target = 'spidermonkey'

2
web

@ -1 +1 @@
Subproject commit 9e68d341941b40c8027e974d8888d37ed15a1a7b
Subproject commit 71c5db165e2fb84ac0203889b23286904296ef09