diff --git a/cocos2dx/cocoa/CCAutoreleasePool.cpp b/cocos2dx/cocoa/CCAutoreleasePool.cpp index d6583c296f..791226942a 100644 --- a/cocos2dx/cocoa/CCAutoreleasePool.cpp +++ b/cocos2dx/cocoa/CCAutoreleasePool.cpp @@ -41,18 +41,19 @@ CCAutoreleasePool::~CCAutoreleasePool(void) void CCAutoreleasePool::addObject(CCObject* pObject) { - CCAssert(false == pObject->m_bManaged, "this object is already in autorelese pool"); - m_pManagedObjectArray->addObject(pObject); CCAssert(pObject->m_uReference > 1, "reference count should be greater than 1"); - + ++(pObject->m_uAutoReleaseCount); pObject->release(); // no ref count, in this case autorelease pool added. } void CCAutoreleasePool::removeObject(CCObject* pObject) { - m_pManagedObjectArray->removeObject(pObject, false); + for (int i = 0; i < pObject->m_uAutoReleaseCount; ++i) + { + m_pManagedObjectArray->removeObject(pObject, false); + } } void CCAutoreleasePool::clear() @@ -70,7 +71,7 @@ void CCAutoreleasePool::clear() if(!pObj) break; - pObj->m_bManaged = false; + --(pObj->m_uAutoReleaseCount); //(*it)->release(); //delete (*it); #ifdef _DEBUG diff --git a/cocos2dx/cocoa/CCDictionary.cpp b/cocos2dx/cocoa/CCDictionary.cpp index 9bd909e4f3..eafd729dba 100644 --- a/cocos2dx/cocoa/CCDictionary.cpp +++ b/cocos2dx/cocoa/CCDictionary.cpp @@ -91,13 +91,12 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object) CCObject* CCDictionary::objectForKey(const std::string& key) { - if (m_eDictType != kCCDictStr) - { - return NULL; - } - + // if dictionary wasn't initialized, return NULL directly. + if (m_eDictType == kCCDictUnknown) return NULL; + // CCDictionary only supports one kind of key, string or integer. + // This method uses string as key, therefore we should make sure that the key type of this CCDictionary is string. CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key."); - + CCObject* pRetObject = NULL; CCDictElement *pElement = NULL; HASH_FIND_STR(m_pElements, key.c_str(), pElement); @@ -110,13 +109,12 @@ CCObject* CCDictionary::objectForKey(const std::string& key) CCObject* CCDictionary::objectForKey(int key) { - if (m_eDictType != kCCDictInt) - { - return NULL; - } - + // if dictionary wasn't initialized, return NULL directly. + if (m_eDictType == kCCDictUnknown) return NULL; + // CCDictionary only supports one kind of key, string or integer. + // This method uses integer as key, therefore we should make sure that the key type of this CCDictionary is integer. CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key."); - + CCObject* pRetObject = NULL; CCDictElement *pElement = NULL; HASH_FIND_INT(m_pElements, &key, pElement); diff --git a/cocos2dx/cocoa/CCObject.cpp b/cocos2dx/cocoa/CCObject.cpp index 8084c65180..ff8f6a5eba 100644 --- a/cocos2dx/cocoa/CCObject.cpp +++ b/cocos2dx/cocoa/CCObject.cpp @@ -38,7 +38,7 @@ CCObject* CCCopying::copyWithZone(CCZone *pZone) } CCObject::CCObject(void) -:m_bManaged(false) +:m_uAutoReleaseCount(0) ,m_uReference(1) // when the object is created, the reference count of it is 1 ,m_nLuaID(0) { @@ -51,7 +51,7 @@ CCObject::~CCObject(void) { // if the object is managed, we should remove it // from pool manager - if (m_bManaged) + if (m_uAutoReleaseCount > 0) { CCPoolManager::sharedPoolManager()->removeObject(this); } @@ -97,8 +97,6 @@ void CCObject::retain(void) CCObject* CCObject::autorelease(void) { CCPoolManager::sharedPoolManager()->addObject(this); - - m_bManaged = true; return this; } diff --git a/cocos2dx/cocoa/CCObject.h b/cocos2dx/cocoa/CCObject.h index 2aff081ee1..010e55df62 100644 --- a/cocos2dx/cocoa/CCObject.h +++ b/cocos2dx/cocoa/CCObject.h @@ -55,8 +55,8 @@ public: protected: // count of references unsigned int m_uReference; - // is the object autoreleased - bool m_bManaged; + // count of autorelease + unsigned int m_uAutoReleaseCount; public: CCObject(void); virtual ~CCObject(void); diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index 247fb78575..89bd3fc53b 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -26,7 +26,6 @@ package org.cocos2dx.lib; import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener; import android.app.Activity; -import android.app.AlertDialog; import android.os.Bundle; import android.os.Message; import android.view.ViewGroup; @@ -43,7 +42,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe // Fields // =========================================================== - private Cocos2dxGLSurfaceView mGLSurefaceView; + private Cocos2dxGLSurfaceView mGLSurfaceView; private Cocos2dxHandler mHandler; // =========================================================== @@ -54,7 +53,9 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - this.init(); + this.mHandler = new Cocos2dxHandler(this); + + this.mGLSurfaceView = onCreateView(); Cocos2dxHelper.init(this, this); } @@ -72,7 +73,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe super.onResume(); Cocos2dxHelper.onResume(); - this.mGLSurefaceView.onResume(); + this.mGLSurfaceView.onResume(); } @Override @@ -80,7 +81,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe super.onPause(); Cocos2dxHelper.onPause(); - this.mGLSurefaceView.onPause(); + this.mGLSurfaceView.onPause(); } @Override @@ -101,16 +102,15 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe @Override public void runOnGLThread(final Runnable pRunnable) { - this.mGLSurefaceView.queueEvent(pRunnable); + this.mGLSurfaceView.queueEvent(pRunnable); } // =========================================================== // Methods // =========================================================== - public void init() { + public Cocos2dxGLSurfaceView onCreateView() { // Init handler - this.mHandler = new Cocos2dxHandler(this); // FrameLayout ViewGroup.LayoutParams framelayout_params = @@ -130,20 +130,18 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe framelayout.addView(edittext); // Cocos2dxGLSurfaceView - this.mGLSurefaceView = this.onCreateGLSurfaceView(); + Cocos2dxGLSurfaceView gLSurfaceView = new Cocos2dxGLSurfaceView(this); // ...add to FrameLayout - framelayout.addView(mGLSurefaceView); + framelayout.addView(gLSurfaceView); - mGLSurefaceView.setCocos2dxRenderer(new Cocos2dxRenderer()); - mGLSurefaceView.setCocos2dxEditText(edittext); + gLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer()); + gLSurfaceView.setCocos2dxEditText(edittext); // Set framelayout as the content view setContentView(framelayout); - } - - public Cocos2dxGLSurfaceView onCreateGLSurfaceView() { - return new Cocos2dxGLSurfaceView(this); + + return gLSurfaceView; } // =========================================================== diff --git a/cocos2dx/platform/win32/CCImage.cpp b/cocos2dx/platform/win32/CCImage.cpp index c339963aa0..8eea70c70f 100644 --- a/cocos2dx/platform/win32/CCImage.cpp +++ b/cocos2dx/platform/win32/CCImage.cpp @@ -126,8 +126,8 @@ public: } GetObjectA(m_hFont, sizeof(tOldFont), &tOldFont); - if (tOldFont.lfHeight == tNewFont.lfHeight && - !strcmp(tOldFont.lfFaceName, tNewFont.lfFaceName)) + if (tOldFont.lfHeight == tNewFont.lfHeight + && 0 == strcmp(tOldFont.lfFaceName, tNewFont.lfFaceName)) { // already has the font bRet = true; diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index e08da8a74f..30ba0f53c0 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -493,10 +493,10 @@ void CCScrollView::addChild(CCNode * child) */ void CCScrollView::beforeDraw() { - if (m_bClippingToBounds) + if (m_bClippingToBounds) { // TODO: This scrollview should respect parents' positions - CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition()); + CCPoint screenPos = this->getParent()->convertToWorldSpace(this->getPosition()); glEnable(GL_SCISSOR_TEST); float s = this->getScale(); @@ -531,8 +531,6 @@ void CCScrollView::visit() kmGLPushMatrix(); -// glPushMatrix(); - if (m_pGrid && m_pGrid->isActive()) { m_pGrid->beforeDraw(); @@ -584,8 +582,6 @@ void CCScrollView::visit() } kmGLPopMatrix(); - -// glPopMatrix(); } bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) @@ -595,7 +591,8 @@ bool CCScrollView::ccTouchBegan(CCTouch* touch, CCEvent* event) return false; } CCRect frame; - frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height); + CCPoint frameOriginal = this->getParent()->convertToWorldSpace(this->getPosition()); + frame = CCRectMake(frameOriginal.x, frameOriginal.y, m_tViewSize.width, m_tViewSize.height); //dispatcher does not know about clipping. reject touches outside visible bounds. if (m_pTouches->count() > 2 || @@ -645,7 +642,9 @@ void CCScrollView::ccTouchMoved(CCTouch* touch, CCEvent* event) float newX, newY; m_bTouchMoved = true; - frame = CCRectMake(this->getPosition().x, this->getPosition().y, m_tViewSize.width, m_tViewSize.height); + CCPoint frameOriginal = this->getParent()->convertToWorldSpace(this->getPosition()); + frame = CCRectMake(frameOriginal.x, frameOriginal.y, m_tViewSize.width, m_tViewSize.height); + newPoint = this->convertTouchToNodeSpace((CCTouch*)m_pTouches->objectAtIndex(0)); moveDistance = ccpSub(newPoint, m_tTouchPoint); m_tTouchPoint = newPoint; diff --git a/extensions/network/HttpClient.cpp b/extensions/network/HttpClient.cpp index 1fa241540c..d40c6d0d41 100644 --- a/extensions/network/HttpClient.cpp +++ b/extensions/network/HttpClient.cpp @@ -246,6 +246,25 @@ int processGetTask(CCHttpRequest *request, write_callback callback, void *stream break; } + /* handle custom header data */ + /* create curl linked list */ + struct curl_slist *cHeaders=NULL; + /* get custom header data (if set) */ + std::vector headers=request->getHeaders(); + if(!headers.empty()) + { + for(std::vector::iterator it=headers.begin();it!=headers.end();it++) + { + /* append custom headers one by one */ + cHeaders=curl_slist_append(cHeaders,it->c_str()); + } + /* set custom headers for curl */ + code = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, cHeaders); + if (code != CURLE_OK) { + break; + } + } + code = curl_easy_setopt(curl, CURLOPT_URL, request->getUrl()); if (code != CURLE_OK) { @@ -276,6 +295,9 @@ int processGetTask(CCHttpRequest *request, write_callback callback, void *stream break; } + /* free the linked list for header data */ + curl_slist_free_all(cHeaders); + code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, responseCode); if (code != CURLE_OK || *responseCode != 200) { @@ -301,6 +323,25 @@ int processPostTask(CCHttpRequest *request, write_callback callback, void *strea break; } + /* handle custom header data */ + /* create curl linked list */ + struct curl_slist *cHeaders=NULL; + /* get custom header data (if set) */ + std::vector headers=request->getHeaders(); + if(!headers.empty()) + { + for(std::vector::iterator it=headers.begin();it!=headers.end();it++) + { + /* append custom headers one by one */ + cHeaders=curl_slist_append(cHeaders,it->c_str()); + } + /* set custom headers for curl */ + code = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, cHeaders); + if (code != CURLE_OK) { + break; + } + } + code = curl_easy_setopt(curl, CURLOPT_URL, request->getUrl()); if (code != CURLE_OK) { break; @@ -330,6 +371,9 @@ int processPostTask(CCHttpRequest *request, write_callback callback, void *strea break; } + /* free the linked list for header data */ + curl_slist_free_all(cHeaders); + code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, responseCode); if (code != CURLE_OK || *responseCode != 200) { code = CURLE_HTTP_RETURNED_ERROR; diff --git a/extensions/network/HttpRequest.h b/extensions/network/HttpRequest.h index c6dd2a8781..3addad2a6e 100644 --- a/extensions/network/HttpRequest.h +++ b/extensions/network/HttpRequest.h @@ -175,7 +175,20 @@ public: { return _pSelector; } - + + /** Set any custom headers **/ + inline void setHeaders(std::vector pHeaders) + { + _headers=pHeaders; + } + + /** Get custom headers **/ + inline std::vector getHeaders() + { + return _headers; + } + + protected: // properties HttpRequestType _requestType; /// kHttpRequestGet, kHttpRequestPost or other enums @@ -185,6 +198,7 @@ protected: CCObject* _pTarget; /// callback target of pSelector function SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer::onHttpResponse(CCObject *sender, void *data) void* _pUserData; /// You can add your customed data here + std::vector _headers; /// custom http headers }; NS_CC_EXT_END diff --git a/samples/HelloCpp/proj.android/build_native.sh b/samples/HelloCpp/proj.android/build_native.sh index e14fddce76..63cce90a30 100755 --- a/samples/HelloCpp/proj.android/build_native.sh +++ b/samples/HelloCpp/proj.android/build_native.sh @@ -67,10 +67,12 @@ done if [[ "$buildexternalsfromsource" ]]; then echo "Building external dependencies from source" + set -x "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" else echo "Using prebuilt externals" + set -x "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" fi diff --git a/samples/HelloCpp/proj.android/ndkgdb.sh b/samples/HelloCpp/proj.android/ndkgdb.sh new file mode 100755 index 0000000000..27ef46bb1e --- /dev/null +++ b/samples/HelloCpp/proj.android/ndkgdb.sh @@ -0,0 +1,47 @@ +APPNAME="HelloCpp" +APP_ANDROID_NAME="org.cocos2dx.hellocpp" + +if [ -z "${SDK_ROOT+aaa}" ]; then +# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk" + SDK_ROOT="$HOME/bin/android-sdk" +fi + +if [ -z "${NDK_ROOT+aaa}" ]; then +# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk" + NDK_ROOT="$HOME/bin/android-ndk" +fi + +if [ -z "${COCOS2DX_ROOT+aaa}" ]; then +# ... if COCOS2DX_ROOT is not set +# ... find current working directory + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory + COCOS2DX_ROOT="$DIR/../../.." + APP_ROOT="$DIR/.." + APP_ANDROID_ROOT="$DIR" +else + APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME" + APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android" +fi + +echo "NDK_ROOT = $NDK_ROOT" +echo "SDK_ROOT = $SDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "APP_ANDROID_NAME = $APP_ANDROID_NAME" + +echo +echo "Killing and restarting ${APP_ANDROID_NAME}" +echo + +set -x + +"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}" + +NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \ + "${NDK_ROOT}"/ndk-gdb \ + --adb="${SDK_ROOT}"/platform-tools/adb \ + --verbose \ + --start \ + --force diff --git a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 7a0741db42..abe50a6030 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -101,18 +101,40 @@ void HttpClientTest::onMenuGetTestClicked(cocos2d::CCObject *sender) void HttpClientTest::onMenuPostTestClicked(cocos2d::CCObject *sender) { - CCHttpRequest* request = new CCHttpRequest(); - request->setUrl("http://www.httpbin.org/post"); - request->setRequestType(CCHttpRequest::kHttpPost); - request->setResponseCallback(this, callfuncND_selector(HttpClientTest::onHttpRequestCompleted)); + // test 1 + { + CCHttpRequest* request = new CCHttpRequest(); + request->setUrl("http://www.httpbin.org/post"); + request->setRequestType(CCHttpRequest::kHttpPost); + request->setResponseCallback(this, callfuncND_selector(HttpClientTest::onHttpRequestCompleted)); + + // write the post data + const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest"; + request->setRequestData(postData, strlen(postData)); + + request->setTag("POST test1"); + CCHttpClient::getInstance()->send(request); + request->release(); + } - // write the post data - const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetowrkTest"; - request->setRequestData(postData, strlen(postData)); - - request->setTag("POST test"); - CCHttpClient::getInstance()->send(request); - request->release(); + // test 2: set Content-Type + { + CCHttpRequest* request = new CCHttpRequest(); + request->setUrl("http://www.httpbin.org/post"); + request->setRequestType(CCHttpRequest::kHttpPost); + std::vector headers; + headers.push_back("Content-Type: application/json; charset=utf-8"); + request->setHeaders(headers); + request->setResponseCallback(this, callfuncND_selector(HttpClientTest::onHttpRequestCompleted)); + + // write the post data + const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest"; + request->setRequestData(postData, strlen(postData)); + + request->setTag("POST test2"); + CCHttpClient::getInstance()->send(request); + request->release(); + } // waiting m_labelStatusCode->setString("waiting..."); diff --git a/samples/TestJavascript/proj.android/build_native.sh b/samples/TestJavascript/proj.android/build_native.sh index 6ce5e724e4..be80429f39 100755 --- a/samples/TestJavascript/proj.android/build_native.sh +++ b/samples/TestJavascript/proj.android/build_native.sh @@ -3,6 +3,7 @@ APPNAME="TestJavascript" # options buildexternalsfromsource= +PARALLEL_BUILD_FLAG= usage(){ cat << EOF @@ -12,15 +13,19 @@ Build C/C++ code for $APPNAME using Android NDK OPTIONS: -s Build externals from source +-p Run make with -j8 option to take advantage of multiple processors -h this help EOF } -while getopts "sh" OPTION; do +while getopts "sph" OPTION; do case "$OPTION" in s) buildexternalsfromsource=1 ;; +p) +PARALLEL_BUILD_FLAG=\-j8 +;; h) usage exit 0 @@ -90,6 +95,6 @@ echo set -x -"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ +"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \ "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" \ NDK_LOG=1 V=1 diff --git a/template/android/copy_files.sh b/template/android/copy_files.sh index d102d0684e..633d8c9336 100644 --- a/template/android/copy_files.sh +++ b/template/android/copy_files.sh @@ -52,6 +52,12 @@ copy_build_native(){ chmod u+x $APP_DIR/proj.android/build_native.sh } +# copy debugger script and replace templated parameters +copy_ndkgdb(){ + sed "s#__projectname__#$APP_NAME#;s#__packagename__#$PACKAGE_PATH#" $COCOS2DX_ROOT/template/android/ndkgdb.sh > $APP_DIR/proj.android/ndkgdb.sh + chmod u+x $APP_DIR/proj.android/ndkgdb.sh +} + # copy .project and .classpath and replace project name modify_project_classpath(){ sed "s/HelloCpp/$APP_NAME/" $COCOS2DX_ROOT/template/android/.project > $APP_DIR/proj.android/.project @@ -92,6 +98,7 @@ copy_cpp_h copy_resouces copy_src_and_jni copy_build_native +copy_ndkgdb modify_project_classpath modify_androidmanifest modify_applicationdemo diff --git a/template/android/ndkgdb.sh b/template/android/ndkgdb.sh new file mode 100644 index 0000000000..5326004ea8 --- /dev/null +++ b/template/android/ndkgdb.sh @@ -0,0 +1,47 @@ +APPNAME="__projectname__" +APP_ANDROID_NAME="__packagename__" + +if [ -z "${SDK_ROOT+aaa}" ]; then +# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk" + SDK_ROOT="$HOME/bin/android-sdk" +fi + +if [ -z "${NDK_ROOT+aaa}" ]; then +# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk" + NDK_ROOT="$HOME/bin/android-ndk" +fi + +if [ -z "${COCOS2DX_ROOT+aaa}" ]; then +# ... if COCOS2DX_ROOT is not set +# ... find current working directory + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory + COCOS2DX_ROOT="$DIR/../.." + APP_ROOT="$DIR/.." + APP_ANDROID_ROOT="$DIR" +else + APP_ROOT="$COCOS2DX_ROOT/$APPNAME" + APP_ANDROID_ROOT="$COCOS2DX_ROOT/$APPNAME/proj.android" +fi + +echo "NDK_ROOT = $NDK_ROOT" +echo "SDK_ROOT = $SDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "APP_ANDROID_NAME = $APP_ANDROID_NAME" + +echo +echo "Killing and restarting ${APP_ANDROID_NAME}" +echo + +set -x + +"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}" + +NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \ + "${NDK_ROOT}"/ndk-gdb \ + --adb="${SDK_ROOT}"/platform-tools/adb \ + --verbose \ + --start \ + --force