mirror of https://github.com/axmolengine/axmol.git
resolve compile error for android
This commit is contained in:
parent
fb477f47f5
commit
6853385c8d
|
@ -24,6 +24,8 @@ THE SOFTWARE.
|
||||||
#include "CCGrid3DAction.h"
|
#include "CCGrid3DAction.h"
|
||||||
#include "CGPointExtension.h"
|
#include "CGPointExtension.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace cocos2d
|
namespace cocos2d
|
||||||
{
|
{
|
||||||
// implementation of CCWaves3D
|
// implementation of CCWaves3D
|
||||||
|
|
|
@ -27,6 +27,8 @@ THE SOFTWARE.
|
||||||
#include "CGPointExtension.h"
|
#include "CGPointExtension.h"
|
||||||
#include "effects/CCGrid.h"
|
#include "effects/CCGrid.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace cocos2d
|
namespace cocos2d
|
||||||
{
|
{
|
||||||
struct Tile
|
struct Tile
|
||||||
|
|
|
@ -23,7 +23,7 @@ THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef __CCRIBBON_H__
|
#ifndef __CCRIBBON_H__
|
||||||
#define __CCRIBBON_H__
|
#define __CCRIBBON_H__
|
||||||
#include <GLES/egl.h>
|
/*#include <GLES/egl.h>*/
|
||||||
#include "CCNode.h"
|
#include "CCNode.h"
|
||||||
#include "CCProtocols.h"
|
#include "CCProtocols.h"
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
|
@ -122,14 +122,14 @@ namespace cocos2d {
|
||||||
CGSize size = CCDirector::getSharedDirector()->getDisplaySize();
|
CGSize size = CCDirector::getSharedDirector()->getDisplaySize();
|
||||||
glViewport(0, 0, (GLsizei)size.width, (GLsizei)size.height);
|
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)
|
void CCRenderTexture::clear(float r, float g, float b, float a)
|
||||||
{
|
{
|
||||||
this->begin();
|
this->begin();
|
||||||
glClearColor(r, g, b, a);
|
glClearColor(r, g, b, a);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glColorMask(TRUE, TRUE, TRUE, FALSE);
|
glColorMask(true, true, true, false);
|
||||||
this->end();
|
this->end();
|
||||||
}
|
}
|
||||||
bool CCRenderTexture::saveBuffer(const char *name)
|
bool CCRenderTexture::saveBuffer(const char *name)
|
||||||
|
|
|
@ -30,6 +30,8 @@ THE SOFTWARE.
|
||||||
#include "uphone/CCXFileUtils_uphone.h"
|
#include "uphone/CCXFileUtils_uphone.h"
|
||||||
#elif defined(CCX_PLATFORM_WIN32)
|
#elif defined(CCX_PLATFORM_WIN32)
|
||||||
#include "win32/CCXFileUtils_win32.h"
|
#include "win32/CCXFileUtils_win32.h"
|
||||||
|
#elif defined(CCX_PLATFORM_ANDROID)
|
||||||
|
#include "android/CCXFileUtils_android.h"
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif // __CCX_FILEUTILS_PLATFORM_H__
|
#endif // __CCX_FILEUTILS_PLATFORM_H__
|
||||||
|
|
|
@ -31,6 +31,8 @@ THE SOFTWARE.
|
||||||
#include "uphone/CCXApplication_uphone.h"
|
#include "uphone/CCXApplication_uphone.h"
|
||||||
#elif defined(CCX_PLATFORM_WIN32)
|
#elif defined(CCX_PLATFORM_WIN32)
|
||||||
#include "win32/CCXApplication_win32.h"
|
#include "win32/CCXApplication_win32.h"
|
||||||
|
#elif defined(CCX_PLATFORM_ANDROID)
|
||||||
|
#include "android/CCXApplication_android.h"
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,8 @@ THE SOFTWARE.
|
||||||
#include "uphone/CCXEGLView_uphone.h"
|
#include "uphone/CCXEGLView_uphone.h"
|
||||||
#elif defined(CCX_PLATFORM_WIN32)
|
#elif defined(CCX_PLATFORM_WIN32)
|
||||||
#include "win32/CCXEGLView_win32.h"
|
#include "win32/CCXEGLView_win32.h"
|
||||||
|
#elif defined(CCX_PLATFORM_ANDROID)
|
||||||
|
#include "android/CCXEGLView_android.h"
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,6 +30,8 @@ THE SOFTWARE.
|
||||||
#include "uphone/CCXUIImage_uphone.h"
|
#include "uphone/CCXUIImage_uphone.h"
|
||||||
#elif defined(CCX_PLATFORM_WIN32)
|
#elif defined(CCX_PLATFORM_WIN32)
|
||||||
#include "win32/CCXUIImage_win32.h"
|
#include "win32/CCXUIImage_win32.h"
|
||||||
|
#elif defined(CCX_PLATFORM_ANDROID)
|
||||||
|
#include "android/CCXUIImage_android.h"
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif // __CCX_UIIMAGE_PLATFORM_H__
|
#endif // __CCX_UIIMAGE_PLATFORM_H__
|
||||||
|
|
|
@ -31,6 +31,8 @@ THE SOFTWARE.
|
||||||
#include "uphone/ccxCommon_uphone.h"
|
#include "uphone/ccxCommon_uphone.h"
|
||||||
#elif defined(CCX_PLATFORM_WIN32)
|
#elif defined(CCX_PLATFORM_WIN32)
|
||||||
#include "win32/ccxCommon_win32.h"
|
#include "win32/ccxCommon_win32.h"
|
||||||
|
#elif defined(CCX_PLATFORM_ANDROID)
|
||||||
|
#include "android/ccxCommon_android.h"
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,6 +27,8 @@ THE SOFTWARE.
|
||||||
#define CCX_PLATFORM_UPHONE
|
#define CCX_PLATFORM_UPHONE
|
||||||
#elif defined (WIN32) && defined (_WINDOWS) // under win32pc
|
#elif defined (WIN32) && defined (_WINDOWS) // under win32pc
|
||||||
#define CCX_PLATFORM_WIN32
|
#define CCX_PLATFORM_WIN32
|
||||||
|
#elif defined (_ANDROID)
|
||||||
|
#define CCX_PLATFORM_ANDROID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// user configure
|
// user configure
|
||||||
|
@ -52,6 +54,6 @@ THE SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check compiling platform
|
// 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!"
|
#error "no platform macro defined!"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,6 +40,12 @@ THE SOFTWARE.
|
||||||
#include "win32/Cocos2dTypes.h"
|
#include "win32/Cocos2dTypes.h"
|
||||||
#include "win32/CCXBitmapDC.h"
|
#include "win32/CCXBitmapDC.h"
|
||||||
#include "win32/ZipUtils.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
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -84,4 +84,6 @@ protected:
|
||||||
|
|
||||||
} // end of namespace cocos2d
|
} // end of namespace cocos2d
|
||||||
|
|
||||||
|
extern JNIEnv *env;
|
||||||
|
|
||||||
#endif // end of __CCX_APPLICATION_WIN32_H__
|
#endif // end of __CCX_APPLICATION_WIN32_H__
|
||||||
|
|
|
@ -27,6 +27,8 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include <string.h> /* memcmp,strlen */
|
#include <string.h> /* memcmp,strlen */
|
||||||
#include <stddef.h> /* ptrdiff_t */
|
#include <stddef.h> /* ptrdiff_t */
|
||||||
|
#include <stdlib.h> /* exit() */
|
||||||
|
|
||||||
namespace cocos2d {
|
namespace cocos2d {
|
||||||
|
|
||||||
/* These macros use decltype or the earlier __typeof GNU extension.
|
/* These macros use decltype or the earlier __typeof GNU extension.
|
||||||
|
|
|
@ -26,12 +26,12 @@ THE SOFTWARE.
|
||||||
// cocos2d
|
// cocos2d
|
||||||
#include "CCTextureAtlas.h"
|
#include "CCTextureAtlas.h"
|
||||||
#include "CCTextureCache.h"
|
#include "CCTextureCache.h"
|
||||||
#include "ccMacros.h"
|
// #include "ccMacros.h"
|
||||||
|
|
||||||
// support
|
// support
|
||||||
#include "CCTexture2D.h"
|
#include "CCTexture2D.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
//According to some tests GL_TRIANGLE_STRIP is slower, MUCH slower. Probably I'm doing something very wrong
|
//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()
|
CCTextureAtlas::~CCTextureAtlas()
|
||||||
{
|
{
|
||||||
CCLOGINFO("cocos2d: deallocing CCTextureAtlas.");
|
// CCLOGINFO("cocos2d: deallocing CCTextureAtlas.");
|
||||||
|
|
||||||
CCX_SAFE_FREE(m_pQuads)
|
CCX_SAFE_FREE(m_pQuads)
|
||||||
CCX_SAFE_FREE(m_pIndices)
|
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 );
|
m_pIndices = (GLushort *)calloc( sizeof(GLushort) * m_uCapacity * 6, 1 );
|
||||||
|
|
||||||
if( ! ( m_pQuads && m_pIndices) ) {
|
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_pQuads)
|
||||||
CCX_SAFE_FREE(m_pIndices)
|
CCX_SAFE_FREE(m_pIndices)
|
||||||
return false;
|
return false;
|
||||||
|
@ -237,7 +237,7 @@ void CCTextureAtlas::insertQuadFromIndex(unsigned int oldIndex, unsigned int new
|
||||||
if( oldIndex == newIndex )
|
if( oldIndex == newIndex )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int howMany = std::abs( oldIndex - newIndex);
|
unsigned int howMany = abs( oldIndex - newIndex);
|
||||||
int dst = oldIndex;
|
int dst = oldIndex;
|
||||||
int src = oldIndex + 1;
|
int src = oldIndex + 1;
|
||||||
if( oldIndex > newIndex) {
|
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 );
|
void * tmpIndices = realloc( m_pIndices, sizeof(m_pIndices[0]) * m_uCapacity * 6 );
|
||||||
|
|
||||||
if( ! ( tmpQuads && tmpIndices) ) {
|
if( ! ( tmpQuads && tmpIndices) ) {
|
||||||
CCLOG("cocos2d: CCTextureAtlas: not enough memory");
|
//CCLOG("cocos2d: CCTextureAtlas: not enough memory");
|
||||||
if( tmpQuads )
|
if( tmpQuads )
|
||||||
free(tmpQuads);
|
free(tmpQuads);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue