diff --git a/HelloWorld/HelloWorldScene.cpp b/HelloWorld/HelloWorldScene.cpp index 2b947cbabd..76d2dbbd3d 100644 --- a/HelloWorld/HelloWorldScene.cpp +++ b/HelloWorld/HelloWorldScene.cpp @@ -75,4 +75,8 @@ bool HelloWorld::init() void HelloWorld::menuCloseCallback(CCObject* pSender) { CCDirector::sharedDirector()->end(); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif } diff --git a/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id b/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id index 0cc41ae415..27cd0acd85 100644 --- a/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -3300607858936d3cd32e8d541a02eb4464613808 \ No newline at end of file +b24c63ccf57b54f4c803ee0476d220f01225a535 \ No newline at end of file diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index 38bd18e393..394737a90c 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -77,6 +77,7 @@ support/CCArray.cpp \ support/CCProfiling.cpp \ support/CCPointExtension.cpp \ support/TransformUtils.cpp \ +support/CCUserDefault.cpp \ support/base64.cpp \ support/ccUtils.cpp \ support/image_support/TGAlib.cpp \ diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 9b104db894..7772bae0b0 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -46,6 +46,7 @@ THE SOFTWARE. #include "CCGL.h" #include "CCAnimationCache.h" #include "CCTouch.h" +#include "CCUserDefault.h" #if CC_ENABLE_PROFILERS #include "support/CCProfiling.h" @@ -569,6 +570,7 @@ void CCDirector::purgeDirector() CCActionManager::sharedManager()->purgeSharedManager(); CCScheduler::purgeSharedScheduler(); CCTextureCache::purgeSharedTextureCache(); + CCUserDefault::purgeSharedUserDefault(); // OpenGL view m_pobOpenGLView->release(); diff --git a/cocos2dx/include/CCUserDefault.h b/cocos2dx/include/CCUserDefault.h new file mode 100644 index 0000000000..59bb034bbc --- /dev/null +++ b/cocos2dx/include/CCUserDefault.h @@ -0,0 +1,71 @@ +/**************************************************************************** +Copyright (c) 2010-2011 cocos2d-x.org +Copyright (c) 2008-2010 Ricardo Quesada + +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. +****************************************************************************/ +#ifndef __SUPPORT_CCUSERDEFAULT_H__ +#define __SUPPORT_CCUSERDEFAULT_H__ + +#include "CCPlatformMacros.h" + +#include + + +NS_CC_BEGIN; + +class CC_DLL CCUserDefault +{ +public: + ~CCUserDefault(); + + // get value methods + bool getBoolForKey(const char* pKey); + int getIntegerForKey(const char* pKey); + float getFloatForKey(const char* pKey); + double getDoubleForKey(const char* pKey); + std::string getStringForKey(const char* pKey); + + // set value methods + void setBoolForKey(const char* pKey, bool value); + void setIntegerForKey(const char* pKey, int value); + void setFloatForKey(const char* pKey, float value); + void setDoubleForKey(const char* pKey, double value); + void setStringForKey(const char* pKey, std::string value); + + static CCUserDefault* sharedUserDefault(); + static void purgeSharedUserDefault(); + const static std::string& getXMLFilePath(); + +private: + CCUserDefault() {} + static bool createXMLFile(); + static bool isXMLFileExist(); + static void initXMLFilePath(); + + static CCUserDefault* m_spUserDefault; + static std::string m_sFilePath; + static bool m_sbIsFilePathInitialized; +}; + +NS_CC_END; + +#endif // __SUPPORT_CCUSERDEFAULT_H__ diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 48381690a2..300ff4a890 100644 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -41,8 +41,7 @@ THE SOFTWARE. #include "CCProtocols.h" #include "CCNode.h" #include "CCDirector.h" -// #include "CCTouchDispatcher.h" -// #include "CCTouchDelegateProtocol.h" +#include "CCUserDefault.h" #include "CCActionInstant.h" #include "CCActionInterval.h" #include "CCActionEase.h" diff --git a/cocos2dx/platform/CCFileUtils.h b/cocos2dx/platform/CCFileUtils.h index 60cc5a3f89..479f1f5149 100644 --- a/cocos2dx/platform/CCFileUtils.h +++ b/cocos2dx/platform/CCFileUtils.h @@ -86,6 +86,12 @@ public: */ static CCDictionary *dictionaryWithContentsOfFile(const char *pFileName); + /** + @brief Get the writeable path + @return The path that can write/read file + */ + static std::string getWriteablePath(); + /** @brief Set/Get whether pop-up a message box when the image load failed */ diff --git a/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp b/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp index d06d7ce2a2..81e3aa9c1f 100644 --- a/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp +++ b/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp @@ -340,5 +340,11 @@ bool CCFileUtils::getIsPopupNotify() return s_bPopupNotify; } +std::string CCFileUtils::getWriteablePath() +{ + // fixed me, what path can airplay can write + return string(""); +} + NS_CC_END; diff --git a/cocos2dx/platform/android/CCFileUtils_android.cpp b/cocos2dx/platform/android/CCFileUtils_android.cpp index d4dbbcfeff..8637e74b66 100644 --- a/cocos2dx/platform/android/CCFileUtils_android.cpp +++ b/cocos2dx/platform/android/CCFileUtils_android.cpp @@ -104,4 +104,12 @@ int CCFileUtils::ccLoadFileIntoMemory(const char *filename, unsigned char **out) return 0; } +string CCFileUtils::getWriteablePath() +{ + // the path is: /data/data/ + package name + string dir("/data/data"); + size_t length = s_strResourcePath.rfind(".") - s_strResourcePath.rfind("/"); + return dir + s_strResourcePath.substr(s_strResourcePath.rfind("/"), length) + "/" ; +} + NS_CC_END; diff --git a/cocos2dx/platform/ios/CCFileUtils_ios.mm b/cocos2dx/platform/ios/CCFileUtils_ios.mm index 37ac473808..b9df3a3de4 100644 --- a/cocos2dx/platform/ios/CCFileUtils_ios.mm +++ b/cocos2dx/platform/ios/CCFileUtils_ios.mm @@ -337,6 +337,14 @@ namespace cocos2d { { return s_bPopupNotify; } + + std::string CCFileUtils::getWriteablePath() + { + // save to document folder + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + return [documentsDirectory UTF8String]; + } }//namespace cocos2d diff --git a/cocos2dx/platform/win32/CCFileUtils_win32.cpp b/cocos2dx/platform/win32/CCFileUtils_win32.cpp index cc0225fa96..891f381e19 100644 --- a/cocos2dx/platform/win32/CCFileUtils_win32.cpp +++ b/cocos2dx/platform/win32/CCFileUtils_win32.cpp @@ -22,6 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#include "windows.h" + +using namespace std; + NS_CC_BEGIN; // record the resource path @@ -159,4 +163,19 @@ void CCFileUtils::setRelativePath(const char* pszRelativePath) CCAssert(0, "Have not implement!"); } +string CCFileUtils::getWriteablePath() +{ + // return the path that the exe file saved in + + char full_path[_MAX_PATH + 1]; + ::GetModuleFileNameA(NULL, full_path, _MAX_PATH + 1); + + string ret((char*)full_path); + + // remove xxx.exe + ret = ret.substr(0, ret.rfind("\\") + 1); + + return ret; +} + NS_CC_END; diff --git a/cocos2dx/platform/wophone/CCApplication_wophone.cpp b/cocos2dx/platform/wophone/CCApplication_wophone.cpp index 976c62bc05..c1c4dd827e 100644 --- a/cocos2dx/platform/wophone/CCApplication_wophone.cpp +++ b/cocos2dx/platform/wophone/CCApplication_wophone.cpp @@ -47,20 +47,26 @@ CCApplication::CCApplication() Int32 nRet = SS_AppRequest_GetAppName(AppID, &nCmdType); CC_BREAK_IF(nRet < 0); - TUChar AppPath[EOS_FILE_MAX_PATH] = {0}; - char DataPath[EOS_FILE_MAX_PATH] = {0}; - SS_GetApplicationPath(AppID, SS_APP_PATH_TYPE_CONST, AppPath); - TUString::StrUnicodeToStrUtf8((Char*) DataPath, AppPath); - #ifndef _TRANZDA_VM_ char *pszDriver = ""; #else char *pszDriver = "D:/Work7"; #endif - // record the data path + TUChar AppPath[EOS_FILE_MAX_PATH] = {0}; + char DataPath[EOS_FILE_MAX_PATH] = {0}; + + // get the const data path of the application and record it + SS_GetApplicationPath(AppID, SS_APP_PATH_TYPE_CONST, AppPath); + TUString::StrUnicodeToStrUtf8((Char*) DataPath, AppPath); strcpy(m_AppDataPath, pszDriver); strcat(m_AppDataPath, DataPath); + + // get the writable data path of the application and record it + SS_GetApplicationPath(AppID, SS_APP_PATH_TYPE_DATA, AppPath); + TUString::StrUnicodeToStrUtf8((Char*) DataPath, AppPath); + strcpy(m_AppWritablePath, pszDriver); + strcat(m_AppWritablePath, DataPath); } while (0); CC_ASSERT(! sm_pSharedApplication); @@ -184,6 +190,11 @@ const char* CCApplication::getAppDataPath() return m_AppDataPath; } +const char* CCApplication::getAppWritablePath() +{ + return m_AppWritablePath; +} + void CCApplication::switchNotify(int nTurnOn) { bool bInBack = isInBackground(); @@ -278,7 +289,7 @@ Int32 CCApplication::_OnAppIdle(MESSAGE_t * pMsg, UInt32 uData) #endif else { - Sys_Sleep(0); + Sys_SchedYield(); } Sys_PostMessage2(MESSAGE_PRIOR_LOWEST, &rThis.m_tMsg); } diff --git a/cocos2dx/platform/wophone/CCApplication_wophone.h b/cocos2dx/platform/wophone/CCApplication_wophone.h index 25ca660c7c..536f11f7a1 100644 --- a/cocos2dx/platform/wophone/CCApplication_wophone.h +++ b/cocos2dx/platform/wophone/CCApplication_wophone.h @@ -77,11 +77,18 @@ public: /** @brief Get the data path of the Application. - @return If the app is installed,the return value is the path of .so file. - else the return value is "/NEWPLUS/TG3/APP/" + @return If the app is installed,the return value is the "Const" path of the application, + else the return value is "/NEWPLUS/TG3/ConstData/" */ const char* getAppDataPath(); + /** + @brief Get the writable path for the Application. + @return If the app is installed,the return value is the "Data" path of the application. + else the return value is "/NEWPLUS/TG3/TDA_DATA/Data/Data/" + */ + const char* getAppWritablePath(); + void switchNotify(int nTurnOn); /** @@ -103,6 +110,7 @@ protected: bool m_bNeedStop; bool m_bInBackground; char m_AppDataPath[EOS_FILE_MAX_PATH]; + char m_AppWritablePath[EOS_FILE_MAX_PATH]; static CCApplication * sm_pSharedApplication; static UInt32 sm_uDesignOrientation; diff --git a/cocos2dx/platform/wophone/CCFileUtils_wophone.cpp b/cocos2dx/platform/wophone/CCFileUtils_wophone.cpp index 678dea598a..da4caf0309 100644 --- a/cocos2dx/platform/wophone/CCFileUtils_wophone.cpp +++ b/cocos2dx/platform/wophone/CCFileUtils_wophone.cpp @@ -26,6 +26,10 @@ THE SOFTWARE. #include #include "CCApplication.h" +#include + +using namespace std; + NS_CC_BEGIN; // record the resource path @@ -250,4 +254,9 @@ void CCFileUtils::setRelativePath(const char* pszRelativePath) CCAssert(0, "Have not implement!"); } +string CCFileUtils::getWriteablePath() +{ + return string(CCApplication::sharedApplication().getAppWritablePath()); +} + NS_CC_END; diff --git a/cocos2dx/proj.win32/cocos2d-win32.vcproj b/cocos2dx/proj.win32/cocos2d-win32.vcproj index bcea9d8bac..223ee2d17f 100644 --- a/cocos2dx/proj.win32/cocos2d-win32.vcproj +++ b/cocos2dx/proj.win32/cocos2d-win32.vcproj @@ -627,6 +627,10 @@ RelativePath="..\include\ccTypes.h" > + + @@ -911,6 +915,10 @@ RelativePath="..\support\CCProfiling.h" > + + diff --git a/cocos2dx/proj.wophone/Makefile.ARM b/cocos2dx/proj.wophone/Makefile.ARM index 19c01bfafb..6665e30d95 100644 --- a/cocos2dx/proj.wophone/Makefile.ARM +++ b/cocos2dx/proj.wophone/Makefile.ARM @@ -104,6 +104,7 @@ OBJECTS = \ $(OBJECTS_DIR)/CCArray.o \ $(OBJECTS_DIR)/CCPointExtension.o \ $(OBJECTS_DIR)/CCProfiling.o \ + $(OBJECTS_DIR)/CCUserDefault.o \ $(OBJECTS_DIR)/ccUtils.o \ $(OBJECTS_DIR)/TransformUtils.o \ $(OBJECTS_DIR)/TGAlib.o \ @@ -357,6 +358,9 @@ $(OBJECTS_DIR)/CCPointExtension.o : ../support/CCPointExtension.cpp $(OBJECTS_DIR)/CCProfiling.o : ../support/CCProfiling.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCProfiling.o ../support/CCProfiling.cpp +$(OBJECTS_DIR)/CCUserDefault.o : ../support/CCUserDefault.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CCUserDefault.o ../support/CCUserDefault.cpp + $(OBJECTS_DIR)/ccUtils.o : ../support/ccUtils.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/ccUtils.o ../support/ccUtils.cpp diff --git a/cocos2dx/proj.wophone/cocos2d-wophone.vcproj b/cocos2dx/proj.wophone/cocos2d-wophone.vcproj index 96f8a956e9..64d41e37cb 100644 --- a/cocos2dx/proj.wophone/cocos2d-wophone.vcproj +++ b/cocos2dx/proj.wophone/cocos2d-wophone.vcproj @@ -588,6 +588,10 @@ RelativePath="..\include\ccTypes.h" > + + @@ -752,6 +756,10 @@ RelativePath="..\support\CCProfiling.h" > + + diff --git a/cocos2dx/support/CCUserDefault.cpp b/cocos2dx/support/CCUserDefault.cpp new file mode 100644 index 0000000000..8423abca3c --- /dev/null +++ b/cocos2dx/support/CCUserDefault.cpp @@ -0,0 +1,367 @@ +#include "CCUserDefault.h" +#include "platform/CCFileUtils.h" + +#include +#include + +// root name of xml +#define USERDEFAULT_ROOT_NAME "userDefaultRoot" + +#define XML_FILE_NAME "UserDefault.xml" + +using namespace std; + +NS_CC_BEGIN; + +/** + * define the functions here because we don't want to + * export xmlNodePtr and other types in "CCUserDefault.h" + */ + +static xmlNodePtr getXMLNodeForKey(const char* pKey, xmlNodePtr *rootNode, xmlDocPtr *doc) +{ + xmlNodePtr curNode = NULL; + + // check the key value + if (! pKey) + { + return NULL; + } + + do + { + // read doc + *doc = xmlReadFile(CCUserDefault::sharedUserDefault()->getXMLFilePath().c_str(), "utf-8", XML_PARSE_RECOVER); + if (NULL == *doc) + { + CCLOG("can not read xml file"); + break; + } + + // get root node + *rootNode = xmlDocGetRootElement(*doc); + if (NULL == *rootNode) + { + CCLOG("read root node error"); + break; + } + + // find the node + curNode = (*rootNode)->xmlChildrenNode; + while (NULL != curNode) + { + if (! xmlStrcmp(curNode->name, BAD_CAST pKey)) + { + break; + } + + curNode = curNode->next; + } + } while (0); + + return curNode; +} + +const char* getValueForKey(const char* pKey) +{ + const char* ret = NULL; + xmlNodePtr rootNode; + xmlDocPtr doc; + xmlNodePtr node = getXMLNodeForKey(pKey, &rootNode, &doc); + + // find the node + if (node) + { + ret = (const char*)xmlNodeGetContent(node); + } + + // free doc + if (doc) + { + xmlFreeDoc(doc); + } + + return ret; +} + +void setValueForKey(const char* pKey, const char* pValue) +{ + xmlNodePtr rootNode; + xmlDocPtr doc; + xmlNodePtr node; + + // check the params + if (! pKey || ! pValue) + { + return; + } + + // find the node + node = getXMLNodeForKey(pKey, &rootNode, &doc); + + // if node exist, change the content + if (node) + { + xmlNodeSetContent(node, BAD_CAST pValue); + } + else + { + if (rootNode) + { + // the node doesn't exist, add a new one + // libxml in android donesn't support xmlNewTextChild, so use this approach + xmlNodePtr tmpNode = xmlNewNode(NULL, BAD_CAST pKey); + xmlNodePtr content = xmlNewText(BAD_CAST pValue); + xmlAddChild(rootNode, tmpNode); + xmlAddChild(tmpNode, content); + } + } + + // save file and free doc + if (doc) + { + xmlSaveFile(CCUserDefault::sharedUserDefault()->getXMLFilePath().c_str(),doc); + xmlFreeDoc(doc); + } +} + +/** + * implements of CCUserDefault + */ + +CCUserDefault* CCUserDefault::m_spUserDefault = 0; +string CCUserDefault::m_sFilePath = string(""); +bool CCUserDefault::m_sbIsFilePathInitialized = false; + +/** + * If the user invoke delete CCUserDefault::sharedUserDefault(), should set m_spUserDefault + * to null to avoid error when he invoke CCUserDefault::sharedUserDefault() later. + */ +CCUserDefault::~CCUserDefault() +{ + m_spUserDefault = NULL; +} + +void CCUserDefault::purgeSharedUserDefault() +{ + CC_SAFE_DELETE(m_spUserDefault); + m_spUserDefault = NULL; +} + +bool CCUserDefault::getBoolForKey(const char* pKey) +{ + const char* value = getValueForKey(pKey); + bool ret = false; + + if (value) + { + if (! strcmp(value, "true")) + { + ret = true; + } + } + + return ret; +} + +int CCUserDefault::getIntegerForKey(const char* pKey) +{ + const char* value = getValueForKey(pKey); + int ret = 0; + + if (value) + { + ret = atoi(value); + xmlFree((void*)value); + } + + return ret; +} + +float CCUserDefault::getFloatForKey(const char* pKey) +{ + float ret = (float)getDoubleForKey(pKey); + + return ret; +} + +double CCUserDefault::getDoubleForKey(const char* pKey) +{ + const char* value = getValueForKey(pKey); + double ret = 0.0; + + if (value) + { + ret = atof(value); + xmlFree((void*)value); + } + + return ret; +} + +string CCUserDefault::getStringForKey(const char* pKey) +{ + const char* value = getValueForKey(pKey); + string ret(""); + + if (value) + { + ret = string(value); + xmlFree((void*)value); + } + + return ret; +} + +void CCUserDefault::setBoolForKey(const char* pKey, bool value) +{ + // save bool value as sring + + if (true == value) + { + setStringForKey(pKey, "true"); + } + else + { + setStringForKey(pKey, "false"); + } +} + +void CCUserDefault::setIntegerForKey(const char* pKey, int value) +{ + // check key + if (! pKey) + { + return; + } + + // format the value + char tmp[50]; + memset(tmp, 0, 50); + sprintf(tmp, "%d", value); + + setValueForKey(pKey, tmp); +} + +void CCUserDefault::setFloatForKey(const char* pKey, float value) +{ + setDoubleForKey(pKey, value); +} + +void CCUserDefault::setDoubleForKey(const char* pKey, double value) +{ + // check key + if (! pKey) + { + return; + } + + // format the value + char tmp[50]; + memset(tmp, 0, 50); + sprintf(tmp, "%f", value); + + setValueForKey(pKey, tmp); +} + +void CCUserDefault::setStringForKey(const char* pKey, std::string value) +{ + // check key + if (! pKey) + { + return; + } + + setValueForKey(pKey, value.c_str()); +} + +CCUserDefault* CCUserDefault::sharedUserDefault() +{ + initXMLFilePath(); + + // only create xml file one time + // the file exists after the programe exit + if ((! isXMLFileExist()) && (! createXMLFile())) + { + return NULL; + } + + if (! m_spUserDefault) + { + m_spUserDefault = new CCUserDefault(); + } + + return m_spUserDefault; +} + +bool CCUserDefault::isXMLFileExist() +{ + FILE *fp = fopen(m_sFilePath.c_str(), "r"); + bool bRet = false; + + if (fp) + { + bRet = true; + fclose(fp); + } + + return bRet; +} + +void CCUserDefault::initXMLFilePath() +{ + if (! m_sbIsFilePathInitialized) + { + m_sFilePath += CCFileUtils::getWriteablePath() + XML_FILE_NAME; + m_sbIsFilePathInitialized = true; + } +} + +// create new xml file +bool CCUserDefault::createXMLFile() +{ + bool bRet = false; + xmlDocPtr doc = NULL; + + do + { + // new doc + doc = xmlNewDoc(BAD_CAST"1.0"); + if (doc == NULL) + { + CCLOG("can not create xml doc"); + break; + } + + // new root node + xmlNodePtr rootNode = xmlNewNode(NULL, BAD_CAST USERDEFAULT_ROOT_NAME); + if (rootNode == NULL) + { + CCLOG("can not create root node"); + break; + } + + // set root node + xmlDocSetRootElement(doc, rootNode); + + // save xml file + xmlSaveFile(m_sFilePath.c_str(), doc); + + bRet = true; + } while (0); + + // if doc is not null, free it + if (doc) + { + xmlFreeDoc(doc); + } + + return bRet; +} + +const string& CCUserDefault::getXMLFilePath() +{ + return m_sFilePath; +} + +NS_CC_END; diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 9a1a641cdd..a0a75a7daa 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -152,6 +152,10 @@ bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity //CCLOG("cocos2d: CCTextureAtlas: not enough memory"); CC_SAFE_FREE(m_pQuads) CC_SAFE_FREE(m_pIndices) + + // release texture, should set it to null, because the destruction will + // release it too. see cocos2d-x issue #484 + CC_SAFE_RELEASE_NULL(m_pTexture); return false; } diff --git a/create-android-project.bat b/create-android-project.bat index a4d1c4c3e5..eeb6cf2bd9 100644 --- a/create-android-project.bat +++ b/create-android-project.bat @@ -19,7 +19,7 @@ set _ANDROIDTOOLS=d:\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-r4-crystax +set _NDKROOT=e:\android-ndk-r5 if not exist "%_NDKROOT%" echo Couldn't find ndk at "%_NDKROOT%" & pause & exit 6 :: create android project @@ -45,3 +45,5 @@ for /f "delims=" %%A in ('%_CYGBIN%\cygpath.exe "%_NDKROOT%"') do set _NDKROOT=% :: Throw away temporary env vars and invoke script, passing any args that were passed to us endlocal & %_CYGBIN%\bash --login "%_CYGSCRIPT%" %_CURRENTDIR% %_PROJECTNAME% %_NDKROOT% "windows" + +pause diff --git a/template/android/AndroidTemplate1.mk b/template/android/AndroidTemplate1.mk index 513289addd..ab11a4f9b6 100644 --- a/template/android/AndroidTemplate1.mk +++ b/template/android/AndroidTemplate1.mk @@ -1,6 +1,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := helloworld +LOCAL_MODULE := game LOCAL_SRC_FILES := main.cpp \ ../../../Classes/AppDelegate.cpp \ @@ -9,14 +9,20 @@ 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_LDLIBS := -L$(LOCAL_PATH)/../../libs/armeabi -lcocos2d -llog -lcocosdenshion -# it is used for ndk-r5 +# it is used for ndk-r4 +# if you build with nkd-r4, uncomment it +# LOCAL_LDLIBS := -L$(LOCAL_PATH)/../../libs/armeabi -lcocos2d -llog -lcocosdenshion \ +# -L$(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries -lcurl + +# 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 +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 include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/template/android/Application.mk b/template/android/Application.mk index 89dfdea269..d132003bbd 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 helloworld \ No newline at end of file +APP_MODULES := cocos2d cocosdenshion game \ No newline at end of file diff --git a/template/android/build_native.sh b/template/android/build_native.sh index e0d5b0019a..2caa3dde87 100644 --- a/template/android/build_native.sh +++ b/template/android/build_native.sh @@ -1,29 +1,29 @@ # set params ANDROID_NDK_ROOT=__ndkroot__ COCOS2DX_ROOT=__cocos2dxroot__ -HELLOWORLD_ROOT=$COCOS2DX_ROOT/__projectname__ -HELLOWORLD_ANDROID_ROOT=$HELLOWORLD_ROOT/android -RESOURCE_ROOT=$HELLOWORLD_ROOT/Resource +GAME_ROOT=$COCOS2DX_ROOT/__projectname__ +GAME_ANDROID_ROOT=$GAME_ROOT/android +RESOURCE_ROOT=$GAME_ROOT/Resource # make sure assets is exist -if [ -d $HELLOWORLD_ANDROID_ROOT/assets ]; then - rm -rf $HELLOWORLD_ANDROID_ROOT/assets +if [ -d $GAME_ANDROID_ROOT/assets ]; then + rm -rf $GAME_ANDROID_ROOT/assets fi -mkdir $HELLOWORLD_ANDROID_ROOT/assets +mkdir $GAME_ANDROID_ROOT/assets # copy resources for file in $RESOURCE_ROOT/* do if [ -d $file ]; then - cp -rf $file $HELLOWORLD_ANDROID_ROOT/assets + cp -rf $file $GAME_ANDROID_ROOT/assets fi if [ -f $file ]; then - cp $file $HELLOWORLD_ANDROID_ROOT/assets + cp $file $GAME_ANDROID_ROOT/assets fi done # build -$ANDROID_NDK_ROOT/ndk-build -C $HELLOWORLD_ANDROID_ROOT $* +$ANDROID_NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT $* diff --git a/template/android/copy_files.sh b/template/android/copy_files.sh index 239fe98887..ca595cbaa3 100644 --- a/template/android/copy_files.sh +++ b/template/android/copy_files.sh @@ -67,12 +67,22 @@ modify_androidmanifest(){ sed "s/ApplicationDemo/$APP_NAME/" $HELLOWORLD_ROOT/android/AndroidManifest.xml > $APP_DIR/android/AndroidManifest.xml } -# rename APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java -# and change some content +# modify ApplicationDemo.java modify_applicationdemo(){ - sed "s/ApplicationDemo/$APP_NAME/" $APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java > $APP_DIR/android/src/org/cocos2dx/application/tempfile.java + # rename APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java to + # APP_DIR/android/src/org/cocos2dx/application/$APP_NAME.java, change helloworld to game + sed "s/ApplicationDemo/$APP_NAME/;s/helloworld/game/" $APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java > $APP_DIR/android/src/org/cocos2dx/application/tempfile.java rm -f $APP_DIR/android/src/org/cocos2dx/application/ApplicationDemo.java mv $APP_DIR/android/src/org/cocos2dx/application/tempfile.java $APP_DIR/android/src/org/cocos2dx/application/$APP_NAME.java + + +} + +modify_layout(){ + cp $HELLOWORLD_ROOT/android/res/layout/helloworld_demo.xml $APP_DIR/android/res/layout + sed "s/helloworld_gl_surfaceview/game_gl_surfaceview/" $APP_DIR/android/res/layout/helloworld_demo.xml > $APP_DIR/android/res/layout/game_demo.xml + rm -f $APP_DIR/android/res/layout/main.xml + rm -f $APP_DIR/android/res/layout/helloworld_demo.xml } move_files_into_android @@ -82,3 +92,4 @@ copy_src_and_jni copy_build_native modify_androidmanifest modify_applicationdemo +modify_layout diff --git a/template/msvc/CCAppWiz.win32/Scripts/1033/default.js b/template/msvc/CCAppWiz.win32/Scripts/1033/default.js index 146ec43d7e..40c21d3b8c 100644 --- a/template/msvc/CCAppWiz.win32/Scripts/1033/default.js +++ b/template/msvc/CCAppWiz.win32/Scripts/1033/default.js @@ -192,7 +192,7 @@ function AddConfigurations(proj, strProjectName) { strAddIncludeDir += ';..\\cocos2dx\\platform\\third_party\\win32\\OGLES'; if (wizard.FindSymbol('CC_USE_BOX2D')) { - strAddIncludeDir += ';..\\;..\\Box2D'; + strAddIncludeDir += ';..\\'; } if (wizard.FindSymbol('CC_USE_CHIPMUNK')) { strAddIncludeDir += ';..\\chipmunk\\include\\chipmunk'; diff --git a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/HelloWorldScene.h b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/HelloWorldScene.h index 299d2894cf..0f45161148 100644 --- a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/HelloWorldScene.h +++ b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/HelloWorldScene.h @@ -4,7 +4,7 @@ #include "cocos2d.h" [! if CC_USE_BOX2D] -#include "Box2D.h" +#include "Box2D/Box2D.h" [! endif] [! if CC_USE_CHIPMUNK] diff --git a/template/msvc/CCAppWiz.wophone/Scripts/1033/default.js b/template/msvc/CCAppWiz.wophone/Scripts/1033/default.js index 4b1a2992d7..19043b798f 100644 --- a/template/msvc/CCAppWiz.wophone/Scripts/1033/default.js +++ b/template/msvc/CCAppWiz.wophone/Scripts/1033/default.js @@ -182,7 +182,7 @@ function AddConfigurations(proj, strProjectName) { var strOutputFile = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.dll'; if (wizard.FindSymbol('CC_USE_BOX2D')) { - strCurIncludeDir += ';..\\;..\\Box2D'; + strCurIncludeDir += ';..\\'; strDependLibs += ' libBox2d.lib'; } if (wizard.FindSymbol('CC_USE_CHIPMUNK')) { diff --git a/template/msvc/CCAppWiz.wophone/Templates/1033/Classes/HelloWorldScene.h b/template/msvc/CCAppWiz.wophone/Templates/1033/Classes/HelloWorldScene.h index e10702e5b7..6ef3b4445b 100644 --- a/template/msvc/CCAppWiz.wophone/Templates/1033/Classes/HelloWorldScene.h +++ b/template/msvc/CCAppWiz.wophone/Templates/1033/Classes/HelloWorldScene.h @@ -4,7 +4,7 @@ #include "cocos2d.h" [! if CC_USE_BOX2D] -#include "Box2D.h" +#include "Box2D/Box2D.h" [! endif] [! if CC_USE_CHIPMUNK] diff --git a/template/msvc/CCAppWiz.wophone/Templates/1033/root_Arm.TMK3 b/template/msvc/CCAppWiz.wophone/Templates/1033/root_Arm.TMK3 index ef100036a5..f5b461ee13 100644 --- a/template/msvc/CCAppWiz.wophone/Templates/1033/root_Arm.TMK3 +++ b/template/msvc/CCAppWiz.wophone/Templates/1033/root_Arm.TMK3 @@ -40,7 +40,7 @@ DEFINES=-D__TCOM_SUPPORT__ ;生成的是TCOM组件(注意:TOPS应用也 INCLUDE_PATH=-I ../../PRJ_TG3/Include/OpenGL -I../cocos2dx -I../cocos2dx/include -I../cocos2dx/platform INCLUDE_PATH=-I. -I./Classes -I./wophone -I./wophone/Res ;默认本项目的路径 [! if CC_USE_BOX2D] -INCLUDE_PATH=-I../ -I../Box2D +INCLUDE_PATH=-I../ [! endif] [! if CC_USE_CHIPMUNK] INCLUDE_PATH=-I../chipmunk/include/chipmunk diff --git a/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index d1714a6f22..e4f814cb2f 100644 --- a/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -8c9f77a384b0e17df11cc843e89538b603e91f12 \ No newline at end of file +d1962bc646d8650f27302fd6c32dff2d9d4ab6a5 \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index 84d0c6879b..00ac984a78 100644 --- a/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_box2d_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -2fc55bb5f8692cca82e907045481456851797347 \ No newline at end of file +6c636339fa5aff82bfca50d9da220b50af5c0053 \ No newline at end of file diff --git a/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id b/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id index 3cffd104c8..a890abc41f 100644 --- a/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/template/xcode3/cocos2d-x_chipmunk_app/___PROJECTNAME___.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -bf9495b1eb39b27435866491b2da9918233c5c90 \ No newline at end of file +aeb5b381069888074bcb7bd1b6e3e658e1262d7d \ No newline at end of file diff --git a/tests/test.android/jni/tests/Android.mk b/tests/test.android/jni/tests/Android.mk index 3ef21aadc4..6b5c39332d 100644 --- a/tests/test.android/jni/tests/Android.mk +++ b/tests/test.android/jni/tests/Android.mk @@ -66,6 +66,7 @@ LOCAL_SRC_FILES := main.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 \ diff --git a/tests/test.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id b/tests/test.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id index 343677d9a7..20c6fe7118 100644 --- a/tests/test.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/tests/test.ios/test.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -9d64949d940f3601af63ef349967d1853680ef81 \ No newline at end of file +9f36b35f636dbc0d59f5e319e14cadb04630172a \ No newline at end of file diff --git a/tests/test.win32/test.win32.vcproj b/tests/test.win32/test.win32.vcproj index 798ad055fe..948c8dcd08 100644 --- a/tests/test.win32/test.win32.vcproj +++ b/tests/test.win32/test.win32.vcproj @@ -947,6 +947,18 @@ > + + + + + + diff --git a/tests/test.wophone/Makefile.ARM b/tests/test.wophone/Makefile.ARM index 8c71c7d592..c355becb7f 100644 --- a/tests/test.wophone/Makefile.ARM +++ b/tests/test.wophone/Makefile.ARM @@ -105,7 +105,8 @@ OBJECTS = \ $(OBJECTS_DIR)/Paddle.o \ $(OBJECTS_DIR)/TouchesTest.o \ $(OBJECTS_DIR)/TransitionsTest.o \ - $(OBJECTS_DIR)/ZwoptexTest.o + $(OBJECTS_DIR)/ZwoptexTest.o \ + $(OBJECTS_DIR)/UserDefaultTest.o ADD_OBJECTS += @@ -333,4 +334,7 @@ $(OBJECTS_DIR)/ZwoptexTest.o : ../tests/ZwoptexTest/ZwoptexTest.cpp $(OBJECTS_DIR)/CurlTest.o : ../tests/CurlTest/CurlTest.cpp $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/CurlTest.o ../tests/CurlTest/CurlTest.cpp + +$(OBJECTS_DIR)/UserDefaultTest.o : ../tests/UserDefaultTest/UserDefaultTest.cpp + $(CXX) -c $(CXX_FLAGS) $(INCLUDE_PATH) $(LAST_INCLUDE_PATH) -o $(OBJECTS_DIR)/UserDefaultTest.o ../tests/UserDefaultTest/UserDefaultTest.cpp diff --git a/tests/test.wophone/test.wophone.vcproj b/tests/test.wophone/test.wophone.vcproj index e64b2d6e59..46375be863 100644 --- a/tests/test.wophone/test.wophone.vcproj +++ b/tests/test.wophone/test.wophone.vcproj @@ -987,6 +987,18 @@ > + + + + + + diff --git a/tests/tests/UserDefaultTest/UserDefaultTest.cpp b/tests/tests/UserDefaultTest/UserDefaultTest.cpp new file mode 100644 index 0000000000..ca5d966d0d --- /dev/null +++ b/tests/tests/UserDefaultTest/UserDefaultTest.cpp @@ -0,0 +1,101 @@ +// enable log +#define COCOS2D_DEBUG 1 + +#include "UserDefaultTest.h" +#include "stdio.h" +#include "stdlib.h" + +UserDefaultTest::UserDefaultTest() +{ + CCSize s = CCDirector::sharedDirector()->getWinSize(); + CCLabelTTF* label = CCLabelTTF::labelWithString("CCUserDefault test see log", "Arial", 28); + addChild(label, 0); + label->setPosition( ccp(s.width/2, s.height-50) ); + + doTest(); +} + +void UserDefaultTest::doTest() +{ + CCLOG("********************** init value ***********************"); + + // set default value + + CCUserDefault::sharedUserDefault()->setStringForKey("string", "value1"); + CCUserDefault::sharedUserDefault()->setIntegerForKey("integer", 10); + CCUserDefault::sharedUserDefault()->setFloatForKey("float", 2.3f); + CCUserDefault::sharedUserDefault()->setDoubleForKey("double", 2.4); + CCUserDefault::sharedUserDefault()->setBoolForKey("bool", true); + + // print value + + string ret = CCUserDefault::sharedUserDefault()->getStringForKey("string"); + CCLOG("string is %s", ret.c_str()); + + double d = CCUserDefault::sharedUserDefault()->getDoubleForKey("double"); + CCLOG("double is %f", d); + + int i = CCUserDefault::sharedUserDefault()->getIntegerForKey("integer"); + CCLOG("integer is %d", i); + + float f = CCUserDefault::sharedUserDefault()->getFloatForKey("float"); + CCLOG("float is %f", f); + + bool b = CCUserDefault::sharedUserDefault()->getBoolForKey("bool"); + if (b) + { + CCLOG("bool is true"); + } + else + { + CCLOG("bool is false"); + } + + CCLOG("********************** after change value ***********************"); + + // change the value + + CCUserDefault::sharedUserDefault()->setStringForKey("string", "value2"); + CCUserDefault::sharedUserDefault()->setIntegerForKey("integer", 11); + CCUserDefault::sharedUserDefault()->setFloatForKey("float", 2.5f); + CCUserDefault::sharedUserDefault()->setDoubleForKey("double", 2.6); + CCUserDefault::sharedUserDefault()->setBoolForKey("bool", false); + + // print value + + ret = CCUserDefault::sharedUserDefault()->getStringForKey("string"); + CCLOG("string is %s", ret.c_str()); + + d = CCUserDefault::sharedUserDefault()->getDoubleForKey("double"); + CCLOG("double is %f", d); + + i = CCUserDefault::sharedUserDefault()->getIntegerForKey("integer"); + CCLOG("integer is %d", i); + + f = CCUserDefault::sharedUserDefault()->getFloatForKey("float"); + CCLOG("float is %f", f); + + b = CCUserDefault::sharedUserDefault()->getBoolForKey("bool"); + if (b) + { + CCLOG("bool is true"); + } + else + { + CCLOG("bool is false"); + } +} + + +UserDefaultTest::~UserDefaultTest() +{ +} + +void UserDefaultTestScene::runThisTest() +{ + CCLayer* pLayer = new UserDefaultTest(); + addChild(pLayer); + + CCDirector::sharedDirector()->replaceScene(this); + pLayer->release(); +} diff --git a/tests/tests/UserDefaultTest/UserDefaultTest.h b/tests/tests/UserDefaultTest/UserDefaultTest.h new file mode 100644 index 0000000000..f5821afca8 --- /dev/null +++ b/tests/tests/UserDefaultTest/UserDefaultTest.h @@ -0,0 +1,23 @@ +#ifndef _USERDEFAULT_TEST_H_ +#define _USERDEFAULT_TEST_H_ + +#include "cocos2d.h" +#include "../testBasic.h" + +class UserDefaultTest : public CCLayer +{ +public: + UserDefaultTest(); + ~UserDefaultTest(); + +private: + void doTest(); +}; + +class UserDefaultTestScene : public TestScene +{ +public: + virtual void runThisTest(); +}; + +#endif // _USERDEFAULT_TEST_H_ diff --git a/tests/tests/controller.cpp b/tests/tests/controller.cpp index 251ce0d868..fc2dc89a02 100644 --- a/tests/tests/controller.cpp +++ b/tests/tests/controller.cpp @@ -109,6 +109,10 @@ static TestScene* CreateTestScene(int nIdx) pScene = new ZwoptexTestScene(); break; case TEST_CURL: pScene = new CurlTestScene(); break; +#if (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) + case TEST_USERDEFAULT: + pScene = new UserDefaultTestScene(); break; +#endif default: break; } diff --git a/tests/tests/tests.h b/tests/tests/tests.h index 895caa5c2b..4b0f02520d 100644 --- a/tests/tests/tests.h +++ b/tests/tests/tests.h @@ -38,6 +38,7 @@ #include "ZwoptexTest/ZwoptexTest.h" #include "CocosDenshionTest/CocosDenshionTest.h" #include "CurlTest/CurlTest.h" +#include "UserDefaultTest/UserDefaultTest.h" #if (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) #include "ChipmunkTest/cocos2dChipmunkDemo.h" @@ -47,7 +48,7 @@ #include "ChipmunkTest/cocos2dChipmunkDemo.h" #endif #endif -#endif +#endif // (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) enum { @@ -72,10 +73,7 @@ enum TEST_INTERVAL, TEST_CHIPMUNK, TEST_LABEL, - // havn't implement on airplay -#if (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) TEST_TEXT_INPUT, -#endif TEST_SPRITE, TEST_SCHEDULER, TEST_RENDERTEXTURE, @@ -89,6 +87,7 @@ enum TEST_PERFORMANCE, TEST_ZWOPTEX, TEST_CURL, + TEST_USERDEFAULT, TESTS_COUNT, }; @@ -115,10 +114,7 @@ const std::string g_aTestNames[TESTS_COUNT] = { "IntervalTest", "ChipmunkTest", "LabelTest", - // havn't implement on airplay -#if (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY) "TextInputTest", -#endif "SpriteTest", "SchdulerTest", "RenderTextureTest", @@ -131,7 +127,8 @@ const std::string g_aTestNames[TESTS_COUNT] = { "CocosDenshionTest", "PerformanceTest", "ZwoptexTest", - "CurlTest" + "CurlTest", + "UserDefaultTest" }; #endif