diff --git a/cocos2dx/actions/CCGrid3DAction.cpp b/cocos2dx/actions/CCGrid3DAction.cpp index adcf0e8c56..563836e471 100644 --- a/cocos2dx/actions/CCGrid3DAction.cpp +++ b/cocos2dx/actions/CCGrid3DAction.cpp @@ -24,6 +24,8 @@ THE SOFTWARE. #include "CCGrid3DAction.h" #include "CGPointExtension.h" +#include + namespace cocos2d { // implementation of CCWaves3D diff --git a/cocos2dx/actions/CCTiledGridAction.cpp b/cocos2dx/actions/CCTiledGridAction.cpp index bc5231f9b6..4822fe12fb 100644 --- a/cocos2dx/actions/CCTiledGridAction.cpp +++ b/cocos2dx/actions/CCTiledGridAction.cpp @@ -27,6 +27,8 @@ THE SOFTWARE. #include "CGPointExtension.h" #include "effects/CCGrid.h" +#include + namespace cocos2d { struct Tile diff --git a/cocos2dx/include/CCRibbon.h b/cocos2dx/include/CCRibbon.h index 560d749b68..7a043c39ec 100644 --- a/cocos2dx/include/CCRibbon.h +++ b/cocos2dx/include/CCRibbon.h @@ -23,7 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #ifndef __CCRIBBON_H__ #define __CCRIBBON_H__ -#include +/*#include */ #include "CCNode.h" #include "CCProtocols.h" namespace cocos2d { diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index 4450d44eaf..2877a25030 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -122,14 +122,14 @@ namespace cocos2d { CGSize size = CCDirector::getSharedDirector()->getDisplaySize(); glViewport(0, 0, (GLsizei)size.width, (GLsizei)size.height); - glColorMask(TRUE, TRUE, TRUE, TRUE); + glColorMask(true, true, true, true); } void CCRenderTexture::clear(float r, float g, float b, float a) { this->begin(); glClearColor(r, g, b, a); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glColorMask(TRUE, TRUE, TRUE, FALSE); + glColorMask(true, true, true, false); this->end(); } bool CCRenderTexture::saveBuffer(const char *name) diff --git a/cocos2dx/platform/CCFileUtils_platform.h b/cocos2dx/platform/CCFileUtils_platform.h index 54c8bbd79b..c7f2ab749b 100644 --- a/cocos2dx/platform/CCFileUtils_platform.h +++ b/cocos2dx/platform/CCFileUtils_platform.h @@ -30,6 +30,8 @@ THE SOFTWARE. #include "uphone/CCXFileUtils_uphone.h" #elif defined(CCX_PLATFORM_WIN32) #include "win32/CCXFileUtils_win32.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/CCXFileUtils_android.h" #else #error #endif // __CCX_FILEUTILS_PLATFORM_H__ diff --git a/cocos2dx/platform/CCXApplication_platform.h b/cocos2dx/platform/CCXApplication_platform.h index dc9eb9d62c..056498adcb 100644 --- a/cocos2dx/platform/CCXApplication_platform.h +++ b/cocos2dx/platform/CCXApplication_platform.h @@ -31,6 +31,8 @@ THE SOFTWARE. #include "uphone/CCXApplication_uphone.h" #elif defined(CCX_PLATFORM_WIN32) #include "win32/CCXApplication_win32.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/CCXApplication_android.h" #else #error #endif diff --git a/cocos2dx/platform/CCXEGLView_platform.h b/cocos2dx/platform/CCXEGLView_platform.h index 2490b5fe32..c6186451d9 100644 --- a/cocos2dx/platform/CCXEGLView_platform.h +++ b/cocos2dx/platform/CCXEGLView_platform.h @@ -31,6 +31,8 @@ THE SOFTWARE. #include "uphone/CCXEGLView_uphone.h" #elif defined(CCX_PLATFORM_WIN32) #include "win32/CCXEGLView_win32.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/CCXEGLView_android.h" #else #error #endif diff --git a/cocos2dx/platform/CCXUIImage_platform.h b/cocos2dx/platform/CCXUIImage_platform.h index d3bf7c7fbf..0cbb6818f5 100644 --- a/cocos2dx/platform/CCXUIImage_platform.h +++ b/cocos2dx/platform/CCXUIImage_platform.h @@ -30,6 +30,8 @@ THE SOFTWARE. #include "uphone/CCXUIImage_uphone.h" #elif defined(CCX_PLATFORM_WIN32) #include "win32/CCXUIImage_win32.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/CCXUIImage_android.h" #else #error #endif // __CCX_UIIMAGE_PLATFORM_H__ diff --git a/cocos2dx/platform/ccxCommon_platform.h b/cocos2dx/platform/ccxCommon_platform.h index 8d875ba15c..29bb1bbe71 100644 --- a/cocos2dx/platform/ccxCommon_platform.h +++ b/cocos2dx/platform/ccxCommon_platform.h @@ -31,6 +31,8 @@ THE SOFTWARE. #include "uphone/ccxCommon_uphone.h" #elif defined(CCX_PLATFORM_WIN32) #include "win32/ccxCommon_win32.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/ccxCommon_android.h" #else #error #endif diff --git a/cocos2dx/platform/config_platform.h b/cocos2dx/platform/config_platform.h index 5f37e9e9f8..a478f03448 100644 --- a/cocos2dx/platform/config_platform.h +++ b/cocos2dx/platform/config_platform.h @@ -27,6 +27,8 @@ THE SOFTWARE. #define CCX_PLATFORM_UPHONE #elif defined (WIN32) && defined (_WINDOWS) // under win32pc #define CCX_PLATFORM_WIN32 +#elif defined (_ANDROID) + #define CCX_PLATFORM_ANDROID #endif // user configure @@ -52,6 +54,6 @@ THE SOFTWARE. #endif // check compiling platform -#if ! defined(CCX_PLATFORM_UPHONE) && ! defined(CCX_PLATFORM_WIN32) +#if ! defined(CCX_PLATFORM_UPHONE) && ! defined(CCX_PLATFORM_WIN32) && ! defined(CCX_PLATFORM_ANDROID) #error "no platform macro defined!" #endif diff --git a/cocos2dx/platform/platform.h b/cocos2dx/platform/platform.h index a97ffb88b8..48c2a2476a 100644 --- a/cocos2dx/platform/platform.h +++ b/cocos2dx/platform/platform.h @@ -40,6 +40,12 @@ THE SOFTWARE. #include "win32/Cocos2dTypes.h" #include "win32/CCXBitmapDC.h" #include "win32/ZipUtils.h" +#elif defined(CCX_PLATFORM_ANDROID) + #include "android/CCTime.h" + #include "android/NSLock.h" + #include "android/Cocos2dTypes.h" + #include "android/CCXBitmapDC.h" + #include "android/ZipUtils.h" #else #error #endif diff --git a/cocos2dx/platform/win32/CCXApplication_win32.h b/cocos2dx/platform/win32/CCXApplication_win32.h index c226084a24..88a919aa8d 100644 --- a/cocos2dx/platform/win32/CCXApplication_win32.h +++ b/cocos2dx/platform/win32/CCXApplication_win32.h @@ -84,4 +84,6 @@ protected: } // end of namespace cocos2d +extern JNIEnv *env; + #endif // end of __CCX_APPLICATION_WIN32_H__ diff --git a/cocos2dx/support/data_support/uthash.h b/cocos2dx/support/data_support/uthash.h index 9e29ca16e0..d5f9a59c7a 100644 --- a/cocos2dx/support/data_support/uthash.h +++ b/cocos2dx/support/data_support/uthash.h @@ -27,6 +27,8 @@ THE SOFTWARE. #include /* memcmp,strlen */ #include /* ptrdiff_t */ +#include /* exit() */ + namespace cocos2d { /* These macros use decltype or the earlier __typeof GNU extension. diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 45835e11ab..05278a1e34 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -26,12 +26,12 @@ THE SOFTWARE. // cocos2d #include "CCTextureAtlas.h" #include "CCTextureCache.h" -#include "ccMacros.h" +// #include "ccMacros.h" // support #include "CCTexture2D.h" -#include +#include //According to some tests GL_TRIANGLE_STRIP is slower, MUCH slower. Probably I'm doing something very wrong @@ -47,7 +47,7 @@ CCTextureAtlas::CCTextureAtlas() CCTextureAtlas::~CCTextureAtlas() { - CCLOGINFO("cocos2d: deallocing CCTextureAtlas."); +// CCLOGINFO("cocos2d: deallocing CCTextureAtlas."); CCX_SAFE_FREE(m_pQuads) CCX_SAFE_FREE(m_pIndices) @@ -139,7 +139,7 @@ bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity m_pIndices = (GLushort *)calloc( sizeof(GLushort) * m_uCapacity * 6, 1 ); if( ! ( m_pQuads && m_pIndices) ) { - CCLOG("cocos2d: CCTextureAtlas: not enough memory"); + //CCLOG("cocos2d: CCTextureAtlas: not enough memory"); CCX_SAFE_FREE(m_pQuads) CCX_SAFE_FREE(m_pIndices) return false; @@ -237,7 +237,7 @@ void CCTextureAtlas::insertQuadFromIndex(unsigned int oldIndex, unsigned int new if( oldIndex == newIndex ) return; - unsigned int howMany = std::abs( oldIndex - newIndex); + unsigned int howMany = abs( oldIndex - newIndex); int dst = oldIndex; int src = oldIndex + 1; if( oldIndex > newIndex) { @@ -288,7 +288,7 @@ bool CCTextureAtlas::resizeCapacity(unsigned int newCapacity) void * tmpIndices = realloc( m_pIndices, sizeof(m_pIndices[0]) * m_uCapacity * 6 ); if( ! ( tmpQuads && tmpIndices) ) { - CCLOG("cocos2d: CCTextureAtlas: not enough memory"); + //CCLOG("cocos2d: CCTextureAtlas: not enough memory"); if( tmpQuads ) free(tmpQuads); else