From 4226fcf355d6dbde9abd0446282e9757e13d6a1b Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 21 Nov 2011 09:34:49 +0800 Subject: [PATCH 1/7] issue #854: add CCThread_ios.mm --- cocos2dx/platform/ios/CCThread_ios.mm | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cocos2dx/platform/ios/CCThread_ios.mm diff --git a/cocos2dx/platform/ios/CCThread_ios.mm b/cocos2dx/platform/ios/CCThread_ios.mm new file mode 100644 index 0000000000..a287d71586 --- /dev/null +++ b/cocos2dx/platform/ios/CCThread_ios.mm @@ -0,0 +1,39 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#import +#include "CCThread.h" + +NS_CC_BEGIN; + +CCThread::~CCThread() +{ + [(id)m_pAutoreasePool release]; +} + +void CCThread::createAutoreleasePool() +{ + m_pAutoreasePool = [[NSAutoreleasePool alloc] init]; +} + +NS_CC_END; From efa9275d7f6f62020f0eb0ddfc1e73afe78da8c3 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 21 Nov 2011 12:04:21 +0800 Subject: [PATCH 2/7] save the codes for testing --- cocos2dx/menu_nodes/CCMenu.cpp | 2 +- cocos2dx/proj.win32/cocos2d-win32.vcproj | 4 ++-- cocos2dx/textures/CCTextureCache.cpp | 2 +- tests/test.android/build_native.sh | 2 +- tests/tests/TextureCacheTest/TextureCacheTest.cpp | 10 ++++++++++ tests/tests/TextureCacheTest/TextureCacheTest.h | 4 ++++ 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/cocos2dx/menu_nodes/CCMenu.cpp b/cocos2dx/menu_nodes/CCMenu.cpp index 5c6bfd37d5..00c3d7de7c 100644 --- a/cocos2dx/menu_nodes/CCMenu.cpp +++ b/cocos2dx/menu_nodes/CCMenu.cpp @@ -81,7 +81,7 @@ namespace cocos2d{ bool CCMenu::init() { va_list args; - return initWithItems(0, NULL); + return initWithItems(0, args); } bool CCMenu::initWithItems(CCMenuItem* item, va_list args) diff --git a/cocos2dx/proj.win32/cocos2d-win32.vcproj b/cocos2dx/proj.win32/cocos2d-win32.vcproj index be096b2e3e..08cc573086 100644 --- a/cocos2dx/proj.win32/cocos2d-win32.vcproj +++ b/cocos2dx/proj.win32/cocos2d-win32.vcproj @@ -124,7 +124,7 @@ /> scheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this, 1.0f, false); + CCScheduler::sharedScheduler()->scheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this, 0, false); firstRun = false; } diff --git a/tests/test.android/build_native.sh b/tests/test.android/build_native.sh index aa5b1f8580..008817f290 100644 --- a/tests/test.android/build_native.sh +++ b/tests/test.android/build_native.sh @@ -1,6 +1,6 @@ #!/bin/bash # set params -ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r5 +ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6 COCOS2DX_ROOT=/cygdrive/e/cocos2d-x TESTS_ROOT=$COCOS2DX_ROOT/tests/test.android diff --git a/tests/tests/TextureCacheTest/TextureCacheTest.cpp b/tests/tests/TextureCacheTest/TextureCacheTest.cpp index 6bf724b2a6..bb60cf4c03 100644 --- a/tests/tests/TextureCacheTest/TextureCacheTest.cpp +++ b/tests/tests/TextureCacheTest/TextureCacheTest.cpp @@ -3,6 +3,8 @@ #include "TextureCacheTest.h" +using namespace cocos2d; + TextureCacheTest::TextureCacheTest() : m_nNumberOfSprites(24) , m_nNumberOfLoadedSprites(0) @@ -18,6 +20,8 @@ TextureCacheTest::TextureCacheTest() this->addChild(m_pLabelLoading); this->addChild(m_pLabelPercent); + CCTime::gettimeofdayCocos2d(&m_time, NULL); + // load textrues CCTextureCache::sharedTextureCache()->addImageAsync("Images/HelloWorld.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); CCTextureCache::sharedTextureCache()->addImageAsync("Images/grossini.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); @@ -62,6 +66,12 @@ void TextureCacheTest::loadingCallBack(CCObject *obj) void TextureCacheTest::addSprite() { + + struct cc_timeval endTime; + CCTime::gettimeofdayCocos2d(&endTime, NULL); + + CCLog("time is %d secodes %d ns", endTime.tv_sec - m_time.tv_sec, endTime.tv_usec - m_time.tv_usec); + CCSize size = CCDirector::sharedDirector()->getWinSize(); // create sprites diff --git a/tests/tests/TextureCacheTest/TextureCacheTest.h b/tests/tests/TextureCacheTest/TextureCacheTest.h index 086fcce1f9..75b60bc607 100644 --- a/tests/tests/TextureCacheTest/TextureCacheTest.h +++ b/tests/tests/TextureCacheTest/TextureCacheTest.h @@ -1,8 +1,10 @@ #ifndef _TEXTURECACHE_TEST_H_ #define _TEXTURECACHE_TEST_H_ + #include "cocos2d.h" #include "../testBasic.h" +#include "platform/platform.h" class TextureCacheTest : public CCLayer { @@ -17,6 +19,8 @@ private: int m_nNumberOfSprites; int m_nNumberOfLoadedSprites; + struct cocos2d::cc_timeval m_time; + }; class TextureCacheTestScene : public TestScene From bc60ed7856a27b941d46a425ffc326d321c36405 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 22 Nov 2011 16:47:24 +0800 Subject: [PATCH 3/7] issue #854: optimize CCTextureCache::addImageAsync() --- cocos2dx/platform/CCImage.cpp | 7 + cocos2dx/platform/CCImage.h | 9 + cocos2dx/textures/CCTextureCache.cpp | 176 ++++++++++++------ .../TextureCacheTest/TextureCacheTest.cpp | 20 +- .../tests/TextureCacheTest/TextureCacheTest.h | 3 - 5 files changed, 142 insertions(+), 73 deletions(-) diff --git a/cocos2dx/platform/CCImage.cpp b/cocos2dx/platform/CCImage.cpp index df967956f9..be7d9cf0de 100644 --- a/cocos2dx/platform/CCImage.cpp +++ b/cocos2dx/platform/CCImage.cpp @@ -95,6 +95,13 @@ bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = e return initWithImageData(data.getBuffer(), data.getSize(), eImgFmt); } +bool CCImage::initWithImageFileThreadSafe(const char *fullpath, EImageFormat imageType) +{ + CC_UNUSED_PARAM(imageType); + CCFileData data(fullpath, "rb"); + return initWithImageData(data.getBuffer(), data.getSize(), imageType); +} + bool CCImage::initWithImageData(void * pData, int nDataLen, EImageFormat eFmt/* = eSrcFmtPng*/, diff --git a/cocos2dx/platform/CCImage.h b/cocos2dx/platform/CCImage.h index 701cc449ef..a4a0928b8d 100644 --- a/cocos2dx/platform/CCImage.h +++ b/cocos2dx/platform/CCImage.h @@ -63,6 +63,15 @@ public: */ bool initWithImageFile(const char * strPath, EImageFormat imageType = kFmtPng); + /* + @brief The same meaning as initWithImageFile, but it is thread safe. It is casued by + loadImage() in CCTextureCache.cpp. + @param fullpath full path of the file + @param imageType the type of image, now only support tow types. + @return true if load correctly + */ + bool initWithImageFileThreadSafe(const char *fullpath, EImageFormat imageType = kFmtPng); + /** @brief Load image from stream buffer. diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index b4cb2daa23..1fcd9c63df 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -23,11 +23,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#define COCOS2D_DEBUG 1 #include #include #include +#include #include "CCTextureCache.h" #include "CCTexture2D.h" #include "ccMacros.h" @@ -50,13 +50,23 @@ typedef struct _AsyncStruct SEL_CallFuncO selector; } AsyncStruct; -static cocos2d::CCImage* s_pImageAsync; -// only allow one loading thread at a time -static pthread_mutex_t s_loadingThreadMutex; +typedef struct _ImageInfo +{ + AsyncStruct *asyncStruct; + CCImage *image; +} ImageInfo; + +static pthread_t s_loadingThread; + +static pthread_mutex_t s_asyncStructQueueMutex; +static pthread_mutex_t s_ImageInfoMutex; + // condition static pthread_cond_t s_condition; static pthread_mutex_t s_conditionMutex; -static AsyncStruct *s_pAsyncObject; + +static std::queue *s_pAsyncStructQueue; +static std::queue *s_pImageQueue; static void* loadImage(void* data) { @@ -64,41 +74,87 @@ static void* loadImage(void* data) CCThread thread; thread.createAutoreleasePool(); - if (! ((AsyncStruct*)data)->filename.c_str()) + AsyncStruct *pAsyncStruct = NULL; + CCImage *pImage = NULL; + + while (true) { - return 0; - } + std::queue *pQueue = s_pAsyncStructQueue; - // one loading thread at a time - pthread_mutex_lock(&s_loadingThreadMutex); + pthread_mutex_lock(&s_asyncStructQueueMutex); + if (pQueue->empty()) + { + pthread_mutex_unlock(&s_asyncStructQueueMutex); - s_pAsyncObject = (AsyncStruct*)data; - const char *filename = s_pAsyncObject->filename.c_str(); - - CCLOG("thread 0x%x is loading image %s", pthread_self(), filename); - - CCImage *tmpImage = new CCImage(); - tmpImage->initWithImageFile(filename); - s_pImageAsync = tmpImage; - - /* Wait for rendering thread to comsume the image. - * The implemntation of pthread_cond_wait() of win32 has a bug, it can not - * wait the condition at first time. - */ + /* Wait for rendering thread to add loading image info. + * The implemntation of pthread_cond_wait() of win32 has a bug, it can not + * wait the condition at first time. + */ #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) - static bool firstRun = true; - if (firstRun) - { - pthread_cond_wait(&s_condition, &s_conditionMutex); - firstRun = false; - } + static bool firstRun = true; + if (firstRun) + { + pthread_cond_wait(&s_condition, &s_conditionMutex); + firstRun = false; + } #endif - pthread_cond_wait(&s_condition, &s_conditionMutex); + pthread_cond_wait(&s_condition, &s_conditionMutex); - CCLOG("thread 0x%x has pass the condition, new loading thread is avalable", pthread_self()); + continue; + } + else + { + // get async struct from queue + pAsyncStruct = pQueue->front(); + pQueue->pop(); + pthread_mutex_unlock(&s_asyncStructQueueMutex); + } - pthread_mutex_unlock(&s_loadingThreadMutex); + const char *filename = pAsyncStruct->filename.c_str(); + CCLOG("thread 0x%x is loading image %s", pthread_self(), filename); + + // generate image + CCImage *pImage = NULL; + if (std::string::npos != pAsyncStruct->filename.find(".jpg") || std::string::npos != pAsyncStruct->filename.find(".jpeg")) + { + pImage = new CCImage(); + if (!pImage->initWithImageFileThreadSafe(filename, cocos2d::CCImage::kFmtJpg)) + { + delete pImage; + CCLOG("can not load %s", filename); + continue; + } + } + else if (std::string::npos != pAsyncStruct->filename.find(".png")) + { + pImage = new CCImage(); + if (! pImage->initWithImageFileThreadSafe(filename, cocos2d::CCImage::kFmtPng)) + { + delete pImage; + CCLOG("can not load %s", filename); + continue; + } + } + else + { + CCLog("unsupportted format %s",filename); + delete pAsyncStruct; + + continue; + } + + // generate image info + ImageInfo *pImageInfo = new ImageInfo(); + pImageInfo->asyncStruct = pAsyncStruct; + pImageInfo->image = pImage; + + // put the image info into the queue + pthread_mutex_lock(&s_ImageInfoMutex); + s_pImageQueue->push(pImageInfo); + pthread_mutex_unlock(&s_ImageInfoMutex); + } + return 0; } @@ -166,40 +222,60 @@ void CCTextureCache::addImageAsync(const char *path, SelectorProtocol *target, S // lazy init static bool firstRun = true; if (firstRun) - { - pthread_mutex_init(&s_loadingThreadMutex, NULL); + { + s_pAsyncStructQueue = new queue(); + s_pImageQueue = new queue(); + + pthread_mutex_init(&s_asyncStructQueueMutex, NULL); pthread_mutex_init(&s_conditionMutex, NULL); pthread_cond_init(&s_condition, NULL); - s_pImageAsync = NULL; + pthread_mutex_init(&s_ImageInfoMutex, NULL); + pthread_create(&s_loadingThread, NULL, loadImage, NULL); CCScheduler::sharedScheduler()->scheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this, 0, false); - + firstRun = false; } + // generate async struct AsyncStruct *data = new AsyncStruct(); data->filename = fullpath.c_str(); data->target = target; data->selector = selector; - // load image in a new thread - pthread_t p; - pthread_create(&p, NULL, loadImage, (void*)data); + // add async struct into queue + pthread_mutex_lock(&s_asyncStructQueueMutex); + s_pAsyncStructQueue->push(data); + pthread_cond_signal(&s_condition); + pthread_mutex_unlock(&s_asyncStructQueueMutex); } void CCTextureCache::addImageAsyncCallBack(ccTime dt) { // the image is generated in loading thread - if (s_pImageAsync != NULL) + std::queue *imagesQueue = s_pImageQueue; + + pthread_mutex_lock(&s_ImageInfoMutex); + if (imagesQueue->empty()) { - - SelectorProtocol *target = s_pAsyncObject->target; - SEL_CallFuncO selector = s_pAsyncObject->selector; - const char* filename = s_pAsyncObject->filename.c_str(); + pthread_mutex_unlock(&s_ImageInfoMutex); + } + else + { + ImageInfo *pImageInfo = imagesQueue->front(); + imagesQueue->pop(); + pthread_mutex_unlock(&s_ImageInfoMutex); + + AsyncStruct *pAsyncStruct = pImageInfo->asyncStruct; + CCImage *pImage = pImageInfo->image; + + SelectorProtocol *target = pAsyncStruct->target; + SEL_CallFuncO selector = pAsyncStruct->selector; + const char* filename = pAsyncStruct->filename.c_str(); // generate texture in render thread CCTexture2D *texture = new CCTexture2D(); - texture->initWithImage(s_pImageAsync); + texture->initWithImage(pImage); // cache the texture m_pTextures->setObject(texture, filename); @@ -207,13 +283,9 @@ void CCTextureCache::addImageAsyncCallBack(ccTime dt) (target->*selector)(texture); - // the object is newed in addImageAsync() and will be assigned in the loading thread - delete s_pAsyncObject; - - delete s_pImageAsync; - s_pImageAsync = NULL; - - pthread_cond_signal(&s_condition); + delete pImage; + delete pAsyncStruct; + delete pImageInfo; } } diff --git a/tests/tests/TextureCacheTest/TextureCacheTest.cpp b/tests/tests/TextureCacheTest/TextureCacheTest.cpp index bb60cf4c03..2b62bf36d4 100644 --- a/tests/tests/TextureCacheTest/TextureCacheTest.cpp +++ b/tests/tests/TextureCacheTest/TextureCacheTest.cpp @@ -6,7 +6,7 @@ using namespace cocos2d; TextureCacheTest::TextureCacheTest() -: m_nNumberOfSprites(24) +: m_nNumberOfSprites(20) , m_nNumberOfLoadedSprites(0) { CCSize size = CCDirector::sharedDirector()->getWinSize(); @@ -20,8 +20,6 @@ TextureCacheTest::TextureCacheTest() this->addChild(m_pLabelLoading); this->addChild(m_pLabelPercent); - CCTime::gettimeofdayCocos2d(&m_time, NULL); - // load textrues CCTextureCache::sharedTextureCache()->addImageAsync("Images/HelloWorld.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); CCTextureCache::sharedTextureCache()->addImageAsync("Images/grossini.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); @@ -42,11 +40,7 @@ TextureCacheTest::TextureCacheTest() CCTextureCache::sharedTextureCache()->addImageAsync("Images/background1.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); CCTextureCache::sharedTextureCache()->addImageAsync("Images/background2.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); CCTextureCache::sharedTextureCache()->addImageAsync("Images/background3.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); - CCTextureCache::sharedTextureCache()->addImageAsync("Images/background1-hd.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); - CCTextureCache::sharedTextureCache()->addImageAsync("Images/background2-hd.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); - CCTextureCache::sharedTextureCache()->addImageAsync("Images/background3-hd.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); CCTextureCache::sharedTextureCache()->addImageAsync("Images/blocks.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); - CCTextureCache::sharedTextureCache()->addImageAsync("Images/blocks-hd.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack)); } void TextureCacheTest::loadingCallBack(CCObject *obj) @@ -66,12 +60,6 @@ void TextureCacheTest::loadingCallBack(CCObject *obj) void TextureCacheTest::addSprite() { - - struct cc_timeval endTime; - CCTime::gettimeofdayCocos2d(&endTime, NULL); - - CCLog("time is %d secodes %d ns", endTime.tv_sec - m_time.tv_sec, endTime.tv_usec - m_time.tv_usec); - CCSize size = CCDirector::sharedDirector()->getWinSize(); // create sprites @@ -99,11 +87,7 @@ void TextureCacheTest::addSprite() CCSprite *s16 = CCSprite::spriteWithFile("Images/background1.png"); CCSprite *s17 = CCSprite::spriteWithFile("Images/background2.png"); CCSprite *s18 = CCSprite::spriteWithFile("Images/background3.png"); - CCSprite *s19 = CCSprite::spriteWithFile("Images/background1-hd.png"); - CCSprite *s20 = CCSprite::spriteWithFile("Images/background2-hd.png"); - CCSprite *s21 = CCSprite::spriteWithFile("Images/background3-hd.png"); - CCSprite *s22 = CCSprite::spriteWithFile("Images/blocks.png"); - CCSprite *s23 = CCSprite::spriteWithFile("Images/blocks-hd.png"); + CCSprite *s19 = CCSprite::spriteWithFile("Images/blocks.png"); s1->setPosition(CCPointMake(50, 50)); s2->setPosition(CCPointMake(60, 50)); diff --git a/tests/tests/TextureCacheTest/TextureCacheTest.h b/tests/tests/TextureCacheTest/TextureCacheTest.h index 75b60bc607..57843ff2be 100644 --- a/tests/tests/TextureCacheTest/TextureCacheTest.h +++ b/tests/tests/TextureCacheTest/TextureCacheTest.h @@ -18,9 +18,6 @@ private: cocos2d::CCLabelTTF *m_pLabelPercent; int m_nNumberOfSprites; int m_nNumberOfLoadedSprites; - - struct cocos2d::cc_timeval m_time; - }; class TextureCacheTestScene : public TestScene From 8b20639d755c1cca6bc6cbb3a8dd0966dca882ef Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 23 Nov 2011 11:02:18 +0800 Subject: [PATCH 4/7] issue #838: HelloWorld support x86 --- HelloWorld/Classes/Android.mk | 18 +++++ HelloWorld/android/build.properties | 17 ---- HelloWorld/android/build.xml | 79 ------------------- HelloWorld/android/build_native.sh | 2 +- HelloWorld/android/jni/Android.mk | 2 +- HelloWorld/android/jni/Application.mk | 4 +- HelloWorld/android/jni/helloworld/Android.mk | 15 +--- HelloWorld/android/local.properties | 10 --- HelloWorld/android/proguard.cfg | 40 ---------- .../cocos2dx/application/ApplicationDemo.java | 1 + cocos2dx/Android.mk | 8 +- .../armeabi-v7a/libcurl.a.REMOVED.git-id | 1 + .../armeabi-v7a/libiconv.a.REMOVED.git-id | 1 + .../armeabi-v7a/libjpeg.a.REMOVED.git-id | 1 + .../armeabi-v7a/libpng.a.REMOVED.git-id | 1 + .../armeabi-v7a/libxml2.a.REMOVED.git-id | 1 + .../{ => armeabi}/libcurl.a.REMOVED.git-id | 0 .../{ => armeabi}/libjpeg.a.REMOVED.git-id | 0 .../{ => armeabi}/libpng.a.REMOVED.git-id | 0 .../{ => armeabi}/libxml2.a.REMOVED.git-id | 0 .../libraries/x86/libcurl.a.REMOVED.git-id | 1 + .../libraries/x86/libiconv.a.REMOVED.git-id | 1 + .../libraries/x86/libjpeg.a.REMOVED.git-id | 1 + .../libraries/x86/libpng.a.REMOVED.git-id | 1 + .../libraries/x86/libxml2.a.REMOVED.git-id | 1 + tests/test.android/build_native.sh | 2 +- 26 files changed, 39 insertions(+), 169 deletions(-) create mode 100644 HelloWorld/Classes/Android.mk delete mode 100644 HelloWorld/android/build.properties delete mode 100644 HelloWorld/android/build.xml delete mode 100644 HelloWorld/android/local.properties delete mode 100644 HelloWorld/android/proguard.cfg create mode 100644 cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libcurl.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libiconv.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libjpeg.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libpng.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libxml2.a.REMOVED.git-id rename cocos2dx/platform/third_party/android/libraries/{ => armeabi}/libcurl.a.REMOVED.git-id (100%) rename cocos2dx/platform/third_party/android/libraries/{ => armeabi}/libjpeg.a.REMOVED.git-id (100%) rename cocos2dx/platform/third_party/android/libraries/{ => armeabi}/libpng.a.REMOVED.git-id (100%) rename cocos2dx/platform/third_party/android/libraries/{ => armeabi}/libxml2.a.REMOVED.git-id (100%) create mode 100644 cocos2dx/platform/third_party/android/libraries/x86/libcurl.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/x86/libiconv.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/x86/libjpeg.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/x86/libpng.a.REMOVED.git-id create mode 100644 cocos2dx/platform/third_party/android/libraries/x86/libxml2.a.REMOVED.git-id diff --git a/HelloWorld/Classes/Android.mk b/HelloWorld/Classes/Android.mk new file mode 100644 index 0000000000..3de3012b0d --- /dev/null +++ b/HelloWorld/Classes/Android.mk @@ -0,0 +1,18 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) +LOCAL_MODULE := game_logic + +LOCAL_SRC_FILES := AppDelegate.cpp \ + HelloWorldScene.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../cocos2dx \ + $(LOCAL_PATH)/../../cocos2dx/platform \ + $(LOCAL_PATH)/../../cocos2dx/include \ + $(LOCAL_PATH)/../../CocosDenshion/include \ + $(LOCAL_PATH)/../../cocos2dx/lua_support + +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../android/libs/$(TARGET_ARCH_ABI)) \ + -lcocos2d -lcocosdenshion \ + -L$(call host-path, $(LOCAL_PATH)/../../cocos2dx/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) -lcurl + +include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/HelloWorld/android/build.properties b/HelloWorld/android/build.properties deleted file mode 100644 index ee52d86d94..0000000000 --- a/HelloWorld/android/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/HelloWorld/android/build.xml b/HelloWorld/android/build.xml deleted file mode 100644 index 768294d19c..0000000000 --- a/HelloWorld/android/build.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/HelloWorld/android/build_native.sh b/HelloWorld/android/build_native.sh index 115d83cb90..ae927d8043 100644 --- a/HelloWorld/android/build_native.sh +++ b/HelloWorld/android/build_native.sh @@ -1,5 +1,5 @@ # set params -ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6 +ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6b COCOS2DX_ROOT=/cygdrive/e/cocos2d-x HELLOWORLD_ROOT=$COCOS2DX_ROOT/HelloWorld/android diff --git a/HelloWorld/android/jni/Android.mk b/HelloWorld/android/jni/Android.mk index bdef5abe06..87e30c591e 100644 --- a/HelloWorld/android/jni/Android.mk +++ b/HelloWorld/android/jni/Android.mk @@ -5,6 +5,6 @@ subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \ cocos2dx \ CocosDenshion/android \ )) -subdirs += $(LOCAL_PATH)/helloworld/Android.mk +subdirs += $(LOCAL_PATH)/../../Classes/Android.mk $(LOCAL_PATH)/helloworld/Android.mk include $(subdirs) diff --git a/HelloWorld/android/jni/Application.mk b/HelloWorld/android/jni/Application.mk index 40ab23a70f..949f3e9f17 100644 --- a/HelloWorld/android/jni/Application.mk +++ b/HelloWorld/android/jni/Application.mk @@ -1,4 +1,6 @@ # it is needed for ndk-r5 APP_STL := stlport_static -APP_MODULES := cocos2d cocosdenshion helloworld \ No newline at end of file +APP_ABI := armeabi armeabi-v7a + +APP_MODULES := cocos2d cocosdenshion game_logic helloworld \ No newline at end of file diff --git a/HelloWorld/android/jni/helloworld/Android.mk b/HelloWorld/android/jni/helloworld/Android.mk index 76214b8f5b..b243aec831 100644 --- a/HelloWorld/android/jni/helloworld/Android.mk +++ b/HelloWorld/android/jni/helloworld/Android.mk @@ -2,23 +2,14 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := helloworld -LOCAL_SRC_FILES := main.cpp \ -../../../Classes/AppDelegate.cpp \ -../../../Classes/HelloWorldScene.cpp +LOCAL_SRC_FILES := main.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \ $(LOCAL_PATH)/../../../../cocos2dx/platform \ $(LOCAL_PATH)/../../../../cocos2dx/include \ - $(LOCAL_PATH)/../../../../cocos2dx/lua_support \ - $(LOCAL_PATH)/../../../../CocosDenshion/include \ $(LOCAL_PATH)/../../../Classes -# it is used for ndk-r5 -# if you build with ndk-r4, comment it -# because the new Windows toolchain doesn't support Cygwin's drive -# mapping (i.e /cygdrive/c/ instead of C:/) -LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \ - -lcocos2d -llog -lcocosdenshion \ - -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/$(TARGET_ARCH_ABI)) \ + -lcocos2d -llog -lgame_logic include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/HelloWorld/android/local.properties b/HelloWorld/android/local.properties deleted file mode 100644 index ba25bfda91..0000000000 --- a/HelloWorld/android/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked in Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk.dir=/home/laschweinski/android/android-sdk-linux_86 diff --git a/HelloWorld/android/proguard.cfg b/HelloWorld/android/proguard.cfg deleted file mode 100644 index b1cdf17b5b..0000000000 --- a/HelloWorld/android/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/HelloWorld/android/src/org/cocos2dx/application/ApplicationDemo.java b/HelloWorld/android/src/org/cocos2dx/application/ApplicationDemo.java index 1351b74c59..dd74d421eb 100644 --- a/HelloWorld/android/src/org/cocos2dx/application/ApplicationDemo.java +++ b/HelloWorld/android/src/org/cocos2dx/application/ApplicationDemo.java @@ -58,6 +58,7 @@ public class ApplicationDemo extends Cocos2dxActivity{ static { System.loadLibrary("cocos2d"); System.loadLibrary("cocosdenshion"); + System.loadLibrary("game_logic"); System.loadLibrary("helloworld"); } } diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index f806b8c242..66320cfc22 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -104,8 +104,6 @@ tileMap_parallax_nodes/CCTileMapAtlas.cpp \ touch_dispatcher/CCTouchDispatcher.cpp \ touch_dispatcher/CCTouchHandler.cpp - - LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \ $(LOCAL_PATH)/include \ $(LOCAL_PATH)/platform \ @@ -114,11 +112,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \ $(LOCAL_PATH)/platform/third_party/android/libxml2 \ $(LOCAL_PATH)/platform/third_party/android/libjpeg -# it is used for ndk-r5 -# if you build with ndk-r4, comment it -# because the new Windows toolchain doesn't support Cygwin's drive -# mapping (i.e /cygdrive/c/ instead of C:/) -LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries) \ +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) \ -lGLESv1_CM -llog -lz \ -lpng \ -lxml2 \ diff --git a/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libcurl.a.REMOVED.git-id new file mode 100644 index 0000000000..85faa41a12 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libcurl.a.REMOVED.git-id @@ -0,0 +1 @@ +89c49d395ece44cf2d891cd5c2a84f819e229d30 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libiconv.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libiconv.a.REMOVED.git-id new file mode 100644 index 0000000000..58dbd5283f --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libiconv.a.REMOVED.git-id @@ -0,0 +1 @@ +ed7341a4fe082dfc3323ab2808729baf6faf72a6 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libjpeg.a.REMOVED.git-id new file mode 100644 index 0000000000..124780e2de --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libjpeg.a.REMOVED.git-id @@ -0,0 +1 @@ +09011474ff4df140a34e82e7cdb5c86cf9a522bc \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libpng.a.REMOVED.git-id new file mode 100644 index 0000000000..91949aab14 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libpng.a.REMOVED.git-id @@ -0,0 +1 @@ +d3c4c2e8858fd0eb83f2f4f8e501d10394836add \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libxml2.a.REMOVED.git-id new file mode 100644 index 0000000000..099c19a8ca --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/armeabi-v7a/libxml2.a.REMOVED.git-id @@ -0,0 +1 @@ +9666bcac0a33d1dcfd5361266eca55f1bace1daf \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi/libcurl.a.REMOVED.git-id similarity index 100% rename from cocos2dx/platform/third_party/android/libraries/libcurl.a.REMOVED.git-id rename to cocos2dx/platform/third_party/android/libraries/armeabi/libcurl.a.REMOVED.git-id diff --git a/cocos2dx/platform/third_party/android/libraries/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi/libjpeg.a.REMOVED.git-id similarity index 100% rename from cocos2dx/platform/third_party/android/libraries/libjpeg.a.REMOVED.git-id rename to cocos2dx/platform/third_party/android/libraries/armeabi/libjpeg.a.REMOVED.git-id diff --git a/cocos2dx/platform/third_party/android/libraries/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi/libpng.a.REMOVED.git-id similarity index 100% rename from cocos2dx/platform/third_party/android/libraries/libpng.a.REMOVED.git-id rename to cocos2dx/platform/third_party/android/libraries/armeabi/libpng.a.REMOVED.git-id diff --git a/cocos2dx/platform/third_party/android/libraries/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/armeabi/libxml2.a.REMOVED.git-id similarity index 100% rename from cocos2dx/platform/third_party/android/libraries/libxml2.a.REMOVED.git-id rename to cocos2dx/platform/third_party/android/libraries/armeabi/libxml2.a.REMOVED.git-id diff --git a/cocos2dx/platform/third_party/android/libraries/x86/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/x86/libcurl.a.REMOVED.git-id new file mode 100644 index 0000000000..9747da75e9 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/x86/libcurl.a.REMOVED.git-id @@ -0,0 +1 @@ +fca1b81187a22728c6c352f121ac03f8abf2ae75 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/x86/libiconv.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/x86/libiconv.a.REMOVED.git-id new file mode 100644 index 0000000000..a42972f326 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/x86/libiconv.a.REMOVED.git-id @@ -0,0 +1 @@ +f8727a9fe8bb39473706cd3b98cb9a12a4304c6f \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/x86/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/x86/libjpeg.a.REMOVED.git-id new file mode 100644 index 0000000000..c74dda1967 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/x86/libjpeg.a.REMOVED.git-id @@ -0,0 +1 @@ +42f26e695ffe165b38102fd3b9bd0e2be617bf2b \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/x86/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/x86/libpng.a.REMOVED.git-id new file mode 100644 index 0000000000..7cc65fe607 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/x86/libpng.a.REMOVED.git-id @@ -0,0 +1 @@ +e3e0e06dbb367746764f6b1146884f6ef75bb5a2 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/libraries/x86/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/libraries/x86/libxml2.a.REMOVED.git-id new file mode 100644 index 0000000000..0e52a14480 --- /dev/null +++ b/cocos2dx/platform/third_party/android/libraries/x86/libxml2.a.REMOVED.git-id @@ -0,0 +1 @@ +3100e9f83cf078971b4b48b757bf5ebac2d02d37 \ No newline at end of file diff --git a/tests/test.android/build_native.sh b/tests/test.android/build_native.sh index 008817f290..c478c196ec 100644 --- a/tests/test.android/build_native.sh +++ b/tests/test.android/build_native.sh @@ -1,6 +1,6 @@ #!/bin/bash # set params -ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6 +ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6b COCOS2DX_ROOT=/cygdrive/e/cocos2d-x TESTS_ROOT=$COCOS2DX_ROOT/tests/test.android From 6aedc258b48164302f6d7be86c49bf475b040893 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 23 Nov 2011 15:51:30 +0800 Subject: [PATCH 5/7] fixed #838: tests and HelloLua support x86 --- HelloLua/Classes/Android.mk | 29 +++++ HelloLua/Classes/AppDelegate.cpp | 3 +- HelloLua/Resource/hello.lua | 4 +- HelloLua/android/build_native.sh | 4 +- HelloLua/android/jni/Android.mk | 2 +- HelloLua/android/jni/Application.mk | 3 +- HelloLua/android/jni/helloworld/Android.mk | 26 +---- .../src/org/cocos2dx/hellolua/HelloLua.java | 1 + cocos2dx/Android.mk | 2 +- .../LuaCocos2d.cpp.REMOVED.git-id | 2 +- tests/Android.mk | 108 +++++++++++++++++ tests/test.android/jni/Android.mk | 8 +- tests/test.android/jni/Application.mk | 2 +- tests/test.android/jni/tests/Android.mk | 110 ++---------------- .../src/org/cocos2dx/tests/TestsDemo.java | 1 + 15 files changed, 167 insertions(+), 138 deletions(-) create mode 100644 HelloLua/Classes/Android.mk create mode 100644 tests/Android.mk diff --git a/HelloLua/Classes/Android.mk b/HelloLua/Classes/Android.mk new file mode 100644 index 0000000000..2aa7d085ed --- /dev/null +++ b/HelloLua/Classes/Android.mk @@ -0,0 +1,29 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) +LOCAL_MODULE := game_logic + +LOCAL_SRC_FILES := \ +AppDelegate.cpp \ +../../lua/cocos2dx_support/LuaEngineImpl.cpp \ +../../lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \ +../../lua/cocos2dx_support/LuaCocos2d.cpp \ +../../lua/cocos2dx_support/LuaEngine.cpp \ +../../lua/CocosDenshion_support/LuaSimpleAudioEngine.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../cocos2dx \ + $(LOCAL_PATH)/../../cocos2dx/platform \ + $(LOCAL_PATH)/../../cocos2dx/include \ + $(LOCAL_PATH)/../../cocos2dx/lua_support \ + $(LOCAL_PATH)/../../CocosDenshion/include \ + $(LOCAL_PATH)/../../lua/lua \ + $(LOCAL_PATH)/../../lua/tolua \ + $(LOCAL_PATH)/../../lua/cocos2dx_support \ + $(LOCAL_PATH)/../../lua/CocosDenshion_support + +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../Android/libs/$(TARGET_ARCH_ABI)) \ + -L$(call host-path, $(LOCAL_PATH)/../../cocos2dx/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) -lcurl \ + -lcocos2d \ + -lcocosdenshion \ + -llua + +include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/HelloLua/Classes/AppDelegate.cpp b/HelloLua/Classes/AppDelegate.cpp index 6f1a9cec12..af983e2c1f 100644 --- a/HelloLua/Classes/AppDelegate.cpp +++ b/HelloLua/Classes/AppDelegate.cpp @@ -24,7 +24,8 @@ using namespace CocosDenshion; AppDelegate::AppDelegate() :m_pLuaEngine(NULL) { - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); + // fixed me + //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); } AppDelegate::~AppDelegate() diff --git a/HelloLua/Resource/hello.lua b/HelloLua/Resource/hello.lua index 638204f7c7..b6eec66108 100644 --- a/HelloLua/Resource/hello.lua +++ b/HelloLua/Resource/hello.lua @@ -97,13 +97,13 @@ animation:addFrame(frame0) animation:addFrame(frame1) animation:setDelay(0.5) animation:setName('wait') ---[[ + animFrames = cocos2d.CCMutableArray_CCSpriteFrame__:new(2) animFrames:addObject(frame0) animFrames:addObject(frame1) --animation = cocos2d.CCAnimation:animationWithName("wait", 0.5, animFrames) animation = cocos2d.CCAnimation:animationWithFrames(animFrames,0.5) ---]] + animation = cocos2d.CCAnimation:animationWithFrames(animFrames, 0.5) diff --git a/HelloLua/android/build_native.sh b/HelloLua/android/build_native.sh index f1130165e2..9e649f7b32 100755 --- a/HelloLua/android/build_native.sh +++ b/HelloLua/android/build_native.sh @@ -1,6 +1,6 @@ # set params -ANDROID_NDK_ROOT=/cygdrive/e/android-ndk-r5 -COCOS2DX_ROOT=/cygdrive/d/Work7/cocos2d-x +ANDROID_NDK_ROOT=/cygdrive/d/programe/android/ndk/android-ndk-r6b +COCOS2DX_ROOT=/cygdrive/e/cocos2d-x GAME_ROOT=$COCOS2DX_ROOT/HelloLua GAME_ANDROID_ROOT=$GAME_ROOT/android diff --git a/HelloLua/android/jni/Android.mk b/HelloLua/android/jni/Android.mk index 5d455d298a..e2b1dcd516 100644 --- a/HelloLua/android/jni/Android.mk +++ b/HelloLua/android/jni/Android.mk @@ -6,6 +6,6 @@ subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \ CocosDenshion/android \ lua/proj.android/jni \ )) -subdirs += $(LOCAL_PATH)/helloworld/Android.mk +subdirs += $(LOCAL_PATH)/../../Classes/Android.mk $(LOCAL_PATH)/helloworld/Android.mk include $(subdirs) diff --git a/HelloLua/android/jni/Application.mk b/HelloLua/android/jni/Application.mk index ffaaa6b6e3..159ad1f27f 100644 --- a/HelloLua/android/jni/Application.mk +++ b/HelloLua/android/jni/Application.mk @@ -1,3 +1,4 @@ # it is needed for ndk-r5 APP_STL := stlport_static -APP_MODULES := cocos2d cocosdenshion lua game \ No newline at end of file + +APP_MODULES := cocos2d cocosdenshion lua game_logic game \ No newline at end of file diff --git a/HelloLua/android/jni/helloworld/Android.mk b/HelloLua/android/jni/helloworld/Android.mk index eacc52e456..0dad951782 100644 --- a/HelloLua/android/jni/helloworld/Android.mk +++ b/HelloLua/android/jni/helloworld/Android.mk @@ -2,32 +2,16 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := game -LOCAL_SRC_FILES := main.cpp \ -../../../Classes/AppDelegate.cpp \ -../../../../lua/cocos2dx_support/LuaEngineImpl.cpp \ -../../../../lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \ -../../../../lua/cocos2dx_support/LuaCocos2d.cpp \ -../../../../lua/cocos2dx_support/LuaEngine.cpp \ -../../../../lua/CocosDenshion_support/LuaSimpleAudioEngine.cpp +LOCAL_SRC_FILES := main.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \ $(LOCAL_PATH)/../../../../cocos2dx/platform \ $(LOCAL_PATH)/../../../../cocos2dx/include \ - $(LOCAL_PATH)/../../../../cocos2dx/lua_support \ - $(LOCAL_PATH)/../../../../CocosDenshion/include \ - $(LOCAL_PATH)/../../../Classes \ - $(LOCAL_PATH)/../../../../lua/lua \ - $(LOCAL_PATH)/../../../../lua/tolua \ $(LOCAL_PATH)/../../../../lua/cocos2dx_support \ - $(LOCAL_PATH)/../../../../lua/CocosDenshion_support -# it is used for ndk-r5 -# if you build with ndk-r4, comment it -# because the new Windows toolchain doesn't support Cygwin's drive -# mapping (i.e /cygdrive/c/ instead of C:/) -LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \ - -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl \ + $(LOCAL_PATH)/../../../Classes + +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/$(TARGET_ARCH_ABI)) \ -lcocos2d \ - -lcocosdenshion \ - -llua + -lgame_logic include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/HelloLua/android/src/org/cocos2dx/hellolua/HelloLua.java b/HelloLua/android/src/org/cocos2dx/hellolua/HelloLua.java index 762f6d1735..ad61ccfd01 100644 --- a/HelloLua/android/src/org/cocos2dx/hellolua/HelloLua.java +++ b/HelloLua/android/src/org/cocos2dx/hellolua/HelloLua.java @@ -60,6 +60,7 @@ public class HelloLua extends Cocos2dxActivity{ System.loadLibrary("cocos2d"); System.loadLibrary("cocosdenshion"); System.loadLibrary("lua"); + System.loadLibrary("game_logic"); System.loadLibrary("game"); } } diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index 66320cfc22..4d66db1dd1 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -110,7 +110,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \ $(LOCAL_PATH)/platform/third_party/android/iconv \ $(LOCAL_PATH)/platform/third_party/android/libpng \ $(LOCAL_PATH)/platform/third_party/android/libxml2 \ - $(LOCAL_PATH)/platform/third_party/android/libjpeg + $(LOCAL_PATH)/platform/third_party/android/libjpeg LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) \ -lGLESv1_CM -llog -lz \ diff --git a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index d38fdef326..4f6cf8b449 100644 --- a/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -dd5941759f1e46eade02974d86ba7cbe12e19a17 \ No newline at end of file +951c67fac55daba4ee275b27a56bc63831d0ac44 \ No newline at end of file diff --git a/tests/Android.mk b/tests/Android.mk new file mode 100644 index 0000000000..0ef59b3d42 --- /dev/null +++ b/tests/Android.mk @@ -0,0 +1,108 @@ +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) +LOCAL_MODULE := game_logic + +LOCAL_SRC_FILES := \ +tests/AccelerometerTest/AccelerometerTest.cpp \ +tests/ActionManagerTest/ActionManagerTest.cpp \ +tests/ActionsTest/ActionsTest.cpp \ +tests/Box2DTest/Box2dTest.cpp \ +tests/Box2DTestBed/Box2dView.cpp \ +tests/Box2DTestBed/GLES-Render.cpp \ +tests/Box2DTestBed/Test.cpp \ +tests/Box2DTestBed/TestEntries.cpp \ +tests/BugsTest/Bug-1159.cpp \ +tests/BugsTest/Bug-1174.cpp \ +tests/BugsTest/Bug-350.cpp \ +tests/BugsTest/Bug-422.cpp \ +tests/BugsTest/Bug-624.cpp \ +tests/BugsTest/Bug-886.cpp \ +tests/BugsTest/Bug-899.cpp \ +tests/BugsTest/Bug-914.cpp \ +tests/BugsTest/BugsTest.cpp \ +tests/BugsTest/Bug-458/Bug-458.cpp \ +tests/BugsTest/Bug-458/QuestionContainerSprite.cpp \ +tests/ChipmunkTest/Bounce.cpp \ +tests/ChipmunkTest/Joints.cpp \ +tests/ChipmunkTest/LogoSmash.cpp \ +tests/ChipmunkTest/MagnetsElectric.cpp \ +tests/ChipmunkTest/OneWay.cpp \ +tests/ChipmunkTest/Planet.cpp \ +tests/ChipmunkTest/Player.cpp \ +tests/ChipmunkTest/Plink.cpp \ +tests/ChipmunkTest/Pump.cpp \ +tests/ChipmunkTest/PyramidStack.cpp \ +tests/ChipmunkTest/PyramidTopple.cpp \ +tests/ChipmunkTest/Query.cpp \ +tests/ChipmunkTest/Sensors.cpp \ +tests/ChipmunkTest/Simple.cpp \ +tests/ChipmunkTest/Springies.cpp \ +tests/ChipmunkTest/Tank.cpp \ +tests/ChipmunkTest/TheoJansen.cpp \ +tests/ChipmunkTest/Tumble.cpp \ +tests/ChipmunkTest/UnsafeOps.cpp \ +tests/ChipmunkTest/cocos2dChipmunkDemo.cpp \ +tests/ChipmunkTest/drawSpace.cpp \ +tests/ClickAndMoveTest/ClickAndMoveTest.cpp \ +tests/CocosDenshionTest/CocosDenshionTest.cpp \ +tests/CocosNodeTest/CocosNodeTest.cpp \ +tests/CurlTest/CurlTest.cpp \ +tests/CurrentLanguageTest/CurrentLanguageTest.cpp \ +tests/DirectorTest/DirectorTest.cpp \ +tests/DrawPrimitivesTest/DrawPrimitivesTest.cpp \ +tests/EaseActionsTest/EaseActionsTest.cpp \ +tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp \ +tests/EffectsTest/EffectsTest.cpp \ +tests/FontTest/FontTest.cpp \ +tests/HiResTest/HiResTest.cpp \ +tests/IntervalTest/IntervalTest.cpp \ +tests/KeypadTest/KeypadTest.cpp \ +tests/LabelTest/LabelTest.cpp \ +tests/LayerTest/LayerTest.cpp \ +tests/TextInputTest/TextInputTest.cpp \ +tests/MenuTest/MenuTest.cpp \ +tests/MotionStreakTest/MotionStreakTest.cpp \ +tests/ParallaxTest/ParallaxTest.cpp \ +tests/ParticleTest/ParticleTest.cpp \ +tests/PerformanceTest/PerformanceNodeChildrenTest.cpp \ +tests/PerformanceTest/PerformanceParticleTest.cpp \ +tests/PerformanceTest/PerformanceSpriteTest.cpp \ +tests/PerformanceTest/PerformanceTest.cpp \ +tests/PerformanceTest/PerformanceTextureTest.cpp \ +tests/PerformanceTest/PerformanceTouchesTest.cpp \ +tests/ProgressActionsTest/ProgressActionsTest.cpp \ +tests/RenderTextureTest/RenderTextureTest.cpp \ +tests/RotateWorldTest/RotateWorldTest.cpp \ +tests/SceneTest/SceneTest.cpp \ +tests/SchedulerTest/SchedulerTest.cpp \ +tests/SpriteTest/SpriteTest.cpp \ +tests/TextureCacheTest/TextureCacheTest.cpp \ +tests/Texture2dTest/Texture2dTest.cpp \ +tests/TileMapTest/TileMapTest.cpp \ +tests/TouchesTest/Ball.cpp \ +tests/TouchesTest/Paddle.cpp \ +tests/TouchesTest/TouchesTest.cpp \ +tests/TransitionsTest/TransitionsTest.cpp \ +tests/UserDefaultTest/UserDefaultTest.cpp \ +tests/ZwoptexTest/ZwoptexTest.cpp \ +tests/controller.cpp \ +tests/testBasic.cpp \ +AppDelegate.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../cocos2dx \ + $(LOCAL_PATH)/../cocos2dx/include \ + $(LOCAL_PATH)/../cocos2dx/platform \ + $(LOCAL_PATH)/../cocos2dx/platform/third_party/android/ \ + $(LOCAL_PATH)/../chipmunk/include/chipmunk \ + $(LOCAL_PATH)/../CocosDenshion/include \ + $(LOCAL_PATH)/.. + + +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/test.android/libs/$(TARGET_ARCH_ABI)) \ + -lGLESv1_CM \ + -lcocos2d -llog -lcocosdenshion \ + -lbox2d -lchipmunk \ + -L$(call host-path, $(LOCAL_PATH)/../cocos2dx/platform/third_party/android/libraries/$(TARGET_ARCH_ABI)) -lcurl + +include $(BUILD_SHARED_LIBRARY) + diff --git a/tests/test.android/jni/Android.mk b/tests/test.android/jni/Android.mk index 681a7bc9a3..392ac9e3d8 100644 --- a/tests/test.android/jni/Android.mk +++ b/tests/test.android/jni/Android.mk @@ -4,10 +4,10 @@ include $(CLEAR_VARS) subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \ Box2D \ chipmunk \ - cocos2dx \ - CocosDenshion/android \ - )) + cocos2dx \ + CocosDenshion/android \ + )) -subdirs += $(LOCAL_PATH)/tests/Android.mk +subdirs += $(LOCAL_PATH)/../../Android.mk $(LOCAL_PATH)/tests/Android.mk include $(subdirs) diff --git a/tests/test.android/jni/Application.mk b/tests/test.android/jni/Application.mk index 3fa7ae5711..d5df2bccd5 100644 --- a/tests/test.android/jni/Application.mk +++ b/tests/test.android/jni/Application.mk @@ -2,4 +2,4 @@ APP_STL := stlport_static APP_ABI := armeabi armeabi-v7a -APP_MODULES := cocos2d cocosdenshion chipmunk box2d tests +APP_MODULES := cocos2d cocosdenshion chipmunk box2d game_logic tests diff --git a/tests/test.android/jni/tests/Android.mk b/tests/test.android/jni/tests/Android.mk index a6d356ff83..6191eb4b52 100644 --- a/tests/test.android/jni/tests/Android.mk +++ b/tests/test.android/jni/tests/Android.mk @@ -2,113 +2,17 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := tests -LOCAL_SRC_FILES := main.cpp \ -../../../tests/AccelerometerTest/AccelerometerTest.cpp \ -../../../tests/ActionManagerTest/ActionManagerTest.cpp \ -../../../tests/ActionsTest/ActionsTest.cpp \ -../../../tests/Box2DTest/Box2dTest.cpp \ -../../../tests/Box2DTestBed/Box2dView.cpp \ -../../../tests/Box2DTestBed/GLES-Render.cpp \ -../../../tests/Box2DTestBed/Test.cpp \ -../../../tests/Box2DTestBed/TestEntries.cpp \ -../../../tests/BugsTest/Bug-1159.cpp \ -../../../tests/BugsTest/Bug-1174.cpp \ -../../../tests/BugsTest/Bug-350.cpp \ -../../../tests/BugsTest/Bug-422.cpp \ -../../../tests/BugsTest/Bug-624.cpp \ -../../../tests/BugsTest/Bug-886.cpp \ -../../../tests/BugsTest/Bug-899.cpp \ -../../../tests/BugsTest/Bug-914.cpp \ -../../../tests/BugsTest/BugsTest.cpp \ -../../../tests/BugsTest/Bug-458/Bug-458.cpp \ -../../../tests/BugsTest/Bug-458/QuestionContainerSprite.cpp \ -../../../tests/ChipmunkTest/Bounce.cpp \ -../../../tests/ChipmunkTest/Joints.cpp \ -../../../tests/ChipmunkTest/LogoSmash.cpp \ -../../../tests/ChipmunkTest/MagnetsElectric.cpp \ -../../../tests/ChipmunkTest/OneWay.cpp \ -../../../tests/ChipmunkTest/Planet.cpp \ -../../../tests/ChipmunkTest/Player.cpp \ -../../../tests/ChipmunkTest/Plink.cpp \ -../../../tests/ChipmunkTest/Pump.cpp \ -../../../tests/ChipmunkTest/PyramidStack.cpp \ -../../../tests/ChipmunkTest/PyramidTopple.cpp \ -../../../tests/ChipmunkTest/Query.cpp \ -../../../tests/ChipmunkTest/Sensors.cpp \ -../../../tests/ChipmunkTest/Simple.cpp \ -../../../tests/ChipmunkTest/Springies.cpp \ -../../../tests/ChipmunkTest/Tank.cpp \ -../../../tests/ChipmunkTest/TheoJansen.cpp \ -../../../tests/ChipmunkTest/Tumble.cpp \ -../../../tests/ChipmunkTest/UnsafeOps.cpp \ -../../../tests/ChipmunkTest/cocos2dChipmunkDemo.cpp \ -../../../tests/ChipmunkTest/drawSpace.cpp \ -../../../tests/ClickAndMoveTest/ClickAndMoveTest.cpp \ -../../../tests/CocosDenshionTest/CocosDenshionTest.cpp \ -../../../tests/CocosNodeTest/CocosNodeTest.cpp \ -../../../tests/CurlTest/CurlTest.cpp \ -../../../tests/CurrentLanguageTest/CurrentLanguageTest.cpp \ -../../../tests/DirectorTest/DirectorTest.cpp \ -../../../tests/DrawPrimitivesTest/DrawPrimitivesTest.cpp \ -../../../tests/EaseActionsTest/EaseActionsTest.cpp \ -../../../tests/EffectsAdvancedTest/EffectsAdvancedTest.cpp \ -../../../tests/EffectsTest/EffectsTest.cpp \ -../../../tests/FontTest/FontTest.cpp \ -../../../tests/HiResTest/HiResTest.cpp \ -../../../tests/IntervalTest/IntervalTest.cpp \ -../../../tests/KeypadTest/KeypadTest.cpp \ -../../../tests/LabelTest/LabelTest.cpp \ -../../../tests/LayerTest/LayerTest.cpp \ -../../../tests/TextInputTest/TextInputTest.cpp \ -../../../tests/MenuTest/MenuTest.cpp \ -../../../tests/MotionStreakTest/MotionStreakTest.cpp \ -../../../tests/ParallaxTest/ParallaxTest.cpp \ -../../../tests/ParticleTest/ParticleTest.cpp \ -../../../tests/PerformanceTest/PerformanceNodeChildrenTest.cpp \ -../../../tests/PerformanceTest/PerformanceParticleTest.cpp \ -../../../tests/PerformanceTest/PerformanceSpriteTest.cpp \ -../../../tests/PerformanceTest/PerformanceTest.cpp \ -../../../tests/PerformanceTest/PerformanceTextureTest.cpp \ -../../../tests/PerformanceTest/PerformanceTouchesTest.cpp \ -../../../tests/ProgressActionsTest/ProgressActionsTest.cpp \ -../../../tests/RenderTextureTest/RenderTextureTest.cpp \ -../../../tests/RotateWorldTest/RotateWorldTest.cpp \ -../../../tests/SceneTest/SceneTest.cpp \ -../../../tests/SchedulerTest/SchedulerTest.cpp \ -../../../tests/SpriteTest/SpriteTest.cpp \ -../../../tests/TextureCacheTest/TextureCacheTest.cpp \ -../../../tests/Texture2dTest/Texture2dTest.cpp \ -../../../tests/TileMapTest/TileMapTest.cpp \ -../../../tests/TouchesTest/Ball.cpp \ -../../../tests/TouchesTest/Paddle.cpp \ -../../../tests/TouchesTest/TouchesTest.cpp \ -../../../tests/TransitionsTest/TransitionsTest.cpp \ -../../../tests/UserDefaultTest/UserDefaultTest.cpp \ -../../../tests/ZwoptexTest/ZwoptexTest.cpp \ -../../../tests/controller.cpp \ -../../../tests/testBasic.cpp \ -../../../AppDelegate.cpp +LOCAL_SRC_FILES := main.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \ - $(LOCAL_PATH)/../../../../cocos2dx/include \ - $(LOCAL_PATH)/../../../../cocos2dx/platform \ - $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/ \ - $(LOCAL_PATH)/../../../tests \ - $(LOCAL_PATH)/../../../.. \ - $(LOCAL_PATH)/../../.. \ - $(LOCAL_PATH)/../../../../chipmunk/include/chipmunk \ - $(LOCAL_PATH)/../../../../CocosDenshion/include + $(LOCAL_PATH)/../../../../cocos2dx/platform \ + $(LOCAL_PATH)/../../../../cocos2dx/include \ + $(LOCAL_PATH)/../../.. - -# it is used for ndk-r5 -# if you build with ndk-r4, comment it -# because the new Windows toolchain doesn't support Cygwin's drive -# mapping (i.e /cygdrive/c/ instead of C:/) -LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \ + +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/$(TARGET_ARCH_ABI)) \ -lGLESv1_CM \ - -lcocos2d -llog -lcocosdenshion \ - -lbox2d -lchipmunk \ - -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl + -lcocos2d -llog -lgame_logic include $(BUILD_SHARED_LIBRARY) diff --git a/tests/test.android/src/org/cocos2dx/tests/TestsDemo.java b/tests/test.android/src/org/cocos2dx/tests/TestsDemo.java index 5d64724558..067a5e5b2c 100644 --- a/tests/test.android/src/org/cocos2dx/tests/TestsDemo.java +++ b/tests/test.android/src/org/cocos2dx/tests/TestsDemo.java @@ -63,6 +63,7 @@ public class TestsDemo extends Cocos2dxActivity{ System.loadLibrary("chipmunk"); System.loadLibrary("box2d"); System.loadLibrary("cocos2d"); + System.loadLibrary("game_logic"); System.loadLibrary("tests"); } } From c00d59a568d856f09e77703269b57fa21df2e597 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 23 Nov 2011 16:43:52 +0800 Subject: [PATCH 6/7] fixed #838: android template support x86 --- create-android-project.bat | 6 +++--- template/android/AndroidTemplate1.mk | 16 ++++------------ template/android/AndroidTemplate2.mk | 2 +- template/android/Application.mk | 2 +- template/android/copy_files.sh | 2 +- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/create-android-project.bat b/create-android-project.bat index 80509430bb..cc12cc33dc 100644 --- a/create-android-project.bat +++ b/create-android-project.bat @@ -11,15 +11,15 @@ if not exist "%cd%\create-android-project.bat" echo Error!!! You should run it u if not exist "%~dpn0.sh" echo Script "%~dpn0.sh" not found & pause & exit 3 :: modify it to work under your environment -set _CYGBIN=f:\cygwin\bin +set _CYGBIN=d:\programe\cygwin\bin if not exist "%_CYGBIN%" echo Couldn't find Cygwin at "%_CYGBIN%" & pause & exit 4 :: modify it to work under your environment -set _ANDROIDTOOLS=d:\android-sdk\tools +set _ANDROIDTOOLS=d:\programe\android\android-sdk\tools if not exist "%_ANDROIDTOOLS%" echo Couldn't find android sdk tools at "%_ANDROIDTOOLS%" & pause & exit 5 :: modify it to work under your environment -set _NDKROOT=e:\android-ndk-r5 +set _NDKROOT=d:\programe\android\ndk\android-ndk-r6b if not exist "%_NDKROOT%" echo Couldn't find ndk at "%_NDKROOT%" & pause & exit 6 :: create android project diff --git a/template/android/AndroidTemplate1.mk b/template/android/AndroidTemplate1.mk index 470104fb1b..92966d655c 100644 --- a/template/android/AndroidTemplate1.mk +++ b/template/android/AndroidTemplate1.mk @@ -2,22 +2,14 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := game -LOCAL_SRC_FILES := main.cpp \ -../../../Classes/AppDelegate.cpp \ -../../../Classes/HelloWorldScene.cpp +LOCAL_SRC_FILES := main.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \ $(LOCAL_PATH)/../../../../cocos2dx/platform \ $(LOCAL_PATH)/../../../../cocos2dx/include \ - $(LOCAL_PATH)/../../../../CocosDenshion/include \ - $(LOCAL_PATH)/../../../Classes + $(LOCAL_PATH)/../../../Classes -# it is used for ndk-r5 -# if you build with ndk-r4, comment it -# because the new Windows toolchain doesn't support Cygwin's drive -# mapping (i.e /cygdrive/c/ instead of C:/) -LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \ - -lcocos2d -llog -lcocosdenshion \ - -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl +LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/$(TARGET_ARCH_ABI)) \ + -lcocos2d -llog -lgame_logic include $(BUILD_SHARED_LIBRARY) diff --git a/template/android/AndroidTemplate2.mk b/template/android/AndroidTemplate2.mk index bdef5abe06..87e30c591e 100644 --- a/template/android/AndroidTemplate2.mk +++ b/template/android/AndroidTemplate2.mk @@ -5,6 +5,6 @@ subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \ cocos2dx \ CocosDenshion/android \ )) -subdirs += $(LOCAL_PATH)/helloworld/Android.mk +subdirs += $(LOCAL_PATH)/../../Classes/Android.mk $(LOCAL_PATH)/helloworld/Android.mk include $(subdirs) diff --git a/template/android/Application.mk b/template/android/Application.mk index d132003bbd..424e5c1f1e 100644 --- a/template/android/Application.mk +++ b/template/android/Application.mk @@ -1,3 +1,3 @@ # it is needed for ndk-r5 APP_STL := stlport_static -APP_MODULES := cocos2d cocosdenshion game \ No newline at end of file +APP_MODULES := cocos2d cocosdenshion game_logic game \ No newline at end of file diff --git a/template/android/copy_files.sh b/template/android/copy_files.sh index ab4f5e3a19..b49e8365f4 100644 --- a/template/android/copy_files.sh +++ b/template/android/copy_files.sh @@ -33,7 +33,7 @@ move_files_into_android(){ copy_cpp_h_from_helloworld(){ mkdir $APP_DIR/Classes - for file in `ls $HELLOWORLD_ROOT/Classes/* | grep -E '.*\.[cpp|h]' ` + for file in `ls $HELLOWORLD_ROOT/Classes/* | grep -E '.*\.[cpp|h|mk]' ` do if [ -f $file ];then cp $file $APP_DIR/Classes From c3a034a19bb1b9acfe04c5b02fa1d381b4dfa65b Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 23 Nov 2011 17:18:53 +0800 Subject: [PATCH 7/7] fixed #760: add functions to get/add m_pNotificationNode --- cocos2dx/include/CCDirector.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cocos2dx/include/CCDirector.h b/cocos2dx/include/CCDirector.h index b3219f68a5..02ea9d7ae0 100755 --- a/cocos2dx/include/CCDirector.h +++ b/cocos2dx/include/CCDirector.h @@ -35,6 +35,7 @@ THE SOFTWARE. #include "CCGeometry.h" #include "CCEGLView.h" #include "CCGL.h" +#include "CCNode.h" namespace cocos2d { @@ -137,7 +138,6 @@ typedef enum { class CCLabelTTF; class CCScene; class CCEGLView; -class CCNode; class CCProjectionProtocol; /** @@ -211,6 +211,19 @@ public: */ inline bool isSendCleanupToScene(void) { return m_bSendCleanupToScene; } + /** This object will be visited after the main scene is visited. + This object MUST implement the "visit" selector. + Useful to hook a notification object, like CCNotifications (http://github.com/manucorporat/CCNotifications) + @since v0.99.5 + */ + inline CCNode* getNotificationNode() { return m_pNotificationNode; } + inline void setNotificationNode(CCNode *node) + { + CC_SAFE_RELEASE(m_pNotificationNode); + m_pNotificationNode = node; + CC_SAFE_RETAIN(m_pNotificationNode); + } + // window size