在Application.mk里添加STLPORT_FORCE_REBUILD := true即可。
Window--Preferences--C/C++--Code Analysis,取消Syntax and Semantic Errors的勾选。
FILE_LIST := hellocpp/main.cpp \
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Classes
修改以后就可以只添加文件夹,而不需要添加文件了。
windows下可以直接读取,而android下需要使用CCFileUtils操作。
比如:
//根据xml数据创建动画 string xmlFile_path = "a.xml"; //获得文件在系统的绝对路径 string xmlfilepath = CCFileUtils::sharedFileUtils()->fullPathForFilename(xmlFile_path.c_str()); //读取的字节数,读取失败则为0 unsigned long len = 0; //读取的内容 unsigned char *data =CCFileUtils::sharedFileUtils()->getFileData(xmlfilepath.c_str(), "r", &len);
修改Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp里:
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause() { // CCApplication::sharedApplication()->applicationDidEnterBackground(); if (CCDirector::sharedDirector()->getOpenGLView()) { CCApplication::sharedApplication()->applicationDidEnterBackground(); } CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_BACKGROUND, NULL); }
修改AndroidMenifest.xml里的activity部分:
android:screenOrientation="portrait"
pEGLView->setDesignResolutionSize(w, h, kResolutionShowAll);