From a36a4bf19baadb6abe9fb38848c5e6e897d19db9 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 16 Jul 2013 10:02:02 +0800 Subject: [PATCH 1/4] issue2405: Adding jsb_deprecated.js for the compatibility of deprecated variables and methods. --- .../project.pbxproj.REMOVED.git-id | 2 +- .../project.pbxproj.REMOVED.git-id | 2 +- scripting/javascript/bindings/js/jsb.js | 1 + .../javascript/bindings/js/jsb_deprecated.js | 23 +++++++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 scripting/javascript/bindings/js/jsb_deprecated.js diff --git a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index c9f2ecce27..09c8f65300 100644 --- a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -16f9fcf29ae0c1b3a14728f0a11518f50355fb18 \ No newline at end of file +08ecad70e8370c7af451fddea1c59d05e80ca696 \ No newline at end of file diff --git a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id index c487e6bb3f..0918143626 100644 --- a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -6e5e943a982f3ba38f0119ff2a8a4d25f9c76945 \ No newline at end of file +cfc5c1f04972a605515e3e606ec7da4be4b75c2e \ No newline at end of file diff --git a/scripting/javascript/bindings/js/jsb.js b/scripting/javascript/bindings/js/jsb.js index 524e0dc53b..7b0e39a256 100644 --- a/scripting/javascript/bindings/js/jsb.js +++ b/scripting/javascript/bindings/js/jsb.js @@ -12,3 +12,4 @@ require('jsb_opengl_constants.js'); require('jsb_opengl.js'); require('jsb_cocosbuilder.js'); require('jsb_sys.js'); +require('jsb_deprecated.js'); diff --git a/scripting/javascript/bindings/js/jsb_deprecated.js b/scripting/javascript/bindings/js/jsb_deprecated.js new file mode 100644 index 0000000000..4ae0939465 --- /dev/null +++ b/scripting/javascript/bindings/js/jsb_deprecated.js @@ -0,0 +1,23 @@ +// Deprecated functions + +var cc = cc || {}; + +function() { + + var logW = function(old_name, new_name) { + cc.log("\n********** \n"+old_name +" was deprecated, please use "+ new_name +" instead.\n**********"); + }; + + cc.AnimationCache.purgeSharedAnimationCache = function() { + logW("cc.AnimationCache.purgeSharedAnimationCache", "cc.AnimationCache.destroyInstance"); + cc.AnimationCache.destroyInstance(); + }; + + // Example of deprecating a member function + // cc.TiledGrid3DAction.prototype.originalTile = function() { + // logW("cc.TiledGrid3DAction.prototype.originalTile", "cc.TiledGrid3DAction.prototype.getOriginalTile"); + // return cc.TiledGrid3DAction.prototype.getOriginalTile.apply(this, arguments); + // }; + + +}(); From ebf382b02fb28a5b05a62c9c791a4a003fd9a0b8 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 16 Jul 2013 10:03:25 +0800 Subject: [PATCH 2/4] issue #2405: Removing deprecated methods in 'skip' section in cocos2dx.ini since bindings-generator will not bind deprecated methods now. --- tools/tojs/cocos2dx.ini | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 6b800dd13a..f22ec5e205 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -44,7 +44,7 @@ skip = Node::[^setPosition$ getGrid setGLServerState description getUserObject . LayerColor::[getBlendFunc setBlendFunc], ParticleSystem::[getBlendFunc setBlendFunc], DrawNode::[getBlendFunc setBlendFunc drawPolygon], - Director::[sharedDirector getAccelerometer (g|s)et.*Dispatcher getOpenGLView getProjection getClassTypeInfo], + Director::[getAccelerometer (g|s)et.*Dispatcher getOpenGLView getProjection getClassTypeInfo], Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased unregisterScriptKeypadHandler], Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns], MenuItem.*::[create setCallback initWithCallback], @@ -96,16 +96,13 @@ skip = Node::[^setPosition$ getGrid setGLServerState description getUserObject . Bezier.*::[create actionWithDuration], CardinalSpline.*::[create actionWithDuration setPoints], Scheduler::[pause resume unschedule schedule update isTargetPaused], - TextureCache::[sharedTextureCache purgeSharedTextureCache addPVRTCImage], + TextureCache::[addPVRTCImage], Timer::[getSelector], *::[copyWith.* onEnter.* onExit.* ^description$ getObjectType], - FileUtils::[sharedFileUtils purgeFileUtils (g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getClassTypeInfo], + FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getClassTypeInfo], SimpleAudioEngine::[getClassTypeInfo], Application::[^application.* ^run$], Camera::[getEyeXYZ getCenterXYZ getUpXYZ], - ShaderCache::[sharedShaderCache purgeSharedShaderCache], - AnimationCache::[sharedAnimationCache purgeSharedAnimationCache], - SpriteFrameCache::[sharedSpriteFrameCache purgeSharedSpriteFrameCache], ccFontDefinition::[*] rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames spriteFrameByName=getSpriteFrame isFlipX=isFlippedX isFlipY=isFlippedY], From de4b231264a0b736b3c1ac296f10c2c6889a5059 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 16 Jul 2013 10:04:03 +0800 Subject: [PATCH 3/4] closed #2405: Updating bindings-generator, Bindings-generator should not bind deprecated methods. --- tools/bindings-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bindings-generator b/tools/bindings-generator index 446febf1da..6612820da6 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 446febf1da3076d93427f637526e8d04db5b5157 +Subproject commit 6612820da6286ffb45ddaec16b75f1624624b88c From 62b12cbe8222c40ce9daf01e61781a9ce9d7b9b3 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 16 Jul 2013 10:14:52 +0800 Subject: [PATCH 4/4] Updating jsb_deprecated.js. --- scripting/javascript/bindings/js/jsb_deprecated.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripting/javascript/bindings/js/jsb_deprecated.js b/scripting/javascript/bindings/js/jsb_deprecated.js index 4ae0939465..5e5e0f19a5 100644 --- a/scripting/javascript/bindings/js/jsb_deprecated.js +++ b/scripting/javascript/bindings/js/jsb_deprecated.js @@ -2,7 +2,7 @@ var cc = cc || {}; -function() { +(function() { var logW = function(old_name, new_name) { cc.log("\n********** \n"+old_name +" was deprecated, please use "+ new_name +" instead.\n**********"); @@ -20,4 +20,4 @@ function() { // }; -}(); +})();