From d875edbd745ce3017927a6945b04826b732a732d Mon Sep 17 00:00:00 2001 From: jiang xiaohua Date: Wed, 20 Feb 2013 22:33:28 +0800 Subject: [PATCH 01/19] Additional a transformation matrix, Used in is not parent-child relationship but we still need to maintain transformation parent-child Example: GameObject_Parent(CCNode; create from CCNode) GameObject_sub1(CCNode; Create from the same CCSpriteBatchNode,the node's parent is CCLayer ) RenderComponents1( Create form the same CCSpriteBatchNode) Components2 .... GameObject_sub2 (CCNode; Create from the CCNode,the node's parent is GameObject_Parent ) RenderComponents1( not used batchNode) Now, GameObject_sub1 not GameObject_Parent node, but I want it to simulate the change of the son is GameObject_Parent; I Need additional the father's matrix in child Node ; --- cocos2dx/base_nodes/CCNode.cpp | 9 +++++++-- cocos2dx/base_nodes/CCNode.h | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 638c9dba2b..2ef7d66d36 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -86,6 +86,7 @@ CCNode::CCNode(void) , m_uOrderOfArrival(0) , m_eGLServerState(ccGLServerState(0)) , m_bReorderChildDirty(false) +, m_sOtherTransform(CCAffineTransformMakeIdentity()) { // set default scheduler and actionManager CCDirector *director = CCDirector::sharedDirector(); @@ -1158,13 +1159,17 @@ CCAffineTransform CCNode::nodeToParentTransform(void) m_sTransform = CCAffineTransformTranslate(m_sTransform, -m_obAnchorPointInPoints.x, -m_obAnchorPointInPoints.y); } } - + m_sTransform = CCAffineTransformConcat(m_sTransform, m_sOtherTransform); m_bTransformDirty = false; } return m_sTransform; } - +void CCNode::translateFormOtherNode(CCAffineTransform &transform) +{ + m_sOtherTransform = CCAffineTransformMake(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); + m_bTransformDirty = true; +} CCAffineTransform CCNode::parentToNodeTransform(void) { if ( m_bInverseDirty ) { diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index daa85b7aa4..83ad2d46a8 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -1256,6 +1256,10 @@ public: */ CCPoint convertTouchToNodeSpaceAR(CCTouch * touch); + /** + * Additional a transformation matrix, Used in is not parent-child relationship but we still need to maintain transformation parent-child + */ + void translateFormOtherNode(CCAffineTransform &transform); /// @} end of Coordinate Converters private: @@ -1290,6 +1294,7 @@ protected: CCSize m_obContentSize; ///< untransformed size of the node + CCAffineTransform m_sOtherTransform;///< transform CCAffineTransform m_sTransform; ///< transform CCAffineTransform m_sInverse; ///< transform From 397457aa682bc2133bf42ff5e5a8d377e1f988b0 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 22 Feb 2013 10:54:39 +0800 Subject: [PATCH 02/19] cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated 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 e5db85664c..9c50b7406a 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit e5db85664c005aaae02e9dac7970b2e3c3adbe47 +Subproject commit 9c50b7406a8155f5feaab7e3bfaee6bc458a93ec From 8921d92143ec4a553a813f9703e2bd741ea05154 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 11:58:52 +0800 Subject: [PATCH 03/19] Removed some unused codes. --- cocos2dx/platform/android/CCApplication.cpp | 14 ------------- cocos2dx/platform/android/CCApplication.h | 19 ------------------ .../platform/blackberry/CCApplication.cpp | 5 ----- cocos2dx/platform/blackberry/CCApplication.h | 20 ------------------- 4 files changed, 58 deletions(-) diff --git a/cocos2dx/platform/android/CCApplication.cpp b/cocos2dx/platform/android/CCApplication.cpp index b85a274e62..9c10a543f9 100644 --- a/cocos2dx/platform/android/CCApplication.cpp +++ b/cocos2dx/platform/android/CCApplication.cpp @@ -52,20 +52,6 @@ void CCApplication::setAnimationInterval(double interval) } } -CCApplication::Orientation CCApplication::setOrientation(Orientation orientation) -{ - return orientation; -} - -//void CCApplication::statusBarFrame(CCRect * rect) -//{ -// if (rect) -// { -// // android doesn't have status bar. -// *rect = CCRectMake(0, 0, 0, 0); -// } -//} - ////////////////////////////////////////////////////////////////////////// // static member function ////////////////////////////////////////////////////////////////////////// diff --git a/cocos2dx/platform/android/CCApplication.h b/cocos2dx/platform/android/CCApplication.h index 7fead7cdd0..f5e6940f85 100644 --- a/cocos2dx/platform/android/CCApplication.h +++ b/cocos2dx/platform/android/CCApplication.h @@ -20,25 +20,6 @@ public: */ void setAnimationInterval(double interval); - typedef enum - { - /// Device oriented vertically, home button on the bottom - kOrientationPortrait = 0, - /// Device oriented vertically, home button on the top - kOrientationPortraitUpsideDown = 1, - /// Device oriented horizontally, home button on the right - kOrientationLandscapeLeft = 2, - /// Device oriented horizontally, home button on the left - kOrientationLandscapeRight = 3, - } Orientation; - - /** - @brief Callback by CCDirector to change device orientation. - @orientation The desired orientation. - @return The actual orientation of the application. - */ - Orientation setOrientation(Orientation orientation); - /** @brief Run the message loop. */ diff --git a/cocos2dx/platform/blackberry/CCApplication.cpp b/cocos2dx/platform/blackberry/CCApplication.cpp index 5122959a25..cb1fce235d 100644 --- a/cocos2dx/platform/blackberry/CCApplication.cpp +++ b/cocos2dx/platform/blackberry/CCApplication.cpp @@ -75,11 +75,6 @@ void CCApplication::setAnimationInterval(double interval) m_animationInterval = (long)(interval * 1000); } -CCApplication::Orientation CCApplication::setOrientation(Orientation orientation) -{ - return orientation; -} - void CCApplication::setResourceRootPath(const std::string& rootResDir) { m_resourceRootPath = rootResDir; diff --git a/cocos2dx/platform/blackberry/CCApplication.h b/cocos2dx/platform/blackberry/CCApplication.h index fac0c15414..9994fccfe9 100644 --- a/cocos2dx/platform/blackberry/CCApplication.h +++ b/cocos2dx/platform/blackberry/CCApplication.h @@ -20,26 +20,6 @@ public: */ void setAnimationInterval(double interval); - typedef enum - { - /// Device oriented vertically, home button on the bottom - kOrientationPortrait = 0, - /// Device oriented vertically, home button on the top - kOrientationPortraitUpsideDown = 1, - /// Device oriented horizontally, home button on the right - kOrientationLandscapeLeft = 2, - /// Device oriented horizontally, home button on the left - kOrientationLandscapeRight = 3, - } Orientation; - - /** - @brief Callback by CCDirector for change device orientation. - @orientation The defination of orientation which CCDirector want change to. - @return The actual orientation of the application. - */ - Orientation setOrientation(Orientation orientation); - - /** @brief Run the message loop. */ From e3745b0078fbaf330510a72be2486fa863c92c63 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 22 Feb 2013 12:12:11 +0800 Subject: [PATCH 04/19] cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated 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 9c50b7406a..a4cf50ac9b 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit 9c50b7406a8155f5feaab7e3bfaee6bc458a93ec +Subproject commit a4cf50ac9b5541a1ba948bb459fa5bf7b4917e65 From b54b92492392e028baf59541a16c3907459ee89a Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 16:01:49 +0800 Subject: [PATCH 05/19] fixed #1743: Adding an additional transform for CCNode. --- cocos2dx/base_nodes/CCNode.cpp | 20 +++++++++---- cocos2dx/base_nodes/CCNode.h | 54 +++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 2ef7d66d36..8e1438adfc 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -86,7 +86,8 @@ CCNode::CCNode(void) , m_uOrderOfArrival(0) , m_eGLServerState(ccGLServerState(0)) , m_bReorderChildDirty(false) -, m_sOtherTransform(CCAffineTransformMakeIdentity()) +, m_sAdditionalTransform(CCAffineTransformMakeIdentity()) +, m_bAdditionalTransformDirty(false) { // set default scheduler and actionManager CCDirector *director = CCDirector::sharedDirector(); @@ -1159,17 +1160,26 @@ CCAffineTransform CCNode::nodeToParentTransform(void) m_sTransform = CCAffineTransformTranslate(m_sTransform, -m_obAnchorPointInPoints.x, -m_obAnchorPointInPoints.y); } } - m_sTransform = CCAffineTransformConcat(m_sTransform, m_sOtherTransform); + + if (m_bAdditionalTransformDirty) + { + m_sTransform = CCAffineTransformConcat(m_sTransform, m_sAdditionalTransform); + m_bAdditionalTransformDirty = false; + } + m_bTransformDirty = false; } return m_sTransform; } -void CCNode::translateFormOtherNode(CCAffineTransform &transform) + +void CCNode::setAdditionalTransform(const CCAffineTransform& additionalTransform) { - m_sOtherTransform = CCAffineTransformMake(transform.a, transform.b, transform.c, transform.d, transform.tx, transform.ty); - m_bTransformDirty = true; + m_sAdditionalTransform = additionalTransform; + m_bTransformDirty = true; + m_bAdditionalTransformDirty = true; } + CCAffineTransform CCNode::parentToNodeTransform(void) { if ( m_bInverseDirty ) { diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 83ad2d46a8..fd2af142b8 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -1257,9 +1257,54 @@ public: CCPoint convertTouchToNodeSpaceAR(CCTouch * touch); /** - * Additional a transformation matrix, Used in is not parent-child relationship but we still need to maintain transformation parent-child + * Sets the additional transform. + * + * @note The additional transform will be concatenated at the end of nodeToParentTransform. + * It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't). + * @code + // create a batchNode + CCSpriteBatchNode* batch= CCSpriteBatchNode::create("Icon-114.png"); + this->addChild(batch); + + // create two sprites, spriteA will be added to batchNode, they are using different textures. + CCSprite* spriteA = CCSprite::createWithTexture(batch->getTexture()); + CCSprite* spriteB = CCSprite::create("Icon-72.png"); + + batch->addChild(spriteA); + + // We can't make spriteB as spriteA's child since they use different textures. So just add it to layer. + // But we want to simulate `parent-child` relationship for these two node. + this->addChild(spriteB); + + //position + spriteA->setPosition(ccp(200, 200)); + + // Gets the spriteA's transform. + CCAffineTransform t = spriteA->nodeToParentTransform(); + + // Sets the additional transform to spriteB, spriteB's postion will based on its pseudo parent i.e. spriteA. + spriteB->setAdditionalTransform(t); + + //scale + spriteA->setScale(2); + + // Gets the spriteA's transform. + t = spriteA->nodeToParentTransform(); + + // Sets the additional transform to spriteB, spriteB's scale will based on its pseudo parent i.e. spriteA. + spriteB->setAdditionalTransform(t); + + //rotation + spriteA->setRotation(20); + + // Gets the spriteA's transform. + t = spriteA->nodeToParentTransform(); + + // Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. spriteA. + spriteB->setAdditionalTransform(t); + * @endcode */ - void translateFormOtherNode(CCAffineTransform &transform); + void setAdditionalTransform(const CCAffineTransform& additionalTransform); /// @} end of Coordinate Converters private: @@ -1294,7 +1339,8 @@ protected: CCSize m_obContentSize; ///< untransformed size of the node - CCAffineTransform m_sOtherTransform;///< transform + + CCAffineTransform m_sAdditionalTransform; ///< transform CCAffineTransform m_sTransform; ///< transform CCAffineTransform m_sInverse; ///< transform @@ -1326,7 +1372,7 @@ protected: bool m_bTransformDirty; ///< transform dirty flag bool m_bInverseDirty; ///< transform dirty flag - + bool m_bAdditionalTransformDirty; ///< The flag to check whether the additional transform is dirty bool m_bVisible; ///< is this node visible bool m_bIgnoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the CCNode, false otherwise. From 476e3801eba50ac7411903effc8a3710db762955 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 16:15:17 +0800 Subject: [PATCH 06/19] tab -> 4 space. --- cocos2dx/base_nodes/CCNode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index fd2af142b8..a6c071f343 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -1340,7 +1340,7 @@ protected: CCSize m_obContentSize; ///< untransformed size of the node - CCAffineTransform m_sAdditionalTransform; ///< transform + CCAffineTransform m_sAdditionalTransform; ///< transform CCAffineTransform m_sTransform; ///< transform CCAffineTransform m_sInverse; ///< transform From fdf85953530263ba8f9a42fdbe66bb1e23328807 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 16:16:16 +0800 Subject: [PATCH 07/19] tab -> 4 space. --- cocos2dx/base_nodes/CCNode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index a6c071f343..fb8e1bbc8a 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -1304,7 +1304,7 @@ public: spriteB->setAdditionalTransform(t); * @endcode */ - void setAdditionalTransform(const CCAffineTransform& additionalTransform); + void setAdditionalTransform(const CCAffineTransform& additionalTransform); /// @} end of Coordinate Converters private: From 49fc92e11230fd351975d29b3f7146b0f6fef04b Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 16:19:52 +0800 Subject: [PATCH 08/19] Update AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index cc5893a769..925d546f13 100644 --- a/AUTHORS +++ b/AUTHORS @@ -206,6 +206,9 @@ Developers: ThePickleMan Adding 'rotationIsDir' property to ParticleSystem. + Jianghua (jxhgzs) + Adding an additional transform for CCNode. + Retired Core Developers: WenSheng Yang Author of windows port, CCTextField, From 2b7c4348dc80de37a4679b90418ee9066bda2685 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Feb 2013 16:20:24 +0800 Subject: [PATCH 09/19] Update AUTHORS --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 925d546f13..5046ca470b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -206,7 +206,7 @@ Developers: ThePickleMan Adding 'rotationIsDir' property to ParticleSystem. - Jianghua (jxhgzs) + Jianghua (jxhgzs) Adding an additional transform for CCNode. Retired Core Developers: From 3dcee98cb86cec24285effd5110b73c80e3a9587 Mon Sep 17 00:00:00 2001 From: walzer Date: Fri, 22 Feb 2013 16:32:12 +0800 Subject: [PATCH 10/19] issue #1733, use json config files instead of python modules for multi-platforms. --- tools/project-creator/android/__init__.py | 2 - .../android/handle_project_files.py | 55 ------------ tools/project-creator/blackberry/__init__.py | 2 - .../blackberry/handle_project_files.py | 25 ------ tools/project-creator/create_project.py | 88 +++++++++++++++++-- tools/project-creator/ios/__init__.py | 2 - .../ios/handle_project_files.py | 39 -------- tools/project-creator/linux/__init__.py | 2 - .../linux/handle_project_files.py | 22 ----- tools/project-creator/mac/__init__.py | 2 - .../mac/handle_project_files.py | 39 -------- tools/project-creator/marmalade/__init__.py | 2 - .../marmalade/handle_project_files.py | 21 ----- tools/project-creator/replaces.py | 19 ---- tools/project-creator/win32/__init__.py | 2 - .../win32/handle_project_files.py | 33 ------- 16 files changed, 80 insertions(+), 275 deletions(-) delete mode 100644 tools/project-creator/android/__init__.py delete mode 100755 tools/project-creator/android/handle_project_files.py delete mode 100644 tools/project-creator/blackberry/__init__.py delete mode 100755 tools/project-creator/blackberry/handle_project_files.py delete mode 100644 tools/project-creator/ios/__init__.py delete mode 100755 tools/project-creator/ios/handle_project_files.py delete mode 100644 tools/project-creator/linux/__init__.py delete mode 100755 tools/project-creator/linux/handle_project_files.py delete mode 100644 tools/project-creator/mac/__init__.py delete mode 100755 tools/project-creator/mac/handle_project_files.py delete mode 100644 tools/project-creator/marmalade/__init__.py delete mode 100755 tools/project-creator/marmalade/handle_project_files.py delete mode 100755 tools/project-creator/replaces.py delete mode 100644 tools/project-creator/win32/__init__.py delete mode 100755 tools/project-creator/win32/handle_project_files.py diff --git a/tools/project-creator/android/__init__.py b/tools/project-creator/android/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/android/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/android/handle_project_files.py b/tools/project-creator/android/handle_project_files.py deleted file mode 100755 index 941f245f36..0000000000 --- a/tools/project-creator/android/handle_project_files.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for Android -# Copyright (c) 2012 cocos2d-x.org -# Author: WangZhe - -# Android - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.android/" - - # rename files and folders - src_pkg = context["src_package_name"].split('.') - dst_pkg = context["dst_package_name"].split('.') - - os.rename(proj_path + "src/" + src_pkg[0], - proj_path + "src/" + dst_pkg[0]) - os.rename(proj_path + "src/" + dst_pkg[0] + "/" + src_pkg[1], - proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1]) - os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + src_pkg[2], - proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2]) - os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["src_project_name"] + ".java", - proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["dst_project_name"] + ".java") - - dst_java_file_path = proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["dst_project_name"] + ".java" - - # remove useless files. - removes = [ - "assets", - "bin", - "libs", - "gen", - "obj", - ] - for i in range(0, len(removes)): - if (os.path.exists(proj_path + removes[i]) == True): - shutil.rmtree(proj_path + removes[i]) - - # replaceString function is implemented in ../create-project.py - import replaces - # package_name should be replaced at first. Don't change this sequence - replaces.replaceString(proj_path + "AndroidManifest.xml", context["src_package_name"], context["dst_package_name"]) - replaces.replaceString(dst_java_file_path, context["src_package_name"], context["dst_package_name"]) - - replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "AndroidManifest.xml", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "build.xml", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "build_native.sh", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "res/values/strings.xml",context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(dst_java_file_path, context["src_project_name"], context["dst_project_name"]) - # done! - print "proj.android : Done!" diff --git a/tools/project-creator/blackberry/__init__.py b/tools/project-creator/blackberry/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/blackberry/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/blackberry/handle_project_files.py b/tools/project-creator/blackberry/handle_project_files.py deleted file mode 100755 index 3eeda80372..0000000000 --- a/tools/project-creator/blackberry/handle_project_files.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for BlackBerry -# Copyright (c) 2012 cocos2d-x.org -# Author: Zhe WANG - -# BlackBerry - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.blackberry/" - - # replaceString function is implemented in ../create-project.py - import replaces - - replaces.replaceString(proj_path + "bar-descriptor.xml", context["src_package_name"], context["dst_package_name"]) - - replaces.replaceString(proj_path + ".cproject", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "bar-descriptor.xml", context["src_project_name"], context["dst_project_name"]) - - # done! - print "proj.blackberry : Done!" diff --git a/tools/project-creator/create_project.py b/tools/project-creator/create_project.py index 8dbbd383da..6ecb4adf87 100755 --- a/tools/project-creator/create_project.py +++ b/tools/project-creator/create_project.py @@ -20,7 +20,8 @@ platforms_list = [] # begin import sys import os, os.path -import shutil # for copy folders and files +import json +import shutil def dumpUsage(): print "Usage: create-project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE" @@ -101,6 +102,74 @@ def checkParams(context): "win32"] # end of checkParams(context) function +def replaceString(filepath, src_string, dst_string): + content = "" + f1 = open(filepath, "rb") + for line in f1: + if src_string in line: + content += line.replace(src_string, dst_string) + else: + content += line + f1.close() + f2 = open(filepath, "wb") + f2.write(content) + f2.close() +# end of replaceString + +def processPlatformProjects(platform): + # determine proj_path + proj_path = context["dst_project_path"] + "/proj.%s/" % platform + java_package_path = "" + + # read josn config file or the current platform + f = open("%s.json" % platform) + data = json.load(f) + + # rename package path, like "org.cocos2dx.hello" to "com.company.game". This is a special process for android + if (platform == "android"): + src_pkg = context["src_package_name"].split('.') + dst_pkg = context["dst_package_name"].split('.') + os.rename(proj_path + "src/" + src_pkg[0], + proj_path + "src/" + dst_pkg[0]) + os.rename(proj_path + "src/" + dst_pkg[0] + "/" + src_pkg[1], + proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1]) + os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + src_pkg[2], + proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2]) + java_package_path = dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + + # rename files and folders + for i in range(0, len(data["rename"])): + tmp = data["rename"][i].replace("PACKAGE_PATH", java_package_path) + src = tmp.replace("PROJECT_NAME", context["src_project_name"]) + dst = tmp.replace("PROJECT_NAME", context["dst_project_name"]) + if (os.path.exists(proj_path + src) == True): + os.rename(proj_path + src, proj_path + dst) + + # remove useless files and folders + for i in range(0, len(data["remove"])): + dst = data["remove"][i].replace("PROJECT_NAME", context["dst_project_name"]) + if (os.path.exists(proj_path + dst) == True): + shutil.rmtree(proj_path + dst) + + # rename package_name. This should be replaced at first. Don't change this sequence + for i in range(0, len(data["replace_package_name"])): + tmp = data["replace_package_name"][i].replace("PACKAGE_PATH", java_package_path) + dst = tmp.replace("PROJECT_NAME", context["dst_project_name"]) + if (os.path.exists(proj_path + dst) == True): + replaceString(proj_path + dst, context["src_package_name"], context["dst_package_name"]) + + # rename project_name + for i in range(0, len(data["replace_project_name"])): + tmp = data["replace_project_name"][i].replace("PACKAGE_PATH", java_package_path) + dst = tmp.replace("PROJECT_NAME", context["dst_project_name"]) + if (os.path.exists(proj_path + dst) == True): + replaceString(proj_path + dst, context["src_project_name"], context["dst_project_name"]) + + # done! + print "proj.%s\t\t: Done!" % platform +# end of processPlatformProjects + + # -------------- main -------------- # dump argvs @@ -113,16 +182,19 @@ checkParams(context) # copy "lauguage"(cpp/lua/javascript) platform.proj into cocos2d-x/projects//folder if (os.path.exists(context["dst_project_path"]) == True): - print "Error:" + context["dst_project_path"] + " folder is already existing" - print "Please remove the old project or choose a new PROJECT_NAME in -project parameter" - sys.exit() -else: - shutil.copytree(context["src_project_path"], context["dst_project_path"], True) + shutil.rmtree(context["dst_project_path"]) + #print "Error:" + context["dst_project_path"] + " folder is already existing" + #print "Please remove the old project or choose a new PROJECT_NAME in -project parameter" + #sys.exit() +#else: + +shutil.copytree(context["src_project_path"], context["dst_project_path"], True) # call process_proj from each platform's script folder for platform in platforms_list: - exec "import %s.handle_project_files" % (platform) - exec "%s.handle_project_files.handle_project_files(context)" % (platform) + processPlatformProjects(platform) +# exec "import %s.handle_project_files" % (platform) +# exec "%s.handle_project_files.handle_project_files(context)" % (platform) print "New project has been created in this path: " + context["dst_project_path"].replace("/tools/project-creator/../..", "") print "Have Fun!" diff --git a/tools/project-creator/ios/__init__.py b/tools/project-creator/ios/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/ios/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/ios/handle_project_files.py b/tools/project-creator/ios/handle_project_files.py deleted file mode 100755 index 7040a7eb1e..0000000000 --- a/tools/project-creator/ios/handle_project_files.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for iOS -# Copyright (c) 2012 cocos2d-x.org -# Author: WangZhe - -# iOS - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.ios/" - - # rename files and folders - os.rename(proj_path + context["src_project_name"] + ".xcodeproj", - proj_path + context["dst_project_name"] + ".xcodeproj" ) - - # remove useless files. - removes = [ - context["dst_project_name"] + ".xcodeproj/project.xcworkspace", - context["dst_project_name"] + ".xcodeproj/xcuserdata", - ] - for i in range(0, len(removes)): - if (os.path.exists(proj_path + removes[i]) == True): - shutil.rmtree(proj_path + removes[i]) - - # replaceString function is implemented in ../create-project.py - import replaces - # package_name should be replaced at first. Don't change this sequence - replaces.replaceString(proj_path + "Info.plist", - context["src_package_name"], context["dst_package_name"]) - replaces.replaceString(proj_path + context["dst_project_name"] + ".xcodeproj/project.pbxproj", - context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "Info.plist", - context["src_project_name"], context["dst_project_name"]) - - # done! - print "proj.ios : Done!" \ No newline at end of file diff --git a/tools/project-creator/linux/__init__.py b/tools/project-creator/linux/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/linux/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/linux/handle_project_files.py b/tools/project-creator/linux/handle_project_files.py deleted file mode 100755 index 395523cefc..0000000000 --- a/tools/project-creator/linux/handle_project_files.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for Linux -# Copyright (c) 2012 cocos2d-x.org -# Author: Zhe WANG - -# Linux - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.linux/" - - # replaceString function is implemented in ../create-project.py - import replaces - replaces.replaceString(proj_path + ".cproject", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "Makefile", context["src_project_name"], context["dst_project_name"]) - - # done! - print "proj.linux : Done!" diff --git a/tools/project-creator/mac/__init__.py b/tools/project-creator/mac/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/mac/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/mac/handle_project_files.py b/tools/project-creator/mac/handle_project_files.py deleted file mode 100755 index 333798745b..0000000000 --- a/tools/project-creator/mac/handle_project_files.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for Mac OS X -# Copyright (c) 2012 cocos2d-x.org -# Author: WangZhe - -# Mac OS X - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.mac/" - - # rename files and folders - os.rename(proj_path + context["src_project_name"] + ".xcodeproj", - proj_path + context["dst_project_name"] + ".xcodeproj" ) - - # remove useless files. - removes = [ - context["dst_project_name"] + ".xcodeproj/project.xcworkspace", - context["dst_project_name"] + ".xcodeproj/xcuserdata", - ] - for i in range(0, len(removes)): - if (os.path.exists(proj_path + removes[i]) == True): - shutil.rmtree(proj_path + removes[i]) - - # replaceString function is implemented in ../create-project.py - import replaces - # package_name should be replaced at first. Don't change this sequence - replaces.replaceString(proj_path + "Info.plist", - context["src_package_name"], context["dst_package_name"]) - replaces.replaceString(proj_path + context["dst_project_name"] + ".xcodeproj/project.pbxproj", - context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "Info.plist", - context["src_project_name"], context["dst_project_name"]) - - # done! - print "proj.mac : Done!" \ No newline at end of file diff --git a/tools/project-creator/marmalade/__init__.py b/tools/project-creator/marmalade/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/marmalade/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/marmalade/handle_project_files.py b/tools/project-creator/marmalade/handle_project_files.py deleted file mode 100755 index a62d94432c..0000000000 --- a/tools/project-creator/marmalade/handle_project_files.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for BlackBerry -# Copyright (c) 2012 cocos2d-x.org -# Author: Zhe WANG - -# BlackBerry - -import os -import shutil - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.marmalade/" - - # rename files and folders - os.rename(proj_path + context["src_project_name"] + ".mkb", - proj_path + context["dst_project_name"] + ".mkb" ) - - - # done! - print "proj.blackberry : Done!" diff --git a/tools/project-creator/replaces.py b/tools/project-creator/replaces.py deleted file mode 100755 index b86ef16fa2..0000000000 --- a/tools/project-creator/replaces.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/python -# replaces.py -# Copyright (c) 2012 cocos2d-x.org -# Author: WangZhe - -def replaceString(filepath, src_string, dst_string): - content = "" - f1 = open(filepath, "rb") - for line in f1: - if src_string in line: - content += line.replace(src_string, dst_string) - else: - content += line - f1.close() - f2 = open(filepath, "wb") - f2.write(content) - f2.close() -# end of replaceString(filepath, src, dst) function - diff --git a/tools/project-creator/win32/__init__.py b/tools/project-creator/win32/__init__.py deleted file mode 100644 index 495b230185..0000000000 --- a/tools/project-creator/win32/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This empty file indicates this folder as a module in python -# Don't remove me! \ No newline at end of file diff --git a/tools/project-creator/win32/handle_project_files.py b/tools/project-creator/win32/handle_project_files.py deleted file mode 100755 index 9aade7b5ad..0000000000 --- a/tools/project-creator/win32/handle_project_files.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python -# handle_project_files.py for Win32 -# Copyright (c) 2012 cocos2d-x.org -# Author: WangZhe - -# Win32 - -import os - -def handle_project_files(context): - # determine proj_path - proj_path = context["dst_project_path"] + "/proj.win32/" - - # rename files and folders - os.rename(proj_path + context["src_project_name"] + ".vcxproj", - proj_path + context["dst_project_name"] + ".vcxproj") - os.rename(proj_path + context["src_project_name"] + ".vcxproj.filters", - proj_path + context["dst_project_name"] + ".vcxproj.filters") - os.rename(proj_path + context["src_project_name"] + ".vcxproj.user", - proj_path + context["dst_project_name"] + ".vcxproj.user") - os.rename(proj_path + context["src_project_name"] + ".sln", - proj_path + context["dst_project_name"] + ".sln") - - # replaceString function is implemented in ../create-project.py - import replaces - # package_name should be replaced at first. Don't change this sequence - replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj.filters", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj.user", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + context["dst_project_name"] + ".sln", context["src_project_name"], context["dst_project_name"]) - replaces.replaceString(proj_path + "main.cpp", context["src_project_name"], context["dst_project_name"]) - # done! - print "proj.win32 : Done!" From b534ff16e7f90e9531f09b1408af6f6cf92ca14e Mon Sep 17 00:00:00 2001 From: walzer Date: Fri, 22 Feb 2013 16:33:24 +0800 Subject: [PATCH 11/19] issue #1733, don't remove projects if it exists. --- tools/project-creator/create_project.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/project-creator/create_project.py b/tools/project-creator/create_project.py index 6ecb4adf87..3fe72d884b 100755 --- a/tools/project-creator/create_project.py +++ b/tools/project-creator/create_project.py @@ -182,13 +182,11 @@ checkParams(context) # copy "lauguage"(cpp/lua/javascript) platform.proj into cocos2d-x/projects//folder if (os.path.exists(context["dst_project_path"]) == True): - shutil.rmtree(context["dst_project_path"]) - #print "Error:" + context["dst_project_path"] + " folder is already existing" - #print "Please remove the old project or choose a new PROJECT_NAME in -project parameter" - #sys.exit() -#else: - -shutil.copytree(context["src_project_path"], context["dst_project_path"], True) + print "Error:" + context["dst_project_path"] + " folder is already existing" + print "Please remove the old project or choose a new PROJECT_NAME in -project parameter" + sys.exit() +else: + shutil.copytree(context["src_project_path"], context["dst_project_path"], True) # call process_proj from each platform's script folder for platform in platforms_list: From 70612a722b81850ee0e8ae381d2d61237b35f9a6 Mon Sep 17 00:00:00 2001 From: giginet Date: Fri, 22 Feb 2013 20:21:02 +0900 Subject: [PATCH 12/19] Fix CCRepeat#create is recieved bad argument on Lua binding. CCRepeat#create must be recieved CCFiniteTimeAction as first argument. But, CCActionInterval recieved in LuaCocos2d.cpp --- scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index 4c003cd41c..dc13dbcbfb 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -4ef84aca8211b93637bba858faf4883704dca5ae \ No newline at end of file +f0dfb853e96eda746fe727b5984febf65ffb2d65 \ No newline at end of file From 79be62a9328874a98b5d317be59ab65977adf4c4 Mon Sep 17 00:00:00 2001 From: walzer Date: Fri, 22 Feb 2013 22:24:05 +0800 Subject: [PATCH 13/19] issue #1733, fix a typo in dumping usage. --- tools/project-creator/create_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/project-creator/create_project.py b/tools/project-creator/create_project.py index 3fe72d884b..71af102005 100755 --- a/tools/project-creator/create_project.py +++ b/tools/project-creator/create_project.py @@ -24,7 +24,7 @@ import json import shutil def dumpUsage(): - print "Usage: create-project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE" + print "Usage: create_project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE" print "Options:" print " -project PROJECT_NAME Project name, for example: MyGame" print " -package PACKAGE_NAME Package name, for example: com.MyCompany.MyAwesomeGame" From 750918d058f7a638bf7499195a548c140c0dc2ba Mon Sep 17 00:00:00 2001 From: giginet Date: Sat, 23 Feb 2013 09:03:28 +0900 Subject: [PATCH 14/19] Fix CCRepeat#create argument --- tools/tolua++/CCAction.pkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tolua++/CCAction.pkg b/tools/tolua++/CCAction.pkg index 17c0114229..7d8daa3a1e 100644 --- a/tools/tolua++/CCAction.pkg +++ b/tools/tolua++/CCAction.pkg @@ -73,7 +73,7 @@ class CCRepeat : public CCActionInterval bool isDone(void); CCActionInterval* reverse(void); - static CCRepeat* create(CCActionInterval *pAction, unsigned int times); + static CCRepeat* create(CCFiniteTimeAction *pAction, unsigned int times); }; class CCRepeatForever : public CCActionInterval From af75651abc4a6507e7099c15b1cf204f02ca5bcf Mon Sep 17 00:00:00 2001 From: James Chen Date: Sat, 23 Feb 2013 10:35:58 +0800 Subject: [PATCH 15/19] Update AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 5046ca470b..cf8d38788a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -209,6 +209,9 @@ Developers: Jianghua (jxhgzs) Adding an additional transform for CCNode. + giginet + Fix CCRepeat#create is recieved bad argument on Lua binding. + Retired Core Developers: WenSheng Yang Author of windows port, CCTextField, From 1eed0b5663a96b50376ece2e39d970c3dbd42140 Mon Sep 17 00:00:00 2001 From: xyhl515 Date: Sat, 23 Feb 2013 21:21:58 +0800 Subject: [PATCH 16/19] Add VS2012 Express For Windows Desktop support in install-templiates-msvc.bat --- install-templates-msvc.bat | 2 +- .../msvc/InstallWizardForVS2012Express.js | 239 ++++++++++++++++++ 2 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 template/msvc/InstallWizardForVS2012Express.js diff --git a/install-templates-msvc.bat b/install-templates-msvc.bat index e69292cb44..cf7f9c4cb8 100644 --- a/install-templates-msvc.bat +++ b/install-templates-msvc.bat @@ -11,6 +11,6 @@ if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG% cscript "%SCRIPT_DIR%InstallWizardForVC2010Express.js" /quiet cscript "%SCRIPT_DIR%InstallWizardForVS2010.js" /quiet cscript "%SCRIPT_DIR%InstallWizardForVS2012.js" /quiet +cscript "%SCRIPT_DIR%InstallWizardForVS2012Express.js" /quiet if exist %SCRIPT_LOG% more %SCRIPT_LOG% if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG% - diff --git a/template/msvc/InstallWizardForVS2012Express.js b/template/msvc/InstallWizardForVS2012Express.js new file mode 100644 index 0000000000..89f469d891 --- /dev/null +++ b/template/msvc/InstallWizardForVS2012Express.js @@ -0,0 +1,239 @@ +// Setup program for the Cocos2d-win32 App Wizard for VC++ 11.0 (VC2012) + +main(); + +function EchoInfo(bQuiet, strMsg) { + if (! bQuiet) { + WScript.Echo(strMsg); + } + else { + var FileSys = new ActiveXObject("Scripting.FileSystemObject"); + var strLogPath = "InstallWizardLog.txt" + var file = FileSys.OpenTextFile(strLogPath, 8, true); + file.WriteLine(strMsg); + file.Close(); + } +} + +function EchoError(bQuiet, strMsg) { + strMsg = "Error: " + strMsg; + if (! bQuiet) { + WScript.Echo(strMsg); + } + else { + var FileSys = new ActiveXObject("Scripting.FileSystemObject"); + var strLogPath = "InstallWizardLog.txt" + var file = FileSys.OpenTextFile(strLogPath, 8, true); + file.WriteLine(strMsg); + file.Close(); + } +} + +function main() { + // Decode command line arguments + var bDebug = false; + var bQuiet = false; + var bElevated = false; + var Args = WScript.Arguments; + for (var i = 0; i < Args.length; i++) { + if (Args(i) == "/debug") + bDebug = true; + else if (Args(i) == "/elevated") + bElevated = true; + else if (Args(i) == "/quiet") + bQuiet = true; + } + + // See if UAC is enabled + var Shell = WScript.CreateObject("Shell.Application"); + if (!bElevated && Shell.IsRestricted("System", "EnableLUA")) { + // Check that the script is being run interactively. + if (!WScript.Interactive) { + EchoError(bQuiet, "(Windows LUA) Elevation required."); + return; + } + + // Now relaunch the script, using the "RunAs" verb to elevate + var strParams = "\"" + WScript.ScriptFullName + "\""; + if (bDebug) + strParams += " /debug"; + strParams += " /elevated"; + Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs"); + return; + } + + // Create shell object + var WSShell = WScript.CreateObject("WScript.Shell"); + // Create file system object + var FileSys = WScript.CreateObject("Scripting.FileSystemObject"); + + // Get the folder containing the script file + var strScriptPath = FileSys.GetParentFolderName(WScript.ScriptFullName); + if (strScriptPath == null || strScriptPath == "") + strScriptPath = "."; + + // Get the folder script files copy to + var strValue = ""; + try { + var strVCKey = "HKLM\\Software\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"; + strValue = WSShell.RegRead(strVCKey); + } + catch (e) { + try { + var strVCKey_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"; + strValue = WSShell.RegRead(strVCKey_x64); + } + catch (e) { + EchoError(bQuiet, "Cannot find where Visual Studio Express 2012 for Windows Desktop is installed."); + return; + } + } + + var strDestFolder = FileSys.BuildPath(strValue, "vcprojects_WDExpress"); + if (bDebug) + WScript.Echo("Destination: " + strDestFolder); + + if (!FileSys.FolderExists(strDestFolder)) { + EchoError(bQuiet, "Cannot find destination folder (should be: " + strDestFolder + ")"); + return; + } + + // Wizard Info + var nNumWizards = 1; + + var astrWizardName = new Array(); + astrWizardName[0] = "CCAppWiz.win32"; + + var nCntr; + for (nCntr = 0; nCntr < nNumWizards; nCntr++) { + var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]); + + if (bDebug) + WScript.Echo("Source: " + strSourceFolder); + + if (!FileSys.FolderExists(strSourceFolder)) { + EchoError(bQuiet, "Cannot find Wizard folder (should be: " + strSourceFolder + ")"); + return; + } + + // Copy files + try { + var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".ico"); + var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".ico"); + FileSys.CopyFile(strSrc, strDest); + + strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir"); + strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsdir"); + FileSys.CopyFile(strSrc, strDest); + } + catch (e) { + var strError = "no info"; + if (e.description.length != 0) + strError = e.description; + EchoError(bQuiet, "Cannot copy file (" + strError + ")"); + return; + } + + // Read and write CCAppWiz.vsz, add engine version and replace path when found + try { + var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsz"); + var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsz"); + + var ForReading = 1; + var fileSrc = FileSys.OpenTextFile(strSrc, ForReading); + if (fileSrc == null) { + EchoError(bQuiet, "Cannot open source file: " + strSrc); + return; + } + + var ForWriting = 2; + var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true); + if (fileDest == null) { + EchoError(bQuiet, " Cannot open destination file: " + strDest); + return; + } + + while (!fileSrc.AtEndOfStream) { + var strLine = fileSrc.ReadLine(); + if (strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1) + strLine += ".11.0"; + else if (strLine.indexOf("WIZARD_VERSION") != -1) + strLine = "Param=\"WIZARD_VERSION = 11.0\""; + else if (strLine.indexOf("ABSOLUTE_PATH") != -1) + strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\""; + fileDest.WriteLine(strLine); + } + + fileSrc.Close(); + fileDest.Close(); + } + catch (e) { + var strError = "no info"; + if (e.description.length != 0) + strError = e.description; + EchoError(bQuiet, "Cannot read and write CCAppWiz.vsz (" + strError + ")"); + return; + } + } + + // Create Cocos2d-x folder + var strDestCCFolder = ""; + try { + strDestCCFolder = FileSys.BuildPath(strDestFolder, "Cocos2d-x"); + if (!FileSys.FolderExists(strDestCCFolder)) + FileSys.CreateFolder(strDestCCFolder); + if (bDebug) + WScript.Echo("Cocos2d-x Folder: " + strDestCCFolder); + } + catch (e) { + var strError = "no info"; + if (e.description.length != 0) + strError = e.description; + EchoError(bQuiet, "Cannot create Cocos2d-x folder (" + strError + ")"); + return; + } + + // Read and write additional CCAppWiz.vsdir, add path to the wizard location + try { + var strDest = FileSys.BuildPath(strDestCCFolder, "Cocos2d-x.vsdir"); + + var ForWriting = 2; + + var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true); + if (fileDest == null) { + EchoError(bQuiet, "Cannot open destination file: " + strDest); + return; + } + + var nCntr; + for (nCntr = 0; nCntr < nNumWizards; nCntr++) { + var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]); + var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir"); + var ForReading = 1; + var fileSrc = FileSys.OpenTextFile(strSrc, ForReading); + if (fileSrc == null) { + EchoError(bQuiet, "Cannot open source file: " + strSrc); + return; + } + + while (!fileSrc.AtEndOfStream) { + var strLine = fileSrc.ReadLine(); + if (strLine.indexOf(astrWizardName[nCntr] + ".vsz|") != -1) + strLine = "..\\" + strLine; + fileDest.WriteLine(strLine); + } + + fileSrc.Close(); + } + fileDest.Close(); + } + catch (e) { + var strError = "no info"; + if (e.description.length != 0) + strError = e.description; + EchoError(bQuiet, "Cannot read and write Cocos2d-x\\CCAppWiz.vsdir (" + strError + ")"); + return; + } + + EchoInfo(bQuiet, "App Wizard successfully installed for VS2012 Express!"); +} From a09220dfc8e8e3e80c24f43ccaa61e685511ecd4 Mon Sep 17 00:00:00 2001 From: James Chen Date: Sat, 23 Feb 2013 22:09:20 +0800 Subject: [PATCH 17/19] New jsb tests (TableViewTest). --- samples/Javascript/Shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Javascript/Shared b/samples/Javascript/Shared index 4a4ce5f098..cc6d8acc73 160000 --- a/samples/Javascript/Shared +++ b/samples/Javascript/Shared @@ -1 +1 @@ -Subproject commit 4a4ce5f098c96c66f501a079491215a5904607b6 +Subproject commit cc6d8acc731c5a6970e96cc2ba231718ba693dfc From 37779a2e1ab5bfa961bab1b3bcda271378a78020 Mon Sep 17 00:00:00 2001 From: walzer Date: Sun, 24 Feb 2013 16:15:05 +0800 Subject: [PATCH 18/19] don't need to remove assets/Images/test_*.pvr.gz files in multi-platform-cpp template --- template/multi-platform-cpp/proj.android/build_native.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/template/multi-platform-cpp/proj.android/build_native.sh b/template/multi-platform-cpp/proj.android/build_native.sh index 497547dec0..53cbb80e4b 100755 --- a/template/multi-platform-cpp/proj.android/build_native.sh +++ b/template/multi-platform-cpp/proj.android/build_native.sh @@ -65,13 +65,7 @@ if [ -f "$file" ]; then fi done -# remove test_image_rgba4444.pvr.gz -rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz -rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba8888.pvr.gz -rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgb888.pvr.gz -rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba4444.pvr.gz -rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_a8.pvr.gz - +# run ndk-build if [[ "$buildexternalsfromsource" ]]; then echo "Building external dependencies from source" "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ From 32c9e0379ab4d076777313e63f3b55b8cd835173 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 25 Feb 2013 10:22:03 +0800 Subject: [PATCH 19/19] fixed #1731:change struct to class --- tools/tolua++/CCGeometry.pkg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tolua++/CCGeometry.pkg b/tools/tolua++/CCGeometry.pkg index 5034f99b62..870e71dae5 100644 --- a/tools/tolua++/CCGeometry.pkg +++ b/tools/tolua++/CCGeometry.pkg @@ -1,5 +1,5 @@ -struct CCPoint +class CCPoint { float x; float y; @@ -9,7 +9,7 @@ struct CCPoint bool equals(const CCPoint & target) const ; }; -struct CCSize +class CCSize { float width; float height; @@ -19,7 +19,7 @@ struct CCSize bool equals(const CCSize & target) const; }; -struct CCRect +class CCRect { CCPoint origin; CCSize size;