From 019246fd51ac5ea0835615f7c068da8dde9f0c44 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 24 Jul 2013 17:26:45 +0800 Subject: [PATCH 2/5] travis build template too --- tools/travis-scripts/run-script.sh | 43 ++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) mode change 100755 => 100644 tools/travis-scripts/run-script.sh diff --git a/tools/travis-scripts/run-script.sh b/tools/travis-scripts/run-script.sh old mode 100755 new mode 100644 index a9253a9d1b..e82daebda5 --- a/tools/travis-scripts/run-script.sh +++ b/tools/travis-scripts/run-script.sh @@ -7,9 +7,11 @@ COCOS2DX_ROOT="$DIR"/../.. build_android() { - cd $COCOS2DX_ROOT/samples/$1/$2/proj.android - ln -s ../../../../android_build_objs obj + echo "Current dir: `pwd`" + pushd $1/proj.android + ln -s $COCOS2DX_ROOT/android_build_objs obj ./build_native.sh + popd } if [ "$GEN_JSB"x = "YES"x ]; then @@ -38,17 +40,42 @@ if [ "$GEN_JSB"x = "YES"x ]; then ./generate-jsbindings.sh elif [ "$PLATFORM"x = "android"x ]; then export NDK_ROOT=$HOME/bin/android-ndk + + # Generate jsbinding glue codes + echo "Generating jsbindings glue codes ..." cd $COCOS2DX_ROOT/tools/travis-scripts ./generate-jsbindings.sh cd $COCOS2DX_ROOT + + # Create a directory for temporary objects mkdir android_build_objs - build_android Cpp HelloCpp - build_android Cpp TestCpp - build_android Cpp AssetsManagerTest - build_android Javascript TestJavascript - build_android Lua HelloLua - build_android Lua TestLua + + # Build samples + echo "Building samples ..." + cd $COCOS2DX_ROOT/samples/Cpp + build_android HelloCpp + build_android TestCpp + build_android AssetsManagerTest + + cd $COCOS2DX_ROOT/samples/Javascript + build_android TestJavascript + build_android CocosDragonJS + build_android CrystalCraze + build_android MoonWarriors + build_android WatermelonWithMe + + cd $COCOS2DX_ROOT/samples/Lua + build_android HelloLua + build_android TestLua + + # Build template + echo "Building template ..." + cd $COCOS2DX_ROOT/template + build_android multi-platform-cpp + build_android multi-platform-js + build_android multi-platform-lua + elif [ "$PLATFORM"x = "nacl"x ]; then export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin From 99949331b1fe829be5069163b55e02df9ec5a3e3 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 24 Jul 2013 17:27:29 +0800 Subject: [PATCH 3/5] fix error and compilings error in templates --- .../project.pbxproj.REMOVED.git-id | 2 +- scripting/lua/script/AudioEngine.lua | 2 +- .../Classes/HelloWorldScene.cpp | 11 +++--- .../proj.android/AndroidManifest.xml | 2 +- .../proj.android/jni/Application.mk | 2 +- .../proj.android/project.properties | 2 +- .../multi-platform-js/Classes/AppDelegate.cpp | 10 ++--- .../proj.android/jni/Application.mk | 2 +- .../HelloJavascript.xcodeproj/project.pbxproj | 4 ++ .../Classes/AppDelegate.cpp | 6 +-- .../multi-platform-lua/Resources/hello.lua | 6 +-- .../proj.android/AndroidManifest.xml | 2 +- .../proj.android/jni/Application.mk | 2 +- .../proj.android/project.properties | 2 +- .../HelloLua.xcodeproj/project.pbxproj | 38 +++++-------------- tools/project-creator/create_project.py | 4 +- 16 files changed, 41 insertions(+), 56 deletions(-) diff --git a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 1a6f3b07e4..0a71f3ec24 100644 --- a/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -b58c6efb737f16d40b382a25cea15fdb09764372 \ No newline at end of file +3e6fb10656859ac83b22bfa48044ade6213d414d \ No newline at end of file diff --git a/scripting/lua/script/AudioEngine.lua b/scripting/lua/script/AudioEngine.lua index 599f21fcd2..de0c80ed58 100644 --- a/scripting/lua/script/AudioEngine.lua +++ b/scripting/lua/script/AudioEngine.lua @@ -1,6 +1,6 @@ --Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects. local M = {} -local sharedEngine = SimpleAudioEngine:sharedEngine() +local sharedEngine = SimpleAudioEngine:getInstance() function M.stopAllEffects() sharedEngine:stopAllEffects() diff --git a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp index 7dd5070eb7..b635359243 100644 --- a/template/multi-platform-cpp/Classes/HelloWorldScene.cpp +++ b/template/multi-platform-cpp/Classes/HelloWorldScene.cpp @@ -38,15 +38,14 @@ bool HelloWorld::init() MenuItemImage *pCloseItem = MenuItemImage::create( "CloseNormal.png", "CloseSelected.png", - this, - menu_selector(HelloWorld::menuCloseCallback)); + CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); - pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , + pCloseItem->setPosition(Point(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , origin.y + pCloseItem->getContentSize().height/2)); // create menu, it's an autorelease object Menu* pMenu = Menu::create(pCloseItem, NULL); - pMenu->setPosition(PointZero); + pMenu->setPosition(Point::ZERO); this->addChild(pMenu, 1); ///////////////////////////// @@ -58,7 +57,7 @@ bool HelloWorld::init() LabelTTF* pLabel = LabelTTF::create("Hello World", "Arial", 24); // position the label on the center of the screen - pLabel->setPosition(ccp(origin.x + visibleSize.width/2, + pLabel->setPosition(Point(origin.x + visibleSize.width/2, origin.y + visibleSize.height - pLabel->getContentSize().height)); // add the label as a child to this layer @@ -68,7 +67,7 @@ bool HelloWorld::init() Sprite* pSprite = Sprite::create("HelloWorld.png"); // position the sprite on the center of the screen - pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); + pSprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(pSprite, 0); diff --git a/template/multi-platform-cpp/proj.android/AndroidManifest.xml b/template/multi-platform-cpp/proj.android/AndroidManifest.xml index b4ecb3e78c..fc76c88e0b 100644 --- a/template/multi-platform-cpp/proj.android/AndroidManifest.xml +++ b/template/multi-platform-cpp/proj.android/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0"> - + stopAnimation(); - SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); - SimpleAudioEngine::sharedEngine()->pauseAllEffects(); + SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); + SimpleAudioEngine::getInstance()->pauseAllEffects(); } // this function will be called when the app is active again void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); - SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); - SimpleAudioEngine::sharedEngine()->resumeAllEffects(); + SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); + SimpleAudioEngine::getInstance()->resumeAllEffects(); } diff --git a/template/multi-platform-js/proj.android/jni/Application.mk b/template/multi-platform-js/proj.android/jni/Application.mk index 8418b9b18c..4e46d23deb 100644 --- a/template/multi-platform-js/proj.android/jni/Application.mk +++ b/template/multi-platform-js/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 +APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 NDK_TOOLCHAIN_VERSION=4.7 diff --git a/template/multi-platform-js/proj.ios/HelloJavascript.xcodeproj/project.pbxproj b/template/multi-platform-js/proj.ios/HelloJavascript.xcodeproj/project.pbxproj index 616ac78617..18d64274cf 100644 --- a/template/multi-platform-js/proj.ios/HelloJavascript.xcodeproj/project.pbxproj +++ b/template/multi-platform-js/proj.ios/HelloJavascript.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 1AF4C35A17865F7400122817 /* jsb_sys.js in Resources */ = {isa = PBXBuildFile; fileRef = 1AF4C34217865F1600122817 /* jsb_sys.js */; }; 1AF4C35B17865F7400122817 /* jsb.js in Resources */ = {isa = PBXBuildFile; fileRef = 1AF4C34317865F1600122817 /* jsb.js */; }; 1AF4C35C17865F7400122817 /* main.debug.js in Resources */ = {isa = PBXBuildFile; fileRef = 1AF4C34417865F1600122817 /* main.debug.js */; }; + 466AF679179FC7EE002EE9BB /* jsb_deprecated.js in Resources */ = {isa = PBXBuildFile; fileRef = 466AF66C179FC7BE002EE9BB /* jsb_deprecated.js */; }; A92275421517C094001B78AA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A92275411517C094001B78AA /* QuartzCore.framework */; }; A92275441517C094001B78AA /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A92275431517C094001B78AA /* OpenGLES.framework */; }; A92275461517C094001B78AA /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A92275451517C094001B78AA /* OpenAL.framework */; }; @@ -202,6 +203,7 @@ 1AF4C34217865F1600122817 /* jsb_sys.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = jsb_sys.js; path = ../../../scripting/javascript/bindings/js/jsb_sys.js; sourceTree = ""; }; 1AF4C34317865F1600122817 /* jsb.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = jsb.js; path = ../../../scripting/javascript/bindings/js/jsb.js; sourceTree = ""; }; 1AF4C34417865F1600122817 /* main.debug.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.debug.js; path = ../../../scripting/javascript/bindings/js/main.debug.js; sourceTree = ""; }; + 466AF66C179FC7BE002EE9BB /* jsb_deprecated.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = jsb_deprecated.js; path = ../../../scripting/javascript/bindings/js/jsb_deprecated.js; sourceTree = ""; }; A922753D1517C094001B78AA /* HelloJavascript.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloJavascript.app; sourceTree = BUILT_PRODUCTS_DIR; }; A92275411517C094001B78AA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; A92275431517C094001B78AA /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; @@ -290,6 +292,7 @@ 1AF4C33817865EF900122817 /* JS Common */ = { isa = PBXGroup; children = ( + 466AF66C179FC7BE002EE9BB /* jsb_deprecated.js */, 1AF4C33917865F1600122817 /* jsb_chipmunk_constants.js */, 1AF4C33A17865F1600122817 /* jsb_chipmunk.js */, 1AF4C33B17865F1600122817 /* jsb_cocos2d_constants.js */, @@ -531,6 +534,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 466AF679179FC7EE002EE9BB /* jsb_deprecated.js in Resources */, 1AF4C35117865F7400122817 /* jsb_chipmunk_constants.js in Resources */, 1AF4C35217865F7400122817 /* jsb_chipmunk.js in Resources */, 1AF4C35317865F7400122817 /* jsb_cocos2d_constants.js in Resources */, diff --git a/template/multi-platform-lua/Classes/AppDelegate.cpp b/template/multi-platform-lua/Classes/AppDelegate.cpp index da80ab1351..05fb3205e1 100644 --- a/template/multi-platform-lua/Classes/AppDelegate.cpp +++ b/template/multi-platform-lua/Classes/AppDelegate.cpp @@ -34,7 +34,7 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setAnimationInterval(1.0 / 60); // register lua engine - LuaEngine* pEngine = LuaEngine::defaultEngine(); + LuaEngine* pEngine = LuaEngine::getInstance(); ScriptEngineManager::getInstance()->setScriptEngine(pEngine); LuaStack *pStack = pEngine->getLuaStack(); @@ -57,7 +57,7 @@ void AppDelegate::applicationDidEnterBackground() { Director::getInstance()->stopAnimation(); - SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); } // this function will be called when the app is active again @@ -65,5 +65,5 @@ void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); - SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); + SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); } diff --git a/template/multi-platform-lua/Resources/hello.lua b/template/multi-platform-lua/Resources/hello.lua index 942f7cd355..5bcbc1bda8 100644 --- a/template/multi-platform-lua/Resources/hello.lua +++ b/template/multi-platform-lua/Resources/hello.lua @@ -32,9 +32,9 @@ local function main() -- create dog animate local textureDog = CCTextureCache:getInstance():addImage("dog.png") - local rect = CCRectMake(0, 0, frameWidth, frameHeight) + local rect = CCRect(0, 0, frameWidth, frameHeight) local frame0 = CCSpriteFrame:createWithTexture(textureDog, rect) - rect = CCRectMake(frameWidth, 0, frameWidth, frameHeight) + rect = CCRect(frameWidth, 0, frameWidth, frameHeight) local frame1 = CCSpriteFrame:createWithTexture(textureDog, rect) local spriteDog = CCSprite:createWithSpriteFrame(frame0) @@ -87,7 +87,7 @@ local function main() end -- add crop - local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95)) + local frameCrop = CCSpriteFrame:create("crop.png", CCRect(0, 0, 105, 95)) for i = 0, 3 do for j = 0, 1 do local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop); diff --git a/template/multi-platform-lua/proj.android/AndroidManifest.xml b/template/multi-platform-lua/proj.android/AndroidManifest.xml index 578c23647b..17aea441c2 100644 --- a/template/multi-platform-lua/proj.android/AndroidManifest.xml +++ b/template/multi-platform-lua/proj.android/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0"> - + Date: Wed, 24 Jul 2013 17:50:39 +0800 Subject: [PATCH 4/5] add execution permission --- tools/travis-scripts/run-script.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/travis-scripts/run-script.sh diff --git a/tools/travis-scripts/run-script.sh b/tools/travis-scripts/run-script.sh old mode 100644 new mode 100755 From 439ed140cdd4b275e8a8a00932cae23477de7c16 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 24 Jul 2013 18:35:26 +0800 Subject: [PATCH 5/5] assign 1 to predefined macro CC_ENABLE_CHIPMUNK_INTEGRATION --- .../Javascript/CocosDragonJS/proj.android/jni/Application.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk b/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk index 5397489269..8e3c31147c 100644 --- a/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk +++ b/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 -APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION= +APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 NDK_TOOLCHAIN_VERSION=4.7