diff --git a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id index 01a58f5ea0..9494583445 100644 --- a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -fd1fb139a7505d087883dc9eff612594905edb6c \ No newline at end of file +ea71fe2a7534446c774678ae4ced20de8fcb5ec8 \ No newline at end of file diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index f10ae9da45..fc4c22992f 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -1502,6 +1502,31 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, CCDictionary** ret) { return JS_TRUE; } +JSBool jsval_to_ccaffinetransform(JSContext* cx, jsval v, CCAffineTransform* ret) +{ + JSObject *tmp; + jsval jsa, jsb, jsc, jsd, jstx, jsty; + double a, b, c, d, tx, ty; + JSBool ok = JS_ValueToObject(cx, v, &tmp) && + JS_GetProperty(cx, tmp, "a", &jsa) && + JS_GetProperty(cx, tmp, "b", &jsb) && + JS_GetProperty(cx, tmp, "c", &jsc) && + JS_GetProperty(cx, tmp, "d", &jsd) && + JS_GetProperty(cx, tmp, "tx", &jstx) && + JS_GetProperty(cx, tmp, "ty", &jsty) && + JS_ValueToNumber(cx, jsa, &a) && + JS_ValueToNumber(cx, jsb, &b) && + JS_ValueToNumber(cx, jsc, &c) && + JS_ValueToNumber(cx, jsd, &d) && + JS_ValueToNumber(cx, jstx, &tx) && + JS_ValueToNumber(cx, jsty, &ty); + + JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); + + *ret = CCAffineTransformMake(a, b, c, d, tx, ty); + return JS_TRUE; +} + // From native type to jsval jsval int32_to_jsval( JSContext *cx, int32_t number ) { @@ -1629,6 +1654,24 @@ jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v) { return JSVAL_NULL; } +jsval ccaffinetransform_to_jsval(JSContext* cx, CCAffineTransform& t) +{ + CCLOG("native xxx: a = %f, b = %f, c = %f, d = %f, tx = %f, ty = %f", t.a, t.b, t.c, t.d, t.tx, t.ty); + + JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL); + if (!tmp) return JSVAL_NULL; + JSBool ok = JS_DefineProperty(cx, tmp, "a", DOUBLE_TO_JSVAL(t.a), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "b", DOUBLE_TO_JSVAL(t.b), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "c", DOUBLE_TO_JSVAL(t.c), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "d", DOUBLE_TO_JSVAL(t.d), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "tx", DOUBLE_TO_JSVAL(t.tx), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && + JS_DefineProperty(cx, tmp, "ty", DOUBLE_TO_JSVAL(t.ty), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT); + if (ok) { + return OBJECT_TO_JSVAL(tmp); + } + return JSVAL_NULL; +} + #pragma mark - Debug void SimpleRunLoop::update(float dt) { diff --git a/scripting/javascript/bindings/ScriptingCore.h b/scripting/javascript/bindings/ScriptingCore.h index ccd4686123..d7983aa326 100644 --- a/scripting/javascript/bindings/ScriptingCore.h +++ b/scripting/javascript/bindings/ScriptingCore.h @@ -223,6 +223,7 @@ JSBool jsval_to_ccarray(JSContext* cx, jsval v, CCArray** ret); JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, CCDictionary** ret); JSBool jsval_to_ccacceleration(JSContext* cx,jsval v, CCAcceleration* ret); JSBool jsvals_variadic_to_ccarray( JSContext *cx, jsval *vp, int argc, CCArray** ret); +JSBool jsval_to_ccaffinetransform(JSContext* cx, jsval v, CCAffineTransform* ret); // from native jsval int32_to_jsval( JSContext *cx, int32_t l); @@ -239,6 +240,8 @@ jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v); jsval ccdictionary_to_jsval(JSContext* cx, CCDictionary *dict); jsval ccarray_to_jsval(JSContext* cx, CCArray *arr); jsval ccacceleration_to_jsval(JSContext* cx, CCAcceleration& v); +jsval ccaffinetransform_to_jsval(JSContext* cx, CCAffineTransform& t); + JSObject* NewGlobalObject(JSContext* cx, bool debug = false); JSBool jsStartDebugger(JSContext* cx, unsigned argc, jsval* vp); diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id index 3cfb115626..96425ca67c 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id @@ -1 +1 @@ -62389915a85ebfbc4e1218b1b8e240b1013db859 \ No newline at end of file +6744be4108703e3312906a288a0766316e2dfba6 \ No newline at end of file diff --git a/tools/bindings-generator b/tools/bindings-generator index cc4765d066..1a84b5e452 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit cc4765d066b0997d53e4e8b45b38180716c10318 +Subproject commit 1a84b5e4529b9c37f245953afff8251db7eb9727 diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index a191075349..bea8cfa6b7 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -35,7 +35,7 @@ classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.* # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = CCNode::[.*Transform convertToWindowSpace ^setPosition$ getGrid setGLServerState description getUserObject .*UserData getGLServerState .*schedule], +skip = CCNode::[convertToWindowSpace ^setPosition$ getGrid setGLServerState description getUserObject .*UserData getGLServerState .*schedule], CCSprite::[getQuad displayFrame getBlendFunc ^setPosition$ setBlendFunc setSpriteBatchNode getSpriteBatchNode], CCSpriteBatchNode::[getBlendFunc setBlendFunc], CCMotionStreak::[getBlendFunc setBlendFunc],