mirror of https://github.com/axmolengine/axmol.git
Clean up manual bindings code, remove JS_THIS_OBJECT and JS_SET_RVAL
This commit is contained in:
parent
69b2b5720b
commit
c202834312
|
@ -1661,7 +1661,6 @@ bool JSBDebug_enterNestedEventLoop(JSContext* cx, unsigned argc, jsval* vp)
|
|||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
args.rval().set(UINT_TO_JSVAL(s_nestedLoopLevel));
|
||||
// JS_SET_RVAL(cx, vp, UINT_TO_JSVAL(s_nestedLoopLevel));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1672,11 +1671,9 @@ bool JSBDebug_exitNestedEventLoop(JSContext* cx, unsigned argc, jsval* vp)
|
|||
--s_nestedLoopLevel;
|
||||
} else {
|
||||
args.rval().set(UINT_TO_JSVAL(0));
|
||||
// JS_SET_RVAL(cx, vp, UINT_TO_JSVAL(0));
|
||||
return true;
|
||||
}
|
||||
args.rval().setUndefined();
|
||||
// JS_SET_RVAL(cx, vp, UINT_TO_JSVAL(s_nestedLoopLevel));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1684,7 +1681,6 @@ bool JSBDebug_getEventLoopNestLevel(JSContext* cx, unsigned argc, jsval* vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
args.rval().set(UINT_TO_JSVAL(s_nestedLoopLevel));
|
||||
// JS_SET_RVAL(cx, vp, UINT_TO_JSVAL(s_nestedLoopLevel));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -78,7 +78,7 @@ void JSPROXY_CCPhysicsSprite_finalize(JSFreeOp *fop, JSObject *obj)
|
|||
// Ret value: BOOL (b)
|
||||
bool JSPROXY_CCPhysicsSprite_isDirty(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
@ -94,7 +94,7 @@ bool JSPROXY_CCPhysicsSprite_isDirty(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: cpBody* (N/A)
|
||||
bool JSPROXY_CCPhysicsSprite_getCPBody(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
@ -111,7 +111,7 @@ bool JSPROXY_CCPhysicsSprite_getCPBody(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
// Ret value: BOOL (b)
|
||||
bool JSPROXY_CCPhysicsSprite_ignoreBodyRotation(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
@ -126,15 +126,13 @@ bool JSPROXY_CCPhysicsSprite_ignoreBodyRotation(JSContext *cx, uint32_t argc, js
|
|||
// Arguments: cpBody*
|
||||
// Ret value: void (None)
|
||||
bool JSPROXY_CCPhysicsSprite_setCPBody_(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
cpBody* arg0 = nullptr;
|
||||
|
||||
ok &= jsval_to_opaque( cx, args.get(0), (void**)&arg0 );
|
||||
|
@ -148,13 +146,12 @@ bool JSPROXY_CCPhysicsSprite_setCPBody_(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
// Arguments: BOOL
|
||||
// Ret value: void (None)
|
||||
bool JSPROXY_CCPhysicsSprite_setIgnoreBodyRotation_(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
PhysicsSprite* real = (PhysicsSprite *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool arg0 = JS::ToBoolean( args.get(0) );
|
||||
|
||||
real->setIgnoreBodyRotation((bool)arg0);
|
||||
|
@ -219,14 +216,13 @@ bool JSB_CCPhysicsDebugNode_debugNodeForCPSpace__static(JSContext *cx, uint32_t
|
|||
// Arguments: cpSpace*
|
||||
// Ret value: void (None)
|
||||
bool JSB_CCPhysicsDebugNode_setSpace_(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(jsthis);
|
||||
PhysicsDebugNode* real = (PhysicsDebugNode *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
|
||||
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpSpace* arg0 = nullptr;
|
||||
|
||||
|
@ -242,15 +238,13 @@ bool JSB_CCPhysicsDebugNode_setSpace_(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: cpSpace* (N/A)
|
||||
bool JSB_CCPhysicsDebugNode_space(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(jsthis);
|
||||
PhysicsDebugNode* real = (PhysicsDebugNode *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, real)
|
||||
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
|
||||
cpSpace* ret_val;
|
||||
|
||||
ret_val = real->getSpace();
|
||||
|
||||
jsval ret_jsval = opaque_to_jsval( cx, ret_val );
|
||||
args.rval().set(ret_jsval);
|
||||
|
||||
|
@ -956,10 +950,6 @@ bool __jsb_cpSpace_addCollisionHandler(JSContext *cx, jsval *vp, jsval *argvp, c
|
|||
ok &= jsval_to_int(cx, JS::RootedValue(cx, *argvp++), (int32_t*) &handler->typeA );
|
||||
ok &= jsval_to_int(cx, JS::RootedValue(cx, *argvp++), (int32_t*) &handler->typeB );
|
||||
|
||||
// this is no longer passed, so "this" is going to be "this".
|
||||
// ok &= JS_ValueToObject(cx, *argvp++, &handler->jsthis );
|
||||
handler->jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
|
||||
handler->begin = argvp->toObjectOrNull();
|
||||
argvp++;
|
||||
handler->pre = argvp->toObjectOrNull();
|
||||
|
@ -1019,7 +1009,6 @@ bool JSB_cpSpaceAddCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JSB_PRECONDITION2(argc==7, cx, false, "Invalid number of arguments");
|
||||
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
// args
|
||||
|
@ -1035,9 +1024,9 @@ bool JSB_cpSpaceAddCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpSpace_addCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==6, cx, false, "Invalid number of arguments");
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
void *handle = proxy->handle;
|
||||
|
||||
|
@ -1047,7 +1036,8 @@ bool JSB_cpSpace_addCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpSpace_setDefaultCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==4, cx, false, "Invalid number of arguments");
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*) proxy->handle;
|
||||
|
||||
|
@ -1058,7 +1048,6 @@ bool JSB_cpSpace_setDefaultCollisionHandler(JSContext *cx, uint32_t argc, jsval
|
|||
handler->typeB = 0;
|
||||
handler->jsthis = jsthis;
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
handler->begin = args.get(0).toObjectOrNull();
|
||||
handler->pre = args.get(1).toObjectOrNull();
|
||||
handler->post = args.get(2).toObjectOrNull();
|
||||
|
@ -1177,7 +1166,7 @@ bool JSB_cpSpace_removeCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JSB_PRECONDITION2(argc==2, cx, false, "Invalid number of arguments");
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
|
@ -1192,11 +1181,10 @@ bool JSB_cpSpace_removeCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
// Ret value: cpBody*
|
||||
bool JSB_cpSpace_addBody(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpBody* arg1 = nullptr;
|
||||
|
||||
|
@ -1219,11 +1207,10 @@ bool JSB_cpSpace_addBody(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: cpConstraint*
|
||||
bool JSB_cpSpace_addConstraint(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpConstraint* arg1 = nullptr;
|
||||
|
||||
|
@ -1246,11 +1233,10 @@ bool JSB_cpSpace_addConstraint(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: cpShape*
|
||||
bool JSB_cpSpace_addShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpShape* arg1 = nullptr;
|
||||
|
||||
|
@ -1273,11 +1259,10 @@ bool JSB_cpSpace_addShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: cpShape*
|
||||
bool JSB_cpSpace_addStaticShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpShape* arg1 = nullptr;
|
||||
|
||||
|
@ -1302,11 +1287,10 @@ bool JSB_cpSpace_addStaticShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: void
|
||||
bool JSB_cpSpace_removeBody(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpBody* arg1 = nullptr;
|
||||
|
||||
|
@ -1325,11 +1309,10 @@ bool JSB_cpSpace_removeBody(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: void
|
||||
bool JSB_cpSpace_removeConstraint(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpConstraint* arg1 = nullptr;
|
||||
|
||||
|
@ -1348,11 +1331,10 @@ bool JSB_cpSpace_removeConstraint(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: void
|
||||
bool JSB_cpSpace_removeShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpShape* arg1 = nullptr;
|
||||
|
||||
|
@ -1371,11 +1353,10 @@ bool JSB_cpSpace_removeShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
// Ret value: void
|
||||
bool JSB_cpSpace_removeStaticShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* arg0 = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
cpShape* arg1 = nullptr;
|
||||
|
||||
|
@ -1393,10 +1374,10 @@ bool JSB_cpSpace_removeStaticShape(JSContext *cx, uint32_t argc, jsval *vp) {
|
|||
#pragma mark segmentQueryFirst function
|
||||
|
||||
bool JSB_cpSpace_segmentQueryFirst(JSContext *cx, uint32_t argc, jsval *vp){
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
cpVect start;
|
||||
cpVect end;
|
||||
|
@ -1430,10 +1411,10 @@ bool JSB_cpSpace_segmentQueryFirst(JSContext *cx, uint32_t argc, jsval *vp){
|
|||
#pragma mark nearestPointQueryNearest function
|
||||
|
||||
bool JSB_cpSpace_nearestPointQueryNearest(JSContext *cx, uint32_t argc, jsval *vp){
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*) proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
cpVect point;
|
||||
double maxDistance = 0;
|
||||
|
@ -1681,11 +1662,10 @@ void JSB_cpSpace_each_func(T* cpObject, void *data)
|
|||
bool JSB_cpSpace_eachShape(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1702,11 +1682,10 @@ bool JSB_cpSpace_eachShape(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpSpace_eachBody(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1723,11 +1702,10 @@ bool JSB_cpSpace_eachBody(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpSpace_eachConstraint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpSpace* space = (cpSpace*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1802,11 +1780,10 @@ void JSB_cpBody_each_func(cpBody* body, T* cpObject, void* data)
|
|||
bool JSB_cpBody_eachShape(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpBody* body = (cpBody*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1823,11 +1800,10 @@ bool JSB_cpBody_eachShape(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpBody_eachConstraint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpBody* body = (cpBody*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1844,11 +1820,10 @@ bool JSB_cpBody_eachConstraint(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpBody_eachArbiter(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc == 1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
struct jsb_c_proxy_s *proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
cpBody* body = (cpBody*)proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSB_cp_each_UserData *data = (JSB_cp_each_UserData*)malloc(sizeof(JSB_cp_each_UserData));
|
||||
if (!data)
|
||||
|
@ -1909,14 +1884,13 @@ bool JSB_cpArbiterGetBodies(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpArbiter_getBodies(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==0, cx, false, "Invalid number of arguments");
|
||||
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
JSB_PRECONDITION( proxy, "Invalid private object");
|
||||
void *handle = proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
return __jsb_cpArbiter_getBodies(cx, args, (cpArbiter*)handle, 1);
|
||||
}
|
||||
|
||||
|
@ -1965,12 +1939,12 @@ bool JSB_cpArbiterGetShapes(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpArbiter_getShapes(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==0, cx, false, "Invalid number of arguments");
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
void *handle = proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
return __jsb_cpArbiter_getShapes(cx, args, (cpArbiter*)handle, 1);
|
||||
}
|
||||
|
||||
|
@ -2038,12 +2012,12 @@ bool JSB_cpBodyGetUserData(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpBody_getUserData(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==0, cx, false, "Invalid number of arguments");
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
void *handle = proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
return __jsb_cpBody_getUserData(cx, args, (cpBody*)handle);
|
||||
}
|
||||
|
||||
|
@ -2081,12 +2055,12 @@ bool JSB_cpBodySetUserData(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool JSB_cpBody_setUserData(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
void *handle = proxy->handle;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
return __jsb_cpBody_setUserData(cx, vp, args.array(), (cpBody*)handle);
|
||||
}
|
||||
|
||||
|
@ -2205,11 +2179,11 @@ void JSB_cpBase_finalize(JSFreeOp *fop, JSObject *obj)
|
|||
|
||||
bool JSB_cpBase_getHandle(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
JSB_PRECONDITION2(argc==0, cx, false, "Invalid number of arguments");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
struct jsb_c_proxy_s* proxy = jsb_get_c_proxy_for_jsobject(jsthis);
|
||||
void *handle = proxy->handle;
|
||||
|
||||
|
@ -2220,12 +2194,11 @@ bool JSB_cpBase_getHandle(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
|
||||
bool JSB_cpBase_setHandle(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject* jsthis = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject jsthis(cx, args.thisv().toObjectOrNull());
|
||||
JSB_PRECONDITION( jsthis, "Invalid jsthis object");
|
||||
JSB_PRECONDITION2(argc==1, cx, false, "Invalid number of arguments");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
void *handle = nullptr;
|
||||
bool ok = jsval_to_opaque(cx, args.get(0), &handle);
|
||||
JSB_PRECONDITION( ok, "Invalid parsing arguments");
|
||||
|
|
|
@ -213,7 +213,6 @@ bool js_cocos2dx_EventTouch_getTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
++i;
|
||||
}
|
||||
|
||||
// JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsretArr));
|
||||
args.rval().set(OBJECT_TO_JSVAL(jsretArr));
|
||||
return true;
|
||||
}
|
||||
|
@ -226,16 +225,14 @@ bool js_cocos2dx_EventTouch_getTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_EventTouch_setTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
// jsval *argv = JS_ARGV(cx, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::EventTouch* cobj = (cocos2d::EventTouch *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventTouch_setTouches : Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
std::vector<Touch*> arg0;
|
||||
JS::RootedObject jsobj(cx, args.get(0).toObjectOrNull());
|
||||
// ok = argv->isObject() && JS_ValueToObject( cx, JS::RootedValue(cx, *argv), &jsobj );
|
||||
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
|
||||
JSB_PRECONDITION3( jsobj && JS_IsArrayObject( cx, jsobj), cx, false, "Object must be an array");
|
||||
|
||||
|
@ -256,7 +253,6 @@ bool js_cocos2dx_EventTouch_setTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
}
|
||||
}
|
||||
cobj->setTouches(arg0);
|
||||
// args.rval().setUndefined();
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
@ -750,12 +746,11 @@ static bool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CallFunc_initWithFunction(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc >= 1 && argc <= 3) {
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
CallFuncN *action = (cocos2d::CallFuncN *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2(action, cx, false, "Invalid Native Object");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
std::shared_ptr<JSCallbackWrapper> tmpCobj(new JSCallbackWrapper());
|
||||
|
||||
|
@ -1564,7 +1559,7 @@ bool js_cocos2dx_CCNode_scheduleUpdate(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CCScheduler_unscheduleAllSelectorsForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
|
@ -1603,8 +1598,7 @@ bool js_CCScheduler_scheduleUpdateForTarget(JSContext *cx, uint32_t argc, jsval
|
|||
if (argc >= 1) {
|
||||
bool ok = true;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler *sched = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
|
||||
|
@ -1681,7 +1675,7 @@ bool js_CCScheduler_scheduleUpdateForTarget(JSContext *cx, uint32_t argc, jsval
|
|||
bool js_CCScheduler_unscheduleUpdateForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
|
@ -1896,7 +1890,7 @@ bool js_CCScheduler_schedule(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_CCScheduler_unscheduleCallbackForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
|
@ -1962,7 +1956,7 @@ bool js_cocos2dx_CCScheduler_unscheduleAllCallbacksWithMinPriority(JSContext *cx
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -1984,7 +1978,7 @@ bool js_cocos2dx_CCScheduler_unscheduleAllCallbacksWithMinPriority(JSContext *cx
|
|||
bool js_cocos2dx_CCScheduler_pauseTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler *sched = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
|
||||
|
@ -2010,7 +2004,7 @@ bool js_cocos2dx_CCScheduler_pauseTarget(JSContext *cx, uint32_t argc, jsval *vp
|
|||
bool js_cocos2dx_CCScheduler_resumeTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler *sched = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
|
||||
|
@ -2036,7 +2030,7 @@ bool js_cocos2dx_CCScheduler_resumeTarget(JSContext *cx, uint32_t argc, jsval *v
|
|||
bool js_cocos2dx_CCScheduler_isTargetPaused(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -2054,7 +2048,6 @@ bool js_cocos2dx_CCScheduler_isTargetPaused(JSContext *cx, uint32_t argc, jsval
|
|||
}
|
||||
}
|
||||
} while (0);
|
||||
// JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
args.rval().set(BOOLEAN_TO_JSVAL(ret));
|
||||
return true;
|
||||
}
|
||||
|
@ -2168,7 +2161,7 @@ bool js_cocos2dx_Node_cleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CCNode_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
bool ok = true;
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
||||
|
@ -2200,7 +2193,7 @@ bool js_cocos2dx_CCNode_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CCNode_setContentSize(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
bool ok = true;
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
||||
|
@ -2232,7 +2225,7 @@ bool js_cocos2dx_CCNode_setContentSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CCNode_setAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
bool ok = true;
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
||||
|
@ -2265,7 +2258,7 @@ bool js_cocos2dx_CCNode_setColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setColor : Invalid Native Object");
|
||||
|
@ -2769,7 +2762,7 @@ bool js_BezierActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
T* cobj = (T *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Bezier_initWithDuration : Invalid Native Object");
|
||||
|
@ -2902,7 +2895,7 @@ template<class T>
|
|||
bool js_CatmullRomActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
T* cobj = (T *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CatmullRom_initWithDuration : Invalid Native Object");
|
||||
|
@ -2918,7 +2911,6 @@ bool js_CatmullRomActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *
|
|||
for( int i=0; i < num;i++) {
|
||||
arg1->addControlPoint(arr[i]);
|
||||
}
|
||||
|
||||
|
||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CatmullRom_initWithDuration : Error processing arguments");
|
||||
bool ret = cobj->initWithDuration(arg0, arg1);
|
||||
|
@ -2964,7 +2956,7 @@ bool js_cocos2dx_CardinalSplineTo_initWithDuration(JSContext *cx, uint32_t argc,
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::CardinalSplineTo* cobj = (cocos2d::CardinalSplineTo *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CardinalSplineTo_initWithDuration : Invalid Native Object");
|
||||
|
@ -3925,15 +3917,13 @@ bool js_cocos2dx_CCLayer_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool js_cocos2dx_CCTMXLayer_getTileFlagsAt(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj;
|
||||
TMXLayer* cobj;
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cobj = (TMXLayer*)(proxy ? proxy->ptr : NULL);
|
||||
TMXLayer* cobj = (TMXLayer*)(proxy ? proxy->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
if (argc == 1)
|
||||
{
|
||||
bool ok = true;
|
||||
TMXTileFlags flags;
|
||||
Point arg0;
|
||||
ok &= jsval_to_ccpoint(cx, args.get(0), &arg0);
|
||||
|
@ -3990,7 +3980,7 @@ bool js_cocos2dx_CCFileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t a
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4011,7 +4001,7 @@ bool js_cocos2dx_CCFileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4050,7 +4040,7 @@ bool js_cocos2dx_CCFileUtils_getDataFromFile(JSContext *cx, uint32_t argc, jsval
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4123,7 +4113,7 @@ bool js_cocos2dx_CCFileUtils_writeDataToFile(JSContext *cx, uint32_t argc, jsval
|
|||
bool js_cocos2dx_CCFileUtils_getSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4143,7 +4133,7 @@ static bool js_cocos2dx_FileUtils_createDictionaryWithContentsOfFile(JSContext *
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4166,7 +4156,7 @@ bool js_cocos2dx_CCGLProgram_setUniformLocationWith4f(JSContext *cx, uint32_t ar
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4211,7 +4201,7 @@ bool js_cocos2dx_CCGLProgram_setUniformLocationWithMatrixfvUnion(JSContext *cx,
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4328,7 +4318,7 @@ bool js_cocos2dx_CCGLProgram_createWithString(JSContext *cx, uint32_t argc, jsva
|
|||
bool js_cocos2dx_CCGLProgram_getProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -4416,12 +4406,13 @@ bool js_cocos2dx_GLProgramState_setUniformVec4(JSContext *cx, uint32_t argc, jsv
|
|||
return false;
|
||||
}
|
||||
|
||||
#define js_cocos2dx_CCCamera_getXYZ(funcName) \
|
||||
bool ok = true; \
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp); \
|
||||
#define js_cocos2dx_CCCamera_getXYZ(funcName) \
|
||||
bool ok = true; \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); \
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj); \
|
||||
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); \
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object"); \
|
||||
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL); \
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object"); \
|
||||
if (argc == 0) { \
|
||||
float x; \
|
||||
float y; \
|
||||
|
@ -4438,13 +4429,13 @@ bool js_cocos2dx_GLProgramState_setUniformVec4(JSContext *cx, uint32_t argc, jsv
|
|||
JS_DefineProperty(cx, tmp, "z", DOUBLE_TO_JSVAL(z), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT); \
|
||||
\
|
||||
if (ok) { \
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp)); \
|
||||
return true; \
|
||||
args.rval().set(OBJECT_TO_JSVAL(tmp)); \
|
||||
return true; \
|
||||
} \
|
||||
} while (false); \
|
||||
\
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL); \
|
||||
return true; \
|
||||
args.rval().setUndefined(); \
|
||||
return true; \
|
||||
} \
|
||||
\
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0); \
|
||||
|
@ -4455,7 +4446,7 @@ bool js_cocos2dx_GLProgramState_setUniformVec4(JSContext *cx, uint32_t argc, jsv
|
|||
bool js_cocos2dx_SpriteBatchNode_getDescendants(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_getDescendants : Invalid Native Object");
|
||||
|
@ -4483,7 +4474,7 @@ bool js_cocos2dx_NodeGrid_setGrid(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::NodeGrid* cobj = (cocos2d::NodeGrid *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_NodeGrid_setGrid : Invalid Native Object");
|
||||
|
@ -4758,7 +4749,7 @@ bool js_cocos2dx_Label_setTTFConfig(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setTTFConfig : Invalid Native Object");
|
||||
|
@ -4784,9 +4775,8 @@ bool js_cocos2dx_RenderTexture_saveToFile(JSContext *cx, uint32_t argc, jsval *v
|
|||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
|
||||
JSObject *obj = NULL;
|
||||
cocos2d::RenderTexture* cobj = NULL;
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_saveToFile : Invalid Native Object");
|
||||
|
|
|
@ -95,8 +95,7 @@ bool js_cocos2dx_CCBAnimationManager_animationCompleteCallback(JSContext *cx, ui
|
|||
{
|
||||
if (argc >= 1) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *p = jsb_get_js_proxy(obj);
|
||||
cocosbuilder::CCBAnimationManager *node = (cocosbuilder::CCBAnimationManager *)(p ? p->ptr : NULL);
|
||||
|
||||
|
@ -121,11 +120,9 @@ bool js_cocos2dx_CCBReader_readNodeGraphFromFile(JSContext *cx, uint32_t argc, j
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj;
|
||||
cocosbuilder::CCBReader* cobj;
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *p = jsb_get_js_proxy(obj);
|
||||
cobj = (cocosbuilder::CCBReader *)(p ? p->ptr : NULL);
|
||||
cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(p ? p->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
|
||||
if (argc == 2) {
|
||||
|
@ -204,11 +201,9 @@ bool js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile(JSContext *cx, uint3
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj;
|
||||
cocosbuilder::CCBReader* cobj;
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *p = jsb_get_js_proxy(obj);
|
||||
cobj = (cocosbuilder::CCBReader *)(p ? p->ptr : NULL);
|
||||
cocosbuilder::CCBReader* cobj = (cocosbuilder::CCBReader *)(p ? p->ptr : NULL);
|
||||
TEST_NATIVE_OBJECT(cx, cobj)
|
||||
|
||||
if (argc == 2) {
|
||||
|
|
|
@ -102,14 +102,13 @@ void JSArmatureWrapper::frameCallbackFunc(cocostudio::Bone *bone, const std::str
|
|||
|
||||
static bool js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if (argc > 0) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.get(0).isNull()) {
|
||||
cobj->setMovementEventCallFunc(nullptr);
|
||||
|
||||
|
@ -149,14 +148,13 @@ static bool js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(JSContext *cx
|
|||
|
||||
static bool js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if (argc > 0) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
if (args.get(0).isNull()) {
|
||||
cobj->setFrameEventCallFunc(nullptr);
|
||||
|
||||
|
@ -197,14 +195,13 @@ static bool js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(JSContext *cx, u
|
|||
|
||||
static bool jsb_Animation_addArmatureFileInfoAsyncCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ArmatureDataManager* cobj = (cocostudio::ArmatureDataManager *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if (argc == 3) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSArmatureWrapper *tmpObj = new JSArmatureWrapper();
|
||||
tmpObj->autorelease();
|
||||
|
||||
|
@ -249,7 +246,7 @@ static bool js_cocos2dx_studio_ActionManagerEx_initWithDictionaryEx(JSContext *c
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ActionManagerEx* cobj = (cocostudio::ActionManagerEx *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_studio_ActionManagerEx_initWithDictionaryEx : Invalid Native Object");
|
||||
|
@ -284,12 +281,12 @@ static bool js_cocos2dx_studio_ActionManagerEx_initWithDictionaryEx(JSContext *c
|
|||
|
||||
bool js_cocos2dx_studio_ColliderBody_getCalculatedVertexList(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
cocostudio::ColliderBody* cobj = (cocostudio::ColliderBody *)(proxy ? proxy->ptr : nullptr);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
const std::vector<cocos2d::Point>& ret = cobj->getCalculatedVertexList();
|
||||
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 0));
|
||||
jsval jsret;
|
||||
|
|
|
@ -12,13 +12,13 @@ using namespace cocos2d;
|
|||
|
||||
static bool jsb_cocos2dx_experimental_ui_VideoPlayer_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
experimental::ui::VideoPlayer* cobj = (experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if(argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->addEventListener([=](Ref* widget, experimental::ui::VideoPlayer::EventType type)->void{
|
||||
jsval arg[2];
|
||||
|
|
|
@ -11,13 +11,13 @@ using namespace cocos2d;
|
|||
|
||||
static bool jsb_cocos2dx_experimental_webView_setOnShouldStartLoading(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
experimental::ui::WebView* cobj = (experimental::ui::WebView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if(argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnShouldStartLoading([=](experimental::ui::WebView *sender, const std::string &url)->bool{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
|
@ -45,13 +45,13 @@ static bool jsb_cocos2dx_experimental_webView_setOnShouldStartLoading(JSContext
|
|||
|
||||
static bool jsb_cocos2dx_experimental_webView_setOnDidFinishLoading(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
experimental::ui::WebView* cobj = (experimental::ui::WebView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if(argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnDidFinishLoading([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
|
@ -78,13 +78,13 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFinishLoading(JSContext *c
|
|||
|
||||
static bool jsb_cocos2dx_experimental_webView_setOnDidFailLoading(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
experimental::ui::WebView* cobj = (experimental::ui::WebView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if(argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnDidFailLoading([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
|
@ -111,13 +111,13 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFailLoading(JSContext *cx,
|
|||
|
||||
static bool jsb_cocos2dx_experimental_webView_setOnJSCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
experimental::ui::WebView* cobj = (experimental::ui::WebView *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if(argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnJSCallback([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
|
|
|
@ -104,12 +104,12 @@ void js_cocos2dx_GLNode_finalize(JSFreeOp *fop, JSObject *obj) {
|
|||
|
||||
static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
cocos2d::GLNode *nobj = new cocos2d::GLNode();
|
||||
js_proxy_t* p = jsb_new_proxy(nobj, obj);
|
||||
nobj->autorelease();
|
||||
JS::AddNamedObjectRoot(cx, &p->obj, "GLNode");
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ bool klass::_js_constructor(JSContext *cx, unsigned argc, jsval *vp)
|
|||
|
||||
#define JS_BINDED_FUNC_IMPL(klass, name) \
|
||||
static bool klass##_func_##name(JSContext *cx, unsigned argc, jsval *vp) { \
|
||||
JSObject* thisObj = JS_THIS_OBJECT(cx, vp); \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JS::RootedObject thisObj(cx, args.thisv().toObjectOrNull()); \
|
||||
klass* obj = (klass*)JS_GetPrivate(thisObj); \
|
||||
if (obj) { \
|
||||
return obj->name(cx, argc, vp); \
|
||||
|
@ -82,7 +83,7 @@ bool _js_get_##propName(JSContext *cx, const JS::CallArgs& args)
|
|||
#define JS_BINDED_PROP_GET_IMPL(klass, propName) \
|
||||
static bool _js_get_##klass##_##propName(JSContext *cx, unsigned argc, jsval *vp) { \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JSObject* obj = args.thisv().toObjectOrNull(); \
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); \
|
||||
klass* cobj = (klass*)JS_GetPrivate(obj); \
|
||||
if (cobj) { \
|
||||
return cobj->_js_get_##propName(cx, args); \
|
||||
|
@ -98,7 +99,7 @@ bool _js_set_##propName(JSContext *cx, const JS::CallArgs& args)
|
|||
#define JS_BINDED_PROP_SET_IMPL(klass, propName) \
|
||||
static bool _js_set_##klass##_##propName(JSContext *cx, unsigned argc, jsval *vp) { \
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \
|
||||
JSObject* obj = args.thisv().toObjectOrNull(); \
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); \
|
||||
klass* cobj = (klass*)JS_GetPrivate(obj); \
|
||||
if (cobj) { \
|
||||
return cobj->_js_set_##propName(cx, args); \
|
||||
|
|
|
@ -34,7 +34,8 @@ THE SOFTWARE.
|
|||
|
||||
static bool jsb_cocos2dx_navmesh_NavMeshAgent_move(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, 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::NavMeshAgent* cobj = (cocos2d::NavMeshAgent *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2(cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -42,7 +43,6 @@ static bool jsb_cocos2dx_navmesh_NavMeshAgent_move(JSContext *cx, uint32_t argc,
|
|||
bool ok = true;
|
||||
|
||||
if (argc == 1){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
cocos2d::Vec3 arg0;
|
||||
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "jsb_cocos2dx_navmesh_NavMeshAgent_move : Error processing arguments");
|
||||
|
@ -51,7 +51,6 @@ static bool jsb_cocos2dx_navmesh_NavMeshAgent_move(JSContext *cx, uint32_t argc,
|
|||
}
|
||||
|
||||
if (argc == 2){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
cocos2d::Vec3 arg0;
|
||||
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, false, "jsb_cocos2dx_navmesh_NavMeshAgent_move : Error processing arguments");
|
||||
|
|
|
@ -193,7 +193,7 @@ bool js_cocos2dx_SocketIO_send(JSContext* cx, uint32_t argc, jsval* vp)
|
|||
CCLOG("JSB SocketIO.send method called");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -223,7 +223,7 @@ bool js_cocos2dx_SocketIO_emit(JSContext* cx, uint32_t argc, jsval* vp)
|
|||
CCLOG("JSB SocketIO.emit method called");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -257,7 +257,7 @@ bool js_cocos2dx_SocketIO_disconnect(JSContext* cx, uint32_t argc, jsval* vp)
|
|||
CCLOG("JSB SocketIO.disconnect method called");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -340,7 +340,7 @@ bool js_cocos2dx_SocketIO_on(JSContext* cx, uint32_t argc, jsval* vp)
|
|||
CCLOG("JSB SocketIO.on method called");
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SIOClient* cobj = (SIOClient *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
|
|
@ -181,7 +181,7 @@ void js_cocos2dx_WebSocket_finalize(JSFreeOp *fop, JSObject *obj) {
|
|||
bool js_cocos2dx_extension_WebSocket_send(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -235,7 +235,7 @@ bool js_cocos2dx_extension_WebSocket_send(JSContext *cx, uint32_t argc, jsval *v
|
|||
|
||||
bool js_cocos2dx_extension_WebSocket_close(JSContext *cx, uint32_t argc, jsval *vp){
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
|
|
@ -292,7 +292,7 @@ bool jsb_cocos2dx_spine_findBone(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SkeletonRenderer* cobj = (SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -321,7 +321,7 @@ bool jsb_cocos2dx_spine_findSlot(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SkeletonRenderer* cobj = (SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -349,7 +349,7 @@ bool jsb_cocos2dx_spine_findSlot(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool jsb_cocos2dx_spine_setDebugBones(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SkeletonRenderer* cobj = (SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -368,7 +368,7 @@ bool jsb_cocos2dx_spine_setDebugBones(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
bool jsb_cocos2dx_spine_setDebugSolots(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SkeletonRenderer* cobj = (SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -388,7 +388,7 @@ bool jsb_cocos2dx_spine_getAttachment(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
SkeletonRenderer* cobj = (SkeletonRenderer*)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -419,7 +419,7 @@ bool jsb_cocos2dx_spine_getCurrent(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -461,7 +461,7 @@ bool jsb_cocos2dx_spine_setAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
@ -498,7 +498,7 @@ bool jsb_cocos2dx_spine_addAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
|
|
@ -31,19 +31,18 @@ using namespace cocos2d::ui;
|
|||
|
||||
static bool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
ui::LayoutParameter* cobj = (ui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if (argc == 1) {
|
||||
JS::CallArgs argv = CallArgsFromVp(argc, vp);
|
||||
|
||||
JS::RootedObject tmp(cx);
|
||||
JS::RootedValue jsleft(cx), jstop(cx),jsright(cx),jsbottom(cx);
|
||||
double left, top,right,bottom;
|
||||
bool ok = argv[0].isObject() &&
|
||||
JS_ValueToObject(cx, argv[0], &tmp) &&
|
||||
bool ok = args[0].isObject() &&
|
||||
JS_ValueToObject(cx, args[0], &tmp) &&
|
||||
JS_GetProperty(cx, tmp, "left", &jsleft) &&
|
||||
JS_GetProperty(cx, tmp, "top", &jstop) &&
|
||||
JS_GetProperty(cx, tmp, "right", &jsright) &&
|
||||
|
@ -60,13 +59,12 @@ static bool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc,
|
|||
return true;
|
||||
}
|
||||
else if (argc == 4) {
|
||||
JS::CallArgs argv = CallArgsFromVp(argc, vp);
|
||||
bool ok = true;
|
||||
double left, top,right,bottom;
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[0]), &left);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[1]), &top);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[2]), &right);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, argv[3]), &bottom);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, args[0]), &left);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, args[1]), &top);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, args[2]), &right);
|
||||
ok &= JS::ToNumber( cx, JS::RootedValue(cx, args[3]), &bottom);
|
||||
|
||||
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
|
||||
|
||||
|
@ -79,13 +77,13 @@ static bool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc,
|
|||
|
||||
static bool js_cocos2dx_LayoutParameter_getMargin(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||
ui::LayoutParameter* cobj = (ui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
|
||||
|
||||
if (argc == 0) {
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject tmp(cx, JS_NewObject(cx, NULL, JS::NullPtr(), JS::NullPtr()));
|
||||
if (!tmp) return false;
|
||||
ui::Margin margin = cobj->getMargin();
|
||||
|
@ -95,7 +93,6 @@ static bool js_cocos2dx_LayoutParameter_getMargin(JSContext *cx, uint32_t argc,
|
|||
JS_DefineProperty(cx, tmp, "bottom", margin.bottom, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||
if (ok)
|
||||
{
|
||||
//JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
args.rval().set(OBJECT_TO_JSVAL(tmp));
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue