From 6730294dbe3f6f4f8c323045ed3ffe832a191224 Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 14:12:04 -0700 Subject: [PATCH 1/7] Generated bindings are a submodule pointing to a separate repository * This allows bindings to be generated by a build server * ... when the Cocos2D-X API changes --- .gitmodules | 3 +++ scripting/javascript/bindings/generated | 1 + 2 files changed, 4 insertions(+) create mode 160000 scripting/javascript/bindings/generated diff --git a/.gitmodules b/.gitmodules index 29442ab901..165d817134 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "tools/cxx-generator"] path = tools/cxx-generator url = git://github.com/funkaster/cxx-generator.git +[submodule "scripting/javascript/bindings/generated"] + path = scripting/javascript/bindings/generated + url = git://github.com/folecr/cocos2dx-autogen-bindings.git diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated new file mode 160000 index 0000000000..cae7ca0ca3 --- /dev/null +++ b/scripting/javascript/bindings/generated @@ -0,0 +1 @@ +Subproject commit cae7ca0ca35ec49f3d8eebe7256f7ae2bb946181 From 2a78f8d1767795956ef7d8e55c6665a6b70a6947 Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 17:09:40 -0700 Subject: [PATCH 2/7] Separate out cocos specific manual type conversions. --- scripting/javascript/bindings/Android.mk | 1 + .../javascript/bindings/CCPhysicsSprite.cpp | 2 +- .../bindings/cocosjs_manual_conversions.cpp | 160 ++++++++++++++++++ .../bindings/cocosjs_manual_conversions.h | 19 +++ ...ings_chipmunk_functions.cpp.REMOVED.git-id | 2 +- .../bindings/js_bindings_chipmunk_manual.cpp | 2 +- .../bindings/js_manual_conversions.cpp | 157 ----------------- .../bindings/js_manual_conversions.h | 18 +- 8 files changed, 185 insertions(+), 176 deletions(-) create mode 100644 scripting/javascript/bindings/cocosjs_manual_conversions.cpp create mode 100644 scripting/javascript/bindings/cocosjs_manual_conversions.h diff --git a/scripting/javascript/bindings/Android.mk b/scripting/javascript/bindings/Android.mk index c11d5781c7..aa362e0fca 100644 --- a/scripting/javascript/bindings/Android.mk +++ b/scripting/javascript/bindings/Android.mk @@ -11,6 +11,7 @@ LOCAL_SRC_FILES := ScriptingCore.cpp \ CCPhysicsSprite.cpp \ cocos2dx.cpp \ js_manual_conversions.cpp \ + cocosjs_manual_conversions.cpp \ js_bindings_chipmunk_manual.cpp \ js_bindings_chipmunk_functions.cpp \ generated/cocos2dx.cpp diff --git a/scripting/javascript/bindings/CCPhysicsSprite.cpp b/scripting/javascript/bindings/CCPhysicsSprite.cpp index a9ab54aac7..92c9080f58 100644 --- a/scripting/javascript/bindings/CCPhysicsSprite.cpp +++ b/scripting/javascript/bindings/CCPhysicsSprite.cpp @@ -21,7 +21,7 @@ #include "CCPhysicsSprite.h" #include "ScriptingCore.h" -#include "js_manual_conversions.h" +#include "cocosjs_manual_conversions.h" using namespace cocos2d; diff --git a/scripting/javascript/bindings/cocosjs_manual_conversions.cpp b/scripting/javascript/bindings/cocosjs_manual_conversions.cpp new file mode 100644 index 0000000000..23618acc86 --- /dev/null +++ b/scripting/javascript/bindings/cocosjs_manual_conversions.cpp @@ -0,0 +1,160 @@ +#include "jsapi.h" +#include "jsfriendapi.h" +#include "ScriptingCore.h" +#include "js_bindings_config.h" +#include "cocosjs_manual_conversions.h" + +#define JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + +using namespace cocos2d; + +JSBool jsval_to_CCPoint( JSContext *cx, jsval vp, CCPoint *ret ) +{ +#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + + JSObject *jsobj; + if( ! JS_ValueToObject( cx, vp, &jsobj ) ) + return JS_FALSE; + + JSB_PRECONDITION( jsobj, "Not a valid JS object"); + + jsval valx, valy; + JSBool ok = JS_TRUE; + ok &= JS_GetProperty(cx, jsobj, "x", &valx); + ok &= JS_GetProperty(cx, jsobj, "y", &valy); + + if( ! ok ) + return JS_FALSE; + + double x, y; + ok &= JS_ValueToNumber(cx, valx, &x); + ok &= JS_ValueToNumber(cx, valy, &y); + + if( ! ok ) + return JS_FALSE; + + ret->x = x; + ret->y = y; + + return JS_TRUE; + +#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + + JSObject *tmp_arg; + if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) + return JS_FALSE; + + JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); + + JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length"); + + *ret = *(CCPoint*)JS_GetArrayBufferViewData( tmp_arg, cx ); + + return JS_TRUE; +#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES +} + + +JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *ret ) +{ +#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + + JSObject *jsobj; + if( ! JS_ValueToObject( cx, vp, &jsobj ) ) + return JS_FALSE; + + JSB_PRECONDITION( jsobj, "Not a valid JS object"); + + jsval valx, valy; + JSBool ok = JS_TRUE; + ok &= JS_GetProperty(cx, jsobj, "x", &valx); + ok &= JS_GetProperty(cx, jsobj, "y", &valy); + + if( ! ok ) + return JS_FALSE; + + double x, y; + ok &= JS_ValueToNumber(cx, valx, &x); + ok &= JS_ValueToNumber(cx, valy, &y); + + if( ! ok ) + return JS_FALSE; + + ret->x = x; + ret->y = y; + + return JS_TRUE; + +#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + + JSObject *tmp_arg; + if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) + return JS_FALSE; + + JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); + + JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length"); + + *ret = *(cpVect*)JS_GetArrayBufferViewData( tmp_arg, cx ); + + return JS_TRUE; +#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES +} + + +jsval CGPoint_to_jsval( JSContext *cx, cpVect p) +{ + +#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + + JSObject *object = JS_NewObject(cx, NULL, NULL, NULL ); + if (!object) + return JSVAL_VOID; + + if (!JS_DefineProperty(cx, object, "x", DOUBLE_TO_JSVAL(p.x), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) || + !JS_DefineProperty(cx, object, "y", DOUBLE_TO_JSVAL(p.y), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ) + return JSVAL_VOID; + + return OBJECT_TO_JSVAL(object); + +#else // JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES + +#ifdef __LP64__ + JSObject *typedArray = JS_NewFloat64Array( cx, 2 ); +#else + JSObject *typedArray = JS_NewFloat32Array( cx, 2 ); +#endif + + cpVect *buffer = (cpVect*)JS_GetArrayBufferViewData(typedArray, cx ); + *buffer = p; + return OBJECT_TO_JSVAL(typedArray); +#endif // ! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES +} + +JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret ) +{ + JSObject *tmp_arg; + if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) + return JS_FALSE; + + JSB_PRECONDITION( JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); + + JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpFloat)*4, "Invalid length"); + + *ret = *(cpBB*)JS_GetArrayBufferViewData( tmp_arg, cx); + + return JS_TRUE; +} + +jsval cpBB_to_jsval(JSContext *cx, cpBB bb ) +{ +#ifdef __LP64__ + JSObject *typedArray = JS_NewFloat64Array( cx, 4 ); +#else + JSObject *typedArray = JS_NewFloat32Array( cx, 4 ); +#endif + cpBB *buffer = (cpBB*)JS_GetArrayBufferViewData(typedArray, cx); + + *buffer = bb; + return OBJECT_TO_JSVAL(typedArray); +} diff --git a/scripting/javascript/bindings/cocosjs_manual_conversions.h b/scripting/javascript/bindings/cocosjs_manual_conversions.h new file mode 100644 index 0000000000..7a32f4c7a9 --- /dev/null +++ b/scripting/javascript/bindings/cocosjs_manual_conversions.h @@ -0,0 +1,19 @@ +#include "chipmunk.h" +#include "cocos2d.h" +#include "js_manual_conversions.h" + +#ifdef __cplusplus +extern "C" { +#endif + +JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *out ); +jsval CGPoint_to_jsval( JSContext *cx, cpVect p ); +JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret ); +jsval cpBB_to_jsval(JSContext *cx, cpBB bb ); + +#ifdef __cplusplus +} +#endif + +#define cpVect_to_jsval CGPoint_to_jsval +#define jsval_to_cpVect jsval_to_CGPoint diff --git a/scripting/javascript/bindings/js_bindings_chipmunk_functions.cpp.REMOVED.git-id b/scripting/javascript/bindings/js_bindings_chipmunk_functions.cpp.REMOVED.git-id index 3210fb4c76..ff96617499 100644 --- a/scripting/javascript/bindings/js_bindings_chipmunk_functions.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/js_bindings_chipmunk_functions.cpp.REMOVED.git-id @@ -1 +1 @@ -02ec34ee0597673f01d3cc72224a3f0f52d8c06b \ No newline at end of file +c40aaf99dc1fe3345c11bc4952c69810483ea5d7 \ No newline at end of file diff --git a/scripting/javascript/bindings/js_bindings_chipmunk_manual.cpp b/scripting/javascript/bindings/js_bindings_chipmunk_manual.cpp index bb6530d2ee..7a8e2b1576 100644 --- a/scripting/javascript/bindings/js_bindings_chipmunk_manual.cpp +++ b/scripting/javascript/bindings/js_bindings_chipmunk_manual.cpp @@ -6,7 +6,7 @@ #include "js_bindings_chipmunk_manual.hpp" #include "jsapi.h" -#include "js_manual_conversions.h" +#include "cocosjs_manual_conversions.h" #include "uthash.h" #include "ccConfig.h" #include "ScriptingCore.h" diff --git a/scripting/javascript/bindings/js_manual_conversions.cpp b/scripting/javascript/bindings/js_manual_conversions.cpp index 5c65b056c3..334e77321b 100644 --- a/scripting/javascript/bindings/js_manual_conversions.cpp +++ b/scripting/javascript/bindings/js_manual_conversions.cpp @@ -9,135 +9,6 @@ #include "js_bindings_config.h" #include "js_manual_conversions.h" -#define JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - -//#include "js_bindings_NS_manual.h" - - -JSBool jsval_to_CCPoint( JSContext *cx, jsval vp, CCPoint *ret ) -{ -#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - - JSObject *jsobj; - if( ! JS_ValueToObject( cx, vp, &jsobj ) ) - return JS_FALSE; - - JSB_PRECONDITION( jsobj, "Not a valid JS object"); - - jsval valx, valy; - JSBool ok = JS_TRUE; - ok &= JS_GetProperty(cx, jsobj, "x", &valx); - ok &= JS_GetProperty(cx, jsobj, "y", &valy); - - if( ! ok ) - return JS_FALSE; - - double x, y; - ok &= JS_ValueToNumber(cx, valx, &x); - ok &= JS_ValueToNumber(cx, valy, &y); - - if( ! ok ) - return JS_FALSE; - - ret->x = x; - ret->y = y; - - return JS_TRUE; - -#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - - JSObject *tmp_arg; - if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) - return JS_FALSE; - - JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); - - JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length"); - - *ret = *(CCPoint*)JS_GetArrayBufferViewData( tmp_arg, cx ); - - return JS_TRUE; -#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES -} - - -JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *ret ) -{ -#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - - JSObject *jsobj; - if( ! JS_ValueToObject( cx, vp, &jsobj ) ) - return JS_FALSE; - - JSB_PRECONDITION( jsobj, "Not a valid JS object"); - - jsval valx, valy; - JSBool ok = JS_TRUE; - ok &= JS_GetProperty(cx, jsobj, "x", &valx); - ok &= JS_GetProperty(cx, jsobj, "y", &valy); - - if( ! ok ) - return JS_FALSE; - - double x, y; - ok &= JS_ValueToNumber(cx, valx, &x); - ok &= JS_ValueToNumber(cx, valy, &y); - - if( ! ok ) - return JS_FALSE; - - ret->x = x; - ret->y = y; - - return JS_TRUE; - -#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - - JSObject *tmp_arg; - if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) - return JS_FALSE; - - JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); - - JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length"); - - *ret = *(cpVect*)JS_GetArrayBufferViewData( tmp_arg, cx ); - - return JS_TRUE; -#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES -} - - -jsval CGPoint_to_jsval( JSContext *cx, cpVect p) -{ - -#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - - JSObject *object = JS_NewObject(cx, NULL, NULL, NULL ); - if (!object) - return JSVAL_VOID; - - if (!JS_DefineProperty(cx, object, "x", DOUBLE_TO_JSVAL(p.x), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) || - !JS_DefineProperty(cx, object, "y", DOUBLE_TO_JSVAL(p.y), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ) - return JSVAL_VOID; - - return OBJECT_TO_JSVAL(object); - -#else // JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES - -#ifdef __LP64__ - JSObject *typedArray = JS_NewFloat64Array( cx, 2 ); -#else - JSObject *typedArray = JS_NewFloat32Array( cx, 2 ); -#endif - - cpVect *buffer = (cpVect*)JS_GetArrayBufferViewData(typedArray, cx ); - *buffer = p; - return OBJECT_TO_JSVAL(typedArray); -#endif // ! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES -} - - JSBool jsval_to_opaque( JSContext *cx, jsval vp, void **r) { #ifdef __LP64__ @@ -261,34 +132,6 @@ jsval long_to_jsval( JSContext *cx, long number ) #endif } -JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret ) -{ - JSObject *tmp_arg; - if( ! JS_ValueToObject( cx, vp, &tmp_arg ) ) - return JS_FALSE; - - JSB_PRECONDITION( JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object"); - - JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpFloat)*4, "Invalid length"); - - *ret = *(cpBB*)JS_GetArrayBufferViewData( tmp_arg, cx); - - return JS_TRUE; -} - -jsval cpBB_to_jsval(JSContext *cx, cpBB bb ) -{ -#ifdef __LP64__ - JSObject *typedArray = JS_NewFloat64Array( cx, 4 ); -#else - JSObject *typedArray = JS_NewFloat32Array( cx, 4 ); -#endif - cpBB *buffer = (cpBB*)JS_GetArrayBufferViewData(typedArray, cx); - - *buffer = bb; - return OBJECT_TO_JSVAL(typedArray); -} - jsval longlong_to_jsval( JSContext *cx, long long number ) { //NSCAssert( sizeof(long long)==8, @"Error!"); diff --git a/scripting/javascript/bindings/js_manual_conversions.h b/scripting/javascript/bindings/js_manual_conversions.h index 27baafff98..e67da4de09 100644 --- a/scripting/javascript/bindings/js_manual_conversions.h +++ b/scripting/javascript/bindings/js_manual_conversions.h @@ -3,10 +3,8 @@ // Copyright (c) 2012 Zynga Inc. All rights reserved. // -#include "chipmunk.h" -#include "cocos2d.h" +#include "jsapi.h" -using namespace cocos2d; #ifdef __cplusplus extern "C" { #endif @@ -15,23 +13,11 @@ JSBool jsval_to_opaque( JSContext *cx, jsval vp, void **out ); JSBool jsval_to_int( JSContext *cx, jsval vp, int *out); JSBool jsval_to_long( JSContext *cx, jsval vp, long *out); JSBool jsval_to_longlong( JSContext *cx, jsval vp, long long *out); - -JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *out ); - -jsval CGPoint_to_jsval( JSContext *cx, cpVect p ); - jsval int_to_jsval( JSContext *cx, int l); jsval long_to_jsval( JSContext *cx, long l); jsval longlong_to_jsval( JSContext *cx, long long l); jsval opaque_to_jsval( JSContext *cx, void* opaque); - - - JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret ); - jsval cpBB_to_jsval(JSContext *cx, cpBB bb ); - + #ifdef __cplusplus } #endif - -#define cpVect_to_jsval CGPoint_to_jsval -#define jsval_to_cpVect jsval_to_CGPoint From 901146e2eee6c90cdba6f5208e5b0f2b0fa693f2 Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 22:14:09 -0700 Subject: [PATCH 3/7] Synchronize cocos2dx.ini --- tools/tojs/cocos2dx.ini | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index fe721313d6..c37a6585fb 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -27,8 +27,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.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: "^CCMenu*$". - -classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCSequence CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCSet CCObject +classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCSequence CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet # 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 @@ -47,6 +46,8 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren getGrid setGLServer CC.*Protocol::[*], CC.*Delegate::[*], CCPoolManager::[*], + CCTexture2D::[initWithPVRTCData releaseData setTexParameters initWithData keepData], + CCSet::[begin end], CCIMEDispatcher::[*], CCSAXParser::[*], CCThread::[*], @@ -86,11 +87,14 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren getGrid setGLServer *::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*] rename_functions = CCDirector::[sharedDirector=getInstance], - CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames], + CCSpriteFrameCache::[sharedSpriteFrameCache=getInstance addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame], CCMenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize fontSizeObj=fontSize fontNameObj=fontName], CCProgressTimer::[setReverseProgress=setReverseDirection], CCTextureCache::[sharedTextureCache=getInstance], CCMenuItem::[setEnabled=setIsEnabled] + CCAnimation::[addSpriteFrameWithFileName=addSpriteFrameWithFilename], + CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation], + CCLayerGradient::[initWithColor=init] rename_classes = CCParticleSystemQuad::CCParticleSystem @@ -101,4 +105,5 @@ remove_prefix = CC base_objects = CCNode CCDirector # classes that create no constructor +# CCSet is special and we will use a hand-written constructor abstract_classes = CCDirector CCSpriteFrameCache CCTransitionEaseScene CCSet From 5ff4d73688f1938bec460885db479256bc1bb312 Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 22:16:01 -0700 Subject: [PATCH 4/7] Use new directives for renaming functions and classes --- tools/tojs/cocos2dx.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index c37a6585fb..32cea11f19 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -91,7 +91,7 @@ rename_functions = CCDirector::[sharedDirector=getInstance], CCMenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize fontSizeObj=fontSize fontNameObj=fontName], CCProgressTimer::[setReverseProgress=setReverseDirection], CCTextureCache::[sharedTextureCache=getInstance], - CCMenuItem::[setEnabled=setIsEnabled] + CCMenuItem::[setEnabled=setIsEnabled], CCAnimation::[addSpriteFrameWithFileName=addSpriteFrameWithFilename], CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation], CCLayerGradient::[initWithColor=init] @@ -107,3 +107,5 @@ base_objects = CCNode CCDirector # classes that create no constructor # CCSet is special and we will use a hand-written constructor abstract_classes = CCDirector CCSpriteFrameCache CCTransitionEaseScene CCSet + +rename_classes = From cbade952f6b3c83a38cc24c95b75022086ca0bca Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 22:17:32 -0700 Subject: [PATCH 5/7] Update to latest cxx-generator --- tools/cxx-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cxx-generator b/tools/cxx-generator index db61f83996..40ad79373b 160000 --- a/tools/cxx-generator +++ b/tools/cxx-generator @@ -1 +1 @@ -Subproject commit db61f8399655dd90f09d550259b45ae8289364fe +Subproject commit 40ad79373b6c041a3312afb36da6985b91f0a3dc From 12e88ac514ca1801cf4b48bc89494f7a4276353e Mon Sep 17 00:00:00 2001 From: folecr Date: Thu, 20 Sep 2012 23:12:43 -0700 Subject: [PATCH 6/7] Update bindings --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index cae7ca0ca3..2d18305596 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit cae7ca0ca35ec49f3d8eebe7256f7ae2bb946181 +Subproject commit 2d18305596b4da4b260bb2fd6d5ed8e878d0b129 From 78bfc2df62abc69fddd7d031185b18b113b9969c Mon Sep 17 00:00:00 2001 From: folecr Date: Fri, 21 Sep 2012 12:09:26 -0700 Subject: [PATCH 7/7] Fix spurious file introduced into makefile --- scripting/javascript/bindings/Android.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/scripting/javascript/bindings/Android.mk b/scripting/javascript/bindings/Android.mk index aa362e0fca..790f0369d3 100644 --- a/scripting/javascript/bindings/Android.mk +++ b/scripting/javascript/bindings/Android.mk @@ -9,7 +9,6 @@ LOCAL_MODULE_FILENAME := libscriptingcore-spidermonkey LOCAL_SRC_FILES := ScriptingCore.cpp \ cocos2d_specifics.cpp \ CCPhysicsSprite.cpp \ - cocos2dx.cpp \ js_manual_conversions.cpp \ cocosjs_manual_conversions.cpp \ js_bindings_chipmunk_manual.cpp \