From 9cba2c42c165612942ba7342559a8072ec82ea87 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 2 Aug 2013 17:33:27 +0800 Subject: [PATCH] closed #2434: simply Android.mk --- cocos2dx/Android.mk | 175 ++------ cocos2dx/textures/CCTexturePVR.cpp | 688 ----------------------------- cocos2dx/textures/CCTexturePVR.h | 150 ------- extensions/Android.mk | 103 +---- external/Box2D/Android.mk | 50 +-- external/chipmunk/Android.mk | 34 +- samples/Cpp/TestCpp/Android.mk | 109 +---- 7 files changed, 57 insertions(+), 1252 deletions(-) delete mode 100644 cocos2dx/textures/CCTexturePVR.cpp delete mode 100644 cocos2dx/textures/CCTexturePVR.h diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index 3c40e54a31..458de10753 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -6,140 +6,47 @@ LOCAL_MODULE := cocos2dx_static LOCAL_MODULE_FILENAME := libcocos2d -LOCAL_SRC_FILES := \ -CCConfiguration.cpp \ -CCDeprecated.cpp \ -CCScheduler.cpp \ -CCCamera.cpp \ -ccFPSImages.c \ -ccTypes.cpp \ -actions/CCAction.cpp \ -actions/CCActionCamera.cpp \ -actions/CCActionCatmullRom.cpp \ -actions/CCActionEase.cpp \ -actions/CCActionGrid.cpp \ -actions/CCActionGrid3D.cpp \ -actions/CCActionInstant.cpp \ -actions/CCActionInterval.cpp \ -actions/CCActionManager.cpp \ -actions/CCActionPageTurn3D.cpp \ -actions/CCActionProgressTimer.cpp \ -actions/CCActionTiledGrid.cpp \ -actions/CCActionTween.cpp \ -base_nodes/CCAtlasNode.cpp \ -base_nodes/CCNode.cpp \ -cocoa/CCAffineTransform.cpp \ -cocoa/CCGeometry.cpp \ -cocoa/CCAutoreleasePool.cpp \ -cocoa/CCDictionary.cpp \ -cocoa/CCNS.cpp \ -cocoa/CCObject.cpp \ -cocoa/CCSet.cpp \ -cocoa/CCString.cpp \ -cocoa/CCArray.cpp \ -cocoa/CCDataVisitor.cpp \ -cocoa/CCData.cpp \ -cocos2d.cpp \ -CCDirector.cpp \ -draw_nodes/CCDrawingPrimitives.cpp \ -draw_nodes/CCDrawNode.cpp \ -effects/CCGrabber.cpp \ -effects/CCGrid.cpp \ -kazmath/src/aabb.c \ -kazmath/src/mat3.c \ -kazmath/src/mat4.c \ -kazmath/src/neon_matrix_impl.c \ -kazmath/src/plane.c \ -kazmath/src/quaternion.c \ -kazmath/src/ray2.c \ -kazmath/src/utility.c \ -kazmath/src/vec2.c \ -kazmath/src/vec3.c \ -kazmath/src/vec4.c \ -kazmath/src/GL/mat4stack.c \ -kazmath/src/GL/matrix.c \ -keypad_dispatcher/CCKeypadDelegate.cpp \ -keypad_dispatcher/CCKeypadDispatcher.cpp \ -keyboard_dispatcher/CCKeyboardDispatcher.cpp \ -label_nodes/CCLabelAtlas.cpp \ -label_nodes/CCLabelBMFont.cpp \ -label_nodes/CCLabelTTF.cpp \ -layers_scenes_transitions_nodes/CCLayer.cpp \ -layers_scenes_transitions_nodes/CCScene.cpp \ -layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \ -layers_scenes_transitions_nodes/CCTransition.cpp \ -layers_scenes_transitions_nodes/CCTransitionProgress.cpp \ -menu_nodes/CCMenu.cpp \ -menu_nodes/CCMenuItem.cpp \ -misc_nodes/CCClippingNode.cpp \ -misc_nodes/CCMotionStreak.cpp \ -misc_nodes/CCProgressTimer.cpp \ -misc_nodes/CCRenderTexture.cpp \ -particle_nodes/CCParticleExamples.cpp \ -particle_nodes/CCParticleSystem.cpp \ -particle_nodes/CCParticleBatchNode.cpp \ -particle_nodes/CCParticleSystemQuad.cpp \ -platform/CCSAXParser.cpp \ -platform/CCThread.cpp \ -platform/CCFileUtils.cpp \ -platform/CCEGLViewProtocol.cpp \ -platform/android/CCDevice.cpp \ -platform/android/CCEGLView.cpp \ -platform/android/CCAccelerometer.cpp \ -platform/android/CCApplication.cpp \ -platform/android/CCCommon.cpp \ -platform/android/CCFileUtilsAndroid.cpp \ -platform/android/CCImage.cpp \ -platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \ -platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \ -platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp \ -platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \ -platform/android/jni/JniHelper.cpp \ -platform/android/jni/IMEJni.cpp \ -platform/android/jni/TouchesJni.cpp \ -platform/android/jni/DPIJni.cpp \ -script_support/CCScriptSupport.cpp \ -shaders/ccShaders.cpp \ -shaders/CCGLProgram.cpp \ -shaders/ccGLStateCache.cpp \ -shaders/CCShaderCache.cpp \ -sprite_nodes/CCAnimation.cpp \ -sprite_nodes/CCAnimationCache.cpp \ -sprite_nodes/CCSprite.cpp \ -sprite_nodes/CCSpriteBatchNode.cpp \ -sprite_nodes/CCSpriteFrame.cpp \ -sprite_nodes/CCSpriteFrameCache.cpp \ -support/ccUTF8.cpp \ -support/CCNotificationCenter.cpp \ -support/CCProfiling.cpp \ -support/TransformUtils.cpp \ -support/user_default/CCUserDefaultAndroid.cpp \ -support/base64.cpp \ -support/ccUtils.cpp \ -support/CCVertex.cpp \ -support/data_support/ccCArray.cpp \ -support/image_support/TGAlib.cpp \ -support/tinyxml2/tinyxml2.cpp \ -support/zip_support/ZipUtils.cpp \ -support/zip_support/ioapi.cpp \ -support/zip_support/unzip.cpp \ -support/component/CCComponent.cpp \ -support/component/CCComponentContainer.cpp \ -text_input_node/CCIMEDispatcher.cpp \ -text_input_node/CCTextFieldTTF.cpp \ -textures/CCTexture2D.cpp \ -textures/CCTextureAtlas.cpp \ -textures/CCTextureCache.cpp \ -platform/third_party/common/etc/etc1.cpp\ -tilemap_parallax_nodes/CCParallaxNode.cpp \ -tilemap_parallax_nodes/CCTMXLayer.cpp \ -tilemap_parallax_nodes/CCTMXObjectGroup.cpp \ -tilemap_parallax_nodes/CCTMXTiledMap.cpp \ -tilemap_parallax_nodes/CCTMXXMLParser.cpp \ -tilemap_parallax_nodes/CCTileMapAtlas.cpp \ -touch_dispatcher/CCTouchDispatcher.cpp \ -touch_dispatcher/CCTouchHandler.cpp \ -touch_dispatcher/CCTouch.cpp +# need to accureate control of directories, so not use 'find' to list all +cpp_dirs := $(LOCAL_PATH) \ + $(LOCAL_PATH)/base_nodes \ + $(LOCAL_PATH)/actions \ + $(LOCAL_PATH)/cocoa \ + $(LOCAL_PATH)/draw_nodes \ + $(LOCAL_PATH)/effects \ + $(LOCAL_PATH)/keyboard_dispatcher \ + $(LOCAL_PATH)/keypad_dispatcher \ + $(LOCAL_PATH)/label_nodes \ + $(LOCAL_PATH)/layers_scenes_transitions_nodes \ + $(LOCAL_PATH)/menu_nodes \ + $(LOCAL_PATH)/misc_nodes \ + $(LOCAL_PATH)/particle_nodes \ + $(LOCAL_PATH)/platform \ + $(LOCAL_PATH)/platform/third_party/common/etc \ + $(LOCAL_PATH)/platform/android \ + $(LOCAL_PATH)/platform/android/jni \ + $(LOCAL_PATH)/script_support \ + $(LOCAL_PATH)/shaders \ + $(LOCAL_PATH)/sprite_nodes \ + $(LOCAL_PATH)/support \ + $(LOCAL_PATH)/support/component \ + $(LOCAL_PATH)/support/data_support \ + $(LOCAL_PATH)/support/image_support \ + $(LOCAL_PATH)/support/tinyxml2 \ + $(LOCAL_PATH)/support/user_default \ + $(LOCAL_PATH)/support/zip_support \ + $(LOCAL_PATH)/text_input_node \ + $(LOCAL_PATH)/textures \ + $(LOCAL_PATH)/tilemap_parallax_nodes \ + $(LOCAL_PATH)/touch_dispatcher + +c_dirs := $(LOCAL_PATH)\ + $(LOCAL_PATH)/kazmath/src \ + $(LOCAL_PATH)/kazmath/src/GL + +find_cpp_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp)) +find_c_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.c)) +LOCAL_SRC_FILES := $(foreach dir, $(cpp_dirs), $(find_cpp_files)) +LOCAL_SRC_FILES += $(foreach dir, $(c_dirs), $(find_c_files)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \ $(LOCAL_PATH)/include \ diff --git a/cocos2dx/textures/CCTexturePVR.cpp b/cocos2dx/textures/CCTexturePVR.cpp deleted file mode 100644 index d06c0f8a35..0000000000 --- a/cocos2dx/textures/CCTexturePVR.cpp +++ /dev/null @@ -1,688 +0,0 @@ -/**************************************************************************** -Copyright (c) 2011 Jirka Fajfr for cocos2d-x -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2008 Apple Inc. All Rights Reserved. - -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. -****************************************************************************/ - -#include "CCTexture2D.h" -#include "CCTexturePVR.h" -#include "ccMacros.h" -#include "CCConfiguration.h" -#include "support/ccUtils.h" -#include "CCStdC.h" -#include "platform/CCFileUtils.h" -#include "support/zip_support/ZipUtils.h" -#include "shaders/ccGLStateCache.h" -#include -#include - -NS_CC_BEGIN - -#define PVR_TEXTURE_FLAG_TYPE_MASK 0xff - -// -// XXX DO NO ALTER THE ORDER IN THIS LIST XXX -// -static const ccPVRTexturePixelFormatInfo PVRTableFormats[] = { - - // 0: BGRA_8888 - {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, 32, false, true, Texture2D::PixelFormat::RGBA8888}, - // 1: RGBA_8888 - {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 32, false, true, Texture2D::PixelFormat::RGBA8888}, - // 2: RGBA_4444 - {GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, false, true, Texture2D::PixelFormat::RGBA4444}, - // 3: RGBA_5551 - {GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, false, true, Texture2D::PixelFormat::RGB5A1}, - // 4: RGB_565 - {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 16, false, false, Texture2D::PixelFormat::RGB565}, - // 5: RGB_888 - {GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, 24, false, false, Texture2D::PixelFormat::RGB888}, - // 6: A_8 - {GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, 8, false, false, Texture2D::PixelFormat::A8}, - // 7: L_8 - {GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, 8, false, false, Texture2D::PixelFormat::I8}, - // 8: LA_88 - {GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 16, false, true, Texture2D::PixelFormat::AI88}, - -// Not all platforms include GLES/gl2ext.h so these PVRTC enums are not always -// available. -#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG - // 9: PVRTC 2BPP RGB - {GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 2, true, false, Texture2D::PixelFormat::PRVTC2}, - // 10: PVRTC 2BPP RGBA - {GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 2, true, true, Texture2D::PixelFormat::PRVTC2}, - // 11: PVRTC 4BPP RGB - {GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 4, true, false, Texture2D::PixelFormat::PRVTC4}, - // 12: PVRTC 4BPP RGBA - {GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, 0xFFFFFFFF, 0xFFFFFFFF, 4, true, true, Texture2D::PixelFormat::PRVTC4}, -#endif -}; - -struct _pixel_formathash { - uint64_t pixelFormat; - const ccPVRTexturePixelFormatInfo * pixelFormatInfo; -}; - -// Values taken from PVRTexture.h from http://www.imgtec.com -enum { - kPVR2TextureFlagMipmap = (1<<8), // has mip map levels - kPVR2TextureFlagTwiddle = (1<<9), // is twiddled - kPVR2TextureFlagBumpmap = (1<<10), // has normals encoded for a bump map - kPVR2TextureFlagTiling = (1<<11), // is bordered for tiled pvr - kPVR2TextureFlagCubemap = (1<<12), // is a cubemap/skybox - kPVR2TextureFlagFalseMipCol = (1<<13), // are there false colored MIP levels - kPVR2TextureFlagVolume = (1<<14), // is this a volume texture - kPVR2TextureFlagAlpha = (1<<15), // v2.1 is there transparency info in the texture - kPVR2TextureFlagVerticalFlip = (1<<16), // v2.1 is the texture vertically flipped -}; - -enum { - kPVR3TextureFlagPremultipliedAlpha = (1<<1) // has premultiplied alpha -}; - -static char gPVRTexIdentifier[5] = "PVR!"; - -// v2 -typedef enum -{ - kPVR2TexturePixelFormat_RGBA_4444= 0x10, - kPVR2TexturePixelFormat_RGBA_5551, - kPVR2TexturePixelFormat_RGBA_8888, - kPVR2TexturePixelFormat_RGB_565, - kPVR2TexturePixelFormat_RGB_555, // unsupported - kPVR2TexturePixelFormat_RGB_888, - kPVR2TexturePixelFormat_I_8, - kPVR2TexturePixelFormat_AI_88, - kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA, - kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA, - kPVR2TexturePixelFormat_BGRA_8888, - kPVR2TexturePixelFormat_A_8, -} ccPVR2TexturePixelFormat; - -// v3 -/* supported predefined formats */ -#define kPVR3TexturePixelFormat_PVRTC_2BPP_RGB 0 -#define kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA 1 -#define kPVR3TexturePixelFormat_PVRTC_4BPP_RGB 2 -#define kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA 3 - -/* supported channel type formats */ -#define kPVR3TexturePixelFormat_BGRA_8888 0x0808080861726762ULL -#define kPVR3TexturePixelFormat_RGBA_8888 0x0808080861626772ULL -#define kPVR3TexturePixelFormat_RGBA_4444 0x0404040461626772ULL -#define kPVR3TexturePixelFormat_RGBA_5551 0x0105050561626772ULL -#define kPVR3TexturePixelFormat_RGB_565 0x0005060500626772ULL -#define kPVR3TexturePixelFormat_RGB_888 0x0008080800626772ULL -#define kPVR3TexturePixelFormat_A_8 0x0000000800000061ULL -#define kPVR3TexturePixelFormat_L_8 0x000000080000006cULL -#define kPVR3TexturePixelFormat_LA_88 0x000008080000616cULL - - -// v2 -static struct _pixel_formathash v2_pixel_formathash[] = { - - { kPVR2TexturePixelFormat_BGRA_8888, &PVRTableFormats[0] }, - { kPVR2TexturePixelFormat_RGBA_8888, &PVRTableFormats[1] }, - { kPVR2TexturePixelFormat_RGBA_4444, &PVRTableFormats[2] }, - { kPVR2TexturePixelFormat_RGBA_5551, &PVRTableFormats[3] }, - { kPVR2TexturePixelFormat_RGB_565, &PVRTableFormats[4] }, - { kPVR2TexturePixelFormat_RGB_888, &PVRTableFormats[5] }, - { kPVR2TexturePixelFormat_A_8, &PVRTableFormats[6] }, - { kPVR2TexturePixelFormat_I_8, &PVRTableFormats[7] }, - { kPVR2TexturePixelFormat_AI_88, &PVRTableFormats[8] }, - -#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG - { kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA, &PVRTableFormats[10] }, - { kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA, &PVRTableFormats[12] }, -#endif -}; - -#define PVR2_MAX_TABLE_ELEMENTS (sizeof(v2_pixel_formathash) / sizeof(v2_pixel_formathash[0])) - -// v3 -struct _pixel_formathash v3_pixel_formathash[] = { - - {kPVR3TexturePixelFormat_BGRA_8888, &PVRTableFormats[0] }, - {kPVR3TexturePixelFormat_RGBA_8888, &PVRTableFormats[1] }, - {kPVR3TexturePixelFormat_RGBA_4444, &PVRTableFormats[2] }, - {kPVR3TexturePixelFormat_RGBA_5551, &PVRTableFormats[3] }, - {kPVR3TexturePixelFormat_RGB_565, &PVRTableFormats[4] }, - {kPVR3TexturePixelFormat_RGB_888, &PVRTableFormats[5] }, - {kPVR3TexturePixelFormat_A_8, &PVRTableFormats[6] }, - {kPVR3TexturePixelFormat_L_8, &PVRTableFormats[7] }, - {kPVR3TexturePixelFormat_LA_88, &PVRTableFormats[8] }, - -#ifdef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG - {kPVR3TexturePixelFormat_PVRTC_2BPP_RGB, &PVRTableFormats[9] }, - {kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA, &PVRTableFormats[10] }, - {kPVR3TexturePixelFormat_PVRTC_4BPP_RGB, &PVRTableFormats[11] }, - {kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA, &PVRTableFormats[12] }, -#endif -}; - - -//Tells How large is tableFormats -#define PVR3_MAX_TABLE_ELEMENTS (sizeof(v3_pixel_formathash) / sizeof(v3_pixel_formathash[0])) - - -typedef struct _PVRTexHeader -{ - unsigned int headerLength; - unsigned int height; - unsigned int width; - unsigned int numMipmaps; - unsigned int flags; - unsigned int dataLength; - unsigned int bpp; - unsigned int bitmaskRed; - unsigned int bitmaskGreen; - unsigned int bitmaskBlue; - unsigned int bitmaskAlpha; - unsigned int pvrTag; - unsigned int numSurfs; -} ccPVRv2TexHeader; - -#ifdef _MSC_VER -#pragma pack(push,1) -#endif -typedef struct { - uint32_t version; - uint32_t flags; - uint64_t pixelFormat; - uint32_t colorSpace; - uint32_t channelType; - uint32_t height; - uint32_t width; - uint32_t depth; - uint32_t numberOfSurfaces; - uint32_t numberOfFaces; - uint32_t numberOfMipmaps; - uint32_t metadataLength; -#ifdef _MSC_VER -} ccPVRv3TexHeader; -#pragma pack(pop) -#else -} __attribute__((packed)) ccPVRv3TexHeader; -#endif - - -TexturePVR::TexturePVR() -: _numberOfMipmaps(0) -, _width(0) -, _height(0) -, _name(0) -, _hasAlpha(false) -, _hasPremultipliedAlpha(false) -, _forcePremultipliedAlpha(false) -, _retainName(false) -, _format(Texture2D::PixelFormat::DEFAULT) -, _pixelFormatInfo(NULL) -{ -} - -TexturePVR::~TexturePVR() -{ - CCLOGINFO( "cocos2d: deallocing TexturePVR: %p", this ); - - if (_name != 0 && ! _retainName) - { - GL::deleteTexture(_name); - } -} - -bool TexturePVR::unpackPVRv2Data(unsigned char* data, unsigned int len) -{ - bool success = false; - ccPVRv2TexHeader *header = NULL; - unsigned int flags, pvrTag; - unsigned int dataLength = 0, dataOffset = 0, dataSize = 0; - unsigned int blockSize = 0, widthBlocks = 0, heightBlocks = 0; - unsigned int width = 0, height = 0, bpp = 4; - unsigned char *bytes = NULL; - unsigned int formatFlags; - - //Cast first sizeof(PVRTexHeader) bytes of data stream as PVRTexHeader - header = (ccPVRv2TexHeader *)data; - - //Make sure that tag is in correct formatting - pvrTag = CC_SWAP_INT32_LITTLE_TO_HOST(header->pvrTag); - - if (gPVRTexIdentifier[0] != (char)(((pvrTag >> 0) & 0xff)) || - gPVRTexIdentifier[1] != (char)(((pvrTag >> 8) & 0xff)) || - gPVRTexIdentifier[2] != (char)(((pvrTag >> 16) & 0xff)) || - gPVRTexIdentifier[3] != (char)(((pvrTag >> 24) & 0xff))) - { - return false; - } - - Configuration *configuration = Configuration::getInstance(); - - flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags); - formatFlags = flags & PVR_TEXTURE_FLAG_TYPE_MASK; - bool flipped = (flags & kPVR2TextureFlagVerticalFlip) ? true : false; - if (flipped) - { - CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool"); - } - - if (! configuration->supportsNPOT() && - (header->width != ccNextPOT(header->width) || header->height != ccNextPOT(header->height))) - { - CCLOG("cocos2d: ERROR: Loading an NPOT texture (%dx%d) but is not supported on this device", header->width, header->height); - return false; - } - - unsigned int pvr2TableElements = PVR2_MAX_TABLE_ELEMENTS; - if (! Configuration::getInstance()->supportsPVRTC()) - { - pvr2TableElements = 9; - } - - for (unsigned int i = 0; i < pvr2TableElements; i++) - { - //Does image format in table fits to the one parsed from header? - if (v2_pixel_formathash[i].pixelFormat == formatFlags) - { - _pixelFormatInfo = v2_pixel_formathash[i].pixelFormatInfo; - - //Reset num of mipmaps - _numberOfMipmaps = 0; - - //Get size of mipmap - _width = width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width); - _height = height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height); - - //Do we use alpha ? - if (CC_SWAP_INT32_LITTLE_TO_HOST(header->bitmaskAlpha)) - { - _hasAlpha = true; - } - else - { - _hasAlpha = false; - } - - //Get ptr to where data starts.. - dataLength = CC_SWAP_INT32_LITTLE_TO_HOST(header->dataLength); - - //Move by size of header - bytes = ((unsigned char *)data) + sizeof(ccPVRv2TexHeader); - _format = _pixelFormatInfo->ccPixelFormat; - bpp = _pixelFormatInfo->bpp; - - // Calculate the data size for each texture level and respect the minimum number of blocks - while (dataOffset < dataLength) - { - switch (formatFlags) { - case kPVR2TexturePixelFormat_PVRTC_2BPP_RGBA: - blockSize = 8 * 4; // Pixel by pixel block size for 2bpp - widthBlocks = width / 8; - heightBlocks = height / 4; - break; - case kPVR2TexturePixelFormat_PVRTC_4BPP_RGBA: - blockSize = 4 * 4; // Pixel by pixel block size for 4bpp - widthBlocks = width / 4; - heightBlocks = height / 4; - break; - case kPVR2TexturePixelFormat_BGRA_8888: - if (Configuration::getInstance()->supportsBGRA8888() == false) - { - CCLOG("cocos2d: TexturePVR. BGRA8888 not supported on this device"); - return false; - } - default: - blockSize = 1; - widthBlocks = width; - heightBlocks = height; - break; - } - - // Clamp to minimum number of blocks - if (widthBlocks < 2) - { - widthBlocks = 2; - } - if (heightBlocks < 2) - { - heightBlocks = 2; - } - - dataSize = widthBlocks * heightBlocks * ((blockSize * bpp) / 8); - unsigned int packetLength = (dataLength - dataOffset); - packetLength = packetLength > dataSize ? dataSize : packetLength; - - //Make record to the mipmaps array and increment counter - _asMipmaps[_numberOfMipmaps].address = bytes + dataOffset; - _asMipmaps[_numberOfMipmaps].len = packetLength; - _numberOfMipmaps++; - - //Check that we didn't overflow - CCASSERT(_numberOfMipmaps < CC_PVRMIPMAP_MAX, - "TexturePVR: Maximum number of mipmaps reached. Increase the CC_PVRMIPMAP_MAX value"); - - dataOffset += packetLength; - - //Update width and height to the next lower power of two - width = MAX(width >> 1, 1); - height = MAX(height >> 1, 1); - } - - //Mark pass as success - success = true; - break; - } - } - - if (! success) - { - CCLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%2x. Re-encode it with a OpenGL pixel format variant", formatFlags); - } - - return success; -} - -bool TexturePVR::unpackPVRv3Data(unsigned char* dataPointer, unsigned int dataLength) -{ - if (dataLength < sizeof(ccPVRv3TexHeader)) - { - return false; - } - - ccPVRv3TexHeader *header = (ccPVRv3TexHeader *)dataPointer; - - // validate version - if (CC_SWAP_INT32_BIG_TO_HOST(header->version) != 0x50565203) - { - CCLOG("cocos2d: WARNING: pvr file version mismatch"); - return false; - } - - // parse pixel format - uint64_t pixelFormat = header->pixelFormat; - - - bool infoValid = false; - - unsigned int pvr3TableElements = PVR3_MAX_TABLE_ELEMENTS; - if (! Configuration::getInstance()->supportsPVRTC()) - { - pvr3TableElements = 9; - } - - for(unsigned int i = 0; i < pvr3TableElements; i++) - { - if( v3_pixel_formathash[i].pixelFormat == pixelFormat ) - { - _pixelFormatInfo = v3_pixel_formathash[i].pixelFormatInfo; - _format = _pixelFormatInfo->ccPixelFormat; - _hasAlpha = _pixelFormatInfo->alpha; - infoValid = true; - break; - } - } - - // unsupported / bad pixel format - if (! infoValid) - { - CCLOG("cocos2d: WARNING: unsupported pvr pixelformat: %lx", (unsigned long)pixelFormat ); - return false; - } - - // flags - uint32_t flags = CC_SWAP_INT32_LITTLE_TO_HOST(header->flags); - - // PVRv3 specifies premultiply alpha in a flag -- should always respect this in PVRv3 files - _forcePremultipliedAlpha = true; - if (flags & kPVR3TextureFlagPremultipliedAlpha) - { - _hasPremultipliedAlpha = true; - } - - // sizing - uint32_t width = CC_SWAP_INT32_LITTLE_TO_HOST(header->width); - uint32_t height = CC_SWAP_INT32_LITTLE_TO_HOST(header->height); - _width = width; - _height = height; - uint32_t dataOffset = 0, dataSize = 0; - uint32_t blockSize = 0, widthBlocks = 0, heightBlocks = 0; - uint8_t *bytes = NULL; - - dataOffset = (sizeof(ccPVRv3TexHeader) + header->metadataLength); - bytes = dataPointer; - - _numberOfMipmaps = header->numberOfMipmaps; - CCASSERT(_numberOfMipmaps < CC_PVRMIPMAP_MAX, "TexturePVR: Maximum number of mimpaps reached. Increate the CC_PVRMIPMAP_MAX value"); - - for (unsigned int i = 0; i < _numberOfMipmaps; i++) - { - switch (pixelFormat) - { - case kPVR3TexturePixelFormat_PVRTC_2BPP_RGB : - case kPVR3TexturePixelFormat_PVRTC_2BPP_RGBA : - blockSize = 8 * 4; // Pixel by pixel block size for 2bpp - widthBlocks = width / 8; - heightBlocks = height / 4; - break; - case kPVR3TexturePixelFormat_PVRTC_4BPP_RGB : - case kPVR3TexturePixelFormat_PVRTC_4BPP_RGBA : - blockSize = 4 * 4; // Pixel by pixel block size for 4bpp - widthBlocks = width / 4; - heightBlocks = height / 4; - break; - case kPVR3TexturePixelFormat_BGRA_8888: - if( ! Configuration::getInstance()->supportsBGRA8888()) - { - CCLOG("cocos2d: TexturePVR. BGRA8888 not supported on this device"); - return false; - } - default: - blockSize = 1; - widthBlocks = width; - heightBlocks = height; - break; - } - - // Clamp to minimum number of blocks - if (widthBlocks < 2) - { - widthBlocks = 2; - } - if (heightBlocks < 2) - { - heightBlocks = 2; - } - - dataSize = widthBlocks * heightBlocks * ((blockSize * _pixelFormatInfo->bpp) / 8); - unsigned int packetLength = ((unsigned int)dataLength-dataOffset); - packetLength = packetLength > dataSize ? dataSize : packetLength; - - _asMipmaps[i].address = bytes+dataOffset; - _asMipmaps[i].len = packetLength; - - dataOffset += packetLength; - CCASSERT(dataOffset <= dataLength, "CCTexurePVR: Invalid lenght"); - - - width = MAX(width >> 1, 1); - height = MAX(height >> 1, 1); - } - - return true; -} - -bool TexturePVR::createGLTexture() -{ - unsigned int width = _width; - unsigned int height = _height; - GLenum err; - - if (_numberOfMipmaps > 0) - { - if (_name != 0) - { - GL::deleteTexture(_name); - } - - // From PVR sources: "PVR files are never row aligned." - glPixelStorei(GL_UNPACK_ALIGNMENT,1); - - glGenTextures(1, &_name); - GL::bindTexture2D(_name); - - // Default: Anti alias. - if (_numberOfMipmaps == 1) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } - else - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); - } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - } - - CHECK_GL_ERROR_DEBUG(); // clean possible GL error - - GLenum internalFormat = _pixelFormatInfo->internalFormat; - GLenum format = _pixelFormatInfo->format; - GLenum type = _pixelFormatInfo->type; - bool compressed = _pixelFormatInfo->compressed; - - // Generate textures with mipmaps - for (unsigned int i = 0; i < _numberOfMipmaps; ++i) - { - if (compressed && ! Configuration::getInstance()->supportsPVRTC()) - { - CCLOG("cocos2d: WARNING: PVRTC images are not supported"); - return false; - } - - unsigned char *data = _asMipmaps[i].address; - GLsizei datalen = _asMipmaps[i].len; - - if (compressed) - { - glCompressedTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, datalen, data); - } - else - { - glTexImage2D(GL_TEXTURE_2D, i, internalFormat, width, height, 0, format, type, data); - } - - if (i > 0 && (width != height || ccNextPOT(width) != width )) - { - CCLOG("cocos2d: TexturePVR. WARNING. Mipmap level %u is not squared. Texture won't render correctly. width=%u != height=%u", i, width, height); - } - - err = glGetError(); - if (err != GL_NO_ERROR) - { - CCLOG("cocos2d: TexturePVR: Error uploading compressed texture level: %u . glError: 0x%04X", i, err); - return false; - } - - width = MAX(width >> 1, 1); - height = MAX(height >> 1, 1); - } - - return true; -} - - -bool TexturePVR::initWithContentsOfFile(const char* path) -{ - unsigned char* pvrdata = NULL; - int pvrlen = 0; - - std::string lowerCase(path); - for (unsigned int i = 0; i < lowerCase.length(); ++i) - { - lowerCase[i] = tolower(lowerCase[i]); - } - - if (lowerCase.find(".ccz") != std::string::npos) - { - pvrlen = ZipUtils::ccInflateCCZFile(path, &pvrdata); - } - else if (lowerCase.find(".gz") != std::string::npos) - { - pvrlen = ZipUtils::ccInflateGZipFile(path, &pvrdata); - } - else - { - pvrdata = FileUtils::getInstance()->getFileData(path, "rb", (unsigned long *)(&pvrlen)); - } - - if (pvrlen < 0) - { - this->release(); - return false; - } - - _numberOfMipmaps = 0; - - _name = 0; - _width = _height = 0; - _pixelFormatInfo = NULL; - _hasAlpha = false; - _forcePremultipliedAlpha = false; - _hasPremultipliedAlpha = false; - - _retainName = false; // cocos2d integration - - if (! ((unpackPVRv2Data(pvrdata, pvrlen) || unpackPVRv3Data(pvrdata, pvrlen)) && createGLTexture()) ) - { - CC_SAFE_DELETE_ARRAY(pvrdata); - this->release(); - return false; - } - - CC_SAFE_DELETE_ARRAY(pvrdata); - - return true; -} - -TexturePVR * TexturePVR::create(const char* path) -{ - TexturePVR * texture = new TexturePVR(); - if (texture) - { - if (texture->initWithContentsOfFile(path)) - { - texture->autorelease(); - } - else - { - delete texture; - texture = NULL; - } - } - - return texture; -} - -NS_CC_END - diff --git a/cocos2dx/textures/CCTexturePVR.h b/cocos2dx/textures/CCTexturePVR.h deleted file mode 100644 index 36a4add479..0000000000 --- a/cocos2dx/textures/CCTexturePVR.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -Copyright (c) 2011 Jirka Fajfr for cocos2d-x -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. -****************************************************************************/ - -#ifndef __CCPVRTEXTURE_H__ -#define __CCPVRTEXTURE_H__ - -#include "CCStdC.h" -#include "CCGL.h" -#include "cocoa/CCObject.h" -#include "cocoa/CCArray.h" - -NS_CC_BEGIN - -/** - * @addtogroup textures - * @{ - */ - -/** - @brief Structure which can tell where mipmap begins and how long is it -*/ -struct CCPVRMipmap { - unsigned char *address; - unsigned int len; -}; - -typedef struct _ccPVRTexturePixelFormatInfo { - GLenum internalFormat; - GLenum format; - GLenum type; - uint32_t bpp; - bool compressed; - bool alpha; - Texture2D::PixelFormat ccPixelFormat; -} ccPVRTexturePixelFormatInfo; - -/** - @brief Determine how many mipmaps can we have. - Its same as define but it respects namespaces -*/ -enum { - CC_PVRMIPMAP_MAX = 16, -}; - - -/** TexturePVR - - Object that loads PVR images. - - Supported PVR formats: - - RGBA8888 - - BGRA8888 - - RGBA4444 - - RGBA5551 - - RGB565 - - A8 - - I8 - - AI88 - - PVRTC 4BPP - - PVRTC 2BPP - - Limitations: - Pre-generated mipmaps, such as PVR textures with mipmap levels embedded in file, - are only supported if all individual sprites are of _square_ size. - To use mipmaps with non-square textures, instead call Texture2D#generateMipmap on the sheet texture itself - (and to save space, save the PVR sprite sheet without mip maps included). -*/ -class TexturePVR : public Object -{ -public: - /** creates and initializes a TexturePVR with a path */ - static TexturePVR* create(const char* path); - - TexturePVR(); - virtual ~TexturePVR(); - - /** initializes a TexturePVR with a path */ - bool initWithContentsOfFile(const char* path); - - // properties - - /** texture id name */ - inline unsigned int getName() const { return _name; } - /** texture width */ - inline unsigned int getWidth() const { return _width; } - /** texture height */ - inline unsigned int getHeight() const { return _height; } - /** whether or not the texture has alpha */ - inline bool hasAlpha() const { return _hasAlpha; } - /** whether or not the texture has premultiplied alpha */ - inline bool hasPremultipliedAlpha() const { return _hasPremultipliedAlpha; } - /** whether or not the texture should use hasPremultipliedAlpha instead of global default */ - inline bool isForcePremultipliedAlpha() const { return _forcePremultipliedAlpha; } - /** how many mipmaps the texture has. 1 means one level (level 0 */ - inline unsigned int getNumberOfMipmaps() const { return _numberOfMipmaps; } - inline Texture2D::PixelFormat getFormat() const { return _format; } - inline bool isRetainName() const { return _retainName; } - inline void setRetainName(bool retainName) { _retainName = retainName; } - -private: - bool unpackPVRv2Data(unsigned char* data, unsigned int len); - bool unpackPVRv3Data(unsigned char* dataPointer, unsigned int dataLength); - bool createGLTexture(); - -protected: - struct CCPVRMipmap _asMipmaps[CC_PVRMIPMAP_MAX]; // pointer to mipmap images - unsigned int _numberOfMipmaps; // number of mipmap used - - unsigned int _width, _height; - GLuint _name; - bool _hasAlpha; - bool _hasPremultipliedAlpha; - bool _forcePremultipliedAlpha; - - // cocos2d integration - bool _retainName; - Texture2D::PixelFormat _format; - - const ccPVRTexturePixelFormatInfo *_pixelFormatInfo; -}; - -// end of textures group -/// @} - -NS_CC_END - - -#endif //__CCPVRTEXTURE_H__ \ No newline at end of file diff --git a/extensions/Android.mk b/extensions/Android.mk index 04b7079066..e62a64a1b8 100644 --- a/extensions/Android.mk +++ b/extensions/Android.mk @@ -5,105 +5,10 @@ LOCAL_MODULE := cocos_extension_static LOCAL_MODULE_FILENAME := libextension -LOCAL_SRC_FILES := AssetsManager/AssetsManager.cpp \ -CCArmature/CCArmature.cpp \ -CCArmature/CCBone.cpp \ -CCArmature/animation/CCArmatureAnimation.cpp \ -CCArmature/animation/CCProcessBase.cpp \ -CCArmature/animation/CCTween.cpp \ -CCArmature/datas/CCDatas.cpp \ -CCArmature/display/CCBatchNode.cpp \ -CCArmature/display/CCDecorativeDisplay.cpp \ -CCArmature/display/CCDisplayFactory.cpp \ -CCArmature/display/CCDisplayManager.cpp \ -CCArmature/display/CCShaderNode.cpp \ -CCArmature/display/CCSkin.cpp \ -CCArmature/external_tool/GLES-Render.cpp \ -CCArmature/external_tool/Json/CSContentJsonDictionary.cpp \ -CCArmature/external_tool/Json/lib_json/json_value.cpp \ -CCArmature/external_tool/Json/lib_json/json_reader.cpp \ -CCArmature/external_tool/Json/lib_json/json_writer.cpp \ -CCArmature/physics/CCColliderDetector.cpp \ -CCArmature/physics/CCPhysicsWorld.cpp \ -CCArmature/utils/CCArmatureDataManager.cpp \ -CCArmature/utils/CCDataReaderHelper.cpp \ -CCArmature/utils/CCSpriteFrameCacheHelper.cpp \ -CCArmature/utils/CCTransformHelp.cpp \ -CCArmature/utils/CCTweenFunction.cpp \ -CCArmature/utils/CCUtilMath.cpp \ -CCBReader/CCBFileLoader.cpp \ -CCBReader/CCBReader.cpp \ -CCBReader/CCControlButtonLoader.cpp \ -CCBReader/CCControlLoader.cpp \ -CCBReader/CCLabelBMFontLoader.cpp \ -CCBReader/CCLabelTTFLoader.cpp \ -CCBReader/CCLayerColorLoader.cpp \ -CCBReader/CCLayerGradientLoader.cpp \ -CCBReader/CCLayerLoader.cpp \ -CCBReader/CCMenuItemImageLoader.cpp \ -CCBReader/CCMenuItemLoader.cpp \ -CCBReader/CCNodeLoader.cpp \ -CCBReader/CCNodeLoaderLibrary.cpp \ -CCBReader/CCParticleSystemQuadLoader.cpp \ -CCBReader/CCScale9SpriteLoader.cpp \ -CCBReader/CCScrollViewLoader.cpp \ -CCBReader/CCSpriteLoader.cpp \ -CCBReader/CCBAnimationManager.cpp \ -CCBReader/CCBKeyframe.cpp \ -CCBReader/CCBSequence.cpp \ -CCBReader/CCBSequenceProperty.cpp \ -CCBReader/CCBValue.cpp \ -CCBReader/CCNode+CCBRelativePositioning.cpp \ -Components/CCComAttribute.cpp \ -Components/CCComAudio.cpp \ -Components/CCComController.cpp \ -Components/CCInputDelegate.cpp \ -GUI/CCControlExtension/CCControl.cpp \ -GUI/CCControlExtension/CCControlButton.cpp \ -GUI/CCControlExtension/CCControlColourPicker.cpp \ -GUI/CCControlExtension/CCControlHuePicker.cpp \ -GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp \ -GUI/CCControlExtension/CCControlSlider.cpp \ -GUI/CCControlExtension/CCControlSwitch.cpp \ -GUI/CCControlExtension/CCControlUtils.cpp \ -GUI/CCControlExtension/CCInvocation.cpp \ -GUI/CCControlExtension/CCScale9Sprite.cpp \ -GUI/CCControlExtension/CCControlPotentiometer.cpp \ -GUI/CCControlExtension/CCControlStepper.cpp \ -GUI/CCScrollView/CCScrollView.cpp \ -GUI/CCScrollView/CCTableView.cpp \ -GUI/CCScrollView/CCTableViewCell.cpp \ -GUI/CCScrollView/CCSorting.cpp \ -GUI/CCEditBox/CCEditBox.cpp \ -GUI/CCEditBox/CCEditBoxImplAndroid.cpp \ -network/HttpClient.cpp \ -network/WebSocket.cpp \ -network/SocketIO.cpp \ -physics_nodes/CCPhysicsDebugNode.cpp \ -physics_nodes/CCPhysicsSprite.cpp \ -LocalStorage/LocalStorageAndroid.cpp \ -spine/Animation.cpp \ -spine/AnimationState.cpp \ -spine/AnimationStateData.cpp \ -spine/Atlas.cpp \ -spine/AtlasAttachmentLoader.cpp \ -spine/Attachment.cpp \ -spine/AttachmentLoader.cpp \ -spine/Bone.cpp \ -spine/BoneData.cpp \ -spine/Json.cpp \ -spine/RegionAttachment.cpp \ -spine/Skeleton.cpp \ -spine/SkeletonData.cpp \ -spine/SkeletonJson.cpp \ -spine/Skin.cpp \ -spine/Slot.cpp \ -spine/SlotData.cpp \ -spine/extension.cpp \ -spine/CCSkeletonAnimation.cpp \ -spine/CCSkeleton.cpp \ -spine/spine-cocos2dx.cpp \ -CCDeprecated-ext.cpp +dirs := $(shell find $(LOCAL_PATH) -type d -print) +find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp)) + +LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files)) LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static diff --git a/external/Box2D/Android.mk b/external/Box2D/Android.mk index e289b24bee..21115fbd6a 100644 --- a/external/Box2D/Android.mk +++ b/external/Box2D/Android.mk @@ -6,52 +6,10 @@ LOCAL_MODULE := box2d_static LOCAL_MODULE_FILENAME := libbox2d -LOCAL_SRC_FILES := \ -Collision/Shapes/b2ChainShape.cpp \ -Collision/Shapes/b2CircleShape.cpp \ -Collision/Shapes/b2EdgeShape.cpp \ -Collision/Shapes/b2PolygonShape.cpp \ -Collision/b2BroadPhase.cpp \ -Collision/b2CollideCircle.cpp \ -Collision/b2CollideEdge.cpp \ -Collision/b2CollidePolygon.cpp \ -Collision/b2Collision.cpp \ -Collision/b2Distance.cpp \ -Collision/b2DynamicTree.cpp \ -Collision/b2TimeOfImpact.cpp \ -Common/b2BlockAllocator.cpp \ -Common/b2Draw.cpp \ -Common/b2Math.cpp \ -Common/b2Settings.cpp \ -Common/b2StackAllocator.cpp \ -Common/b2Timer.cpp \ -Dynamics/Contacts/b2ChainAndCircleContact.cpp \ -Dynamics/Contacts/b2ChainAndPolygonContact.cpp \ -Dynamics/Contacts/b2CircleContact.cpp \ -Dynamics/Contacts/b2Contact.cpp \ -Dynamics/Contacts/b2ContactSolver.cpp \ -Dynamics/Contacts/b2EdgeAndCircleContact.cpp \ -Dynamics/Contacts/b2EdgeAndPolygonContact.cpp \ -Dynamics/Contacts/b2PolygonAndCircleContact.cpp \ -Dynamics/Contacts/b2PolygonContact.cpp \ -Dynamics/Joints/b2DistanceJoint.cpp \ -Dynamics/Joints/b2FrictionJoint.cpp \ -Dynamics/Joints/b2GearJoint.cpp \ -Dynamics/Joints/b2Joint.cpp \ -Dynamics/Joints/b2MouseJoint.cpp \ -Dynamics/Joints/b2PrismaticJoint.cpp \ -Dynamics/Joints/b2PulleyJoint.cpp \ -Dynamics/Joints/b2RevoluteJoint.cpp \ -Dynamics/Joints/b2RopeJoint.cpp \ -Dynamics/Joints/b2WeldJoint.cpp \ -Dynamics/Joints/b2WheelJoint.cpp \ -Dynamics/b2Body.cpp \ -Dynamics/b2ContactManager.cpp \ -Dynamics/b2Fixture.cpp \ -Dynamics/b2Island.cpp \ -Dynamics/b2World.cpp \ -Dynamics/b2WorldCallbacks.cpp \ -Rope/b2Rope.cpp +dirs := $(shell find $(LOCAL_PATH) -type d -print) +find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp)) + +LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. diff --git a/external/chipmunk/Android.mk b/external/chipmunk/Android.mk index bf22594183..8c90fe8f06 100644 --- a/external/chipmunk/Android.mk +++ b/external/chipmunk/Android.mk @@ -6,36 +6,10 @@ LOCAL_MODULE := chipmunk_static LOCAL_MODULE_FILENAME := libchipmunk -LOCAL_SRC_FILES := \ -src/chipmunk.c \ -src/constraints/cpConstraint.c \ -src/constraints/cpDampedRotarySpring.c \ -src/constraints/cpDampedSpring.c \ -src/constraints/cpGearJoint.c \ -src/constraints/cpGrooveJoint.c \ -src/constraints/cpPinJoint.c \ -src/constraints/cpPivotJoint.c \ -src/constraints/cpRatchetJoint.c \ -src/constraints/cpRotaryLimitJoint.c \ -src/constraints/cpSimpleMotor.c \ -src/constraints/cpSlideJoint.c \ -src/cpArbiter.c \ -src/cpArray.c \ -src/cpBB.c \ -src/cpBBTree.c \ -src/cpBody.c \ -src/cpCollision.c \ -src/cpHashSet.c \ -src/cpPolyShape.c \ -src/cpShape.c \ -src/cpSpace.c \ -src/cpSpaceComponent.c \ -src/cpSpaceHash.c \ -src/cpSpaceQuery.c \ -src/cpSpaceStep.c \ -src/cpSpatialIndex.c \ -src/cpSweep1D.c \ -src/cpVect.c +dirs := $(shell find $(LOCAL_PATH) -type d -print) +find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.c)) + +LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk diff --git a/samples/Cpp/TestCpp/Android.mk b/samples/Cpp/TestCpp/Android.mk index c8550b0a56..8499975653 100644 --- a/samples/Cpp/TestCpp/Android.mk +++ b/samples/Cpp/TestCpp/Android.mk @@ -6,111 +6,10 @@ LOCAL_MODULE := cocos_testcpp_common LOCAL_MODULE_FILENAME := libtestcppcommon -LOCAL_SRC_FILES := \ -Classes/AccelerometerTest/AccelerometerTest.cpp \ -Classes/ActionManagerTest/ActionManagerTest.cpp \ -Classes/ActionsTest/ActionsTest.cpp \ -Classes/ActionsEaseTest/ActionsEaseTest.cpp \ -Classes/ActionsProgressTest/ActionsProgressTest.cpp \ -Classes/Box2DTest/Box2dTest.cpp \ -Classes/Box2DTestBed/Box2dView.cpp \ -Classes/Box2DTestBed/GLES-Render.cpp \ -Classes/Box2DTestBed/Test.cpp \ -Classes/Box2DTestBed/TestEntries.cpp \ -Classes/BugsTest/Bug-1159.cpp \ -Classes/BugsTest/Bug-1174.cpp \ -Classes/BugsTest/Bug-350.cpp \ -Classes/BugsTest/Bug-422.cpp \ -Classes/BugsTest/Bug-624.cpp \ -Classes/BugsTest/Bug-886.cpp \ -Classes/BugsTest/Bug-899.cpp \ -Classes/BugsTest/Bug-914.cpp \ -Classes/BugsTest/BugsTest.cpp \ -Classes/BugsTest/Bug-458/Bug-458.cpp \ -Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp \ -Classes/ChipmunkTest/ChipmunkTest.cpp \ -Classes/ClickAndMoveTest/ClickAndMoveTest.cpp \ -Classes/ClippingNodeTest/ClippingNodeTest.cpp \ -Classes/CocosDenshionTest/CocosDenshionTest.cpp \ -Classes/CurlTest/CurlTest.cpp \ -Classes/CurrentLanguageTest/CurrentLanguageTest.cpp \ -Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp \ -Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp \ -Classes/EffectsTest/EffectsTest.cpp \ -Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp \ -Classes/ExtensionsTest/ExtensionsTest.cpp \ -Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlSceneManager.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlColourPicker/CCControlColourPickerTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlPotentiometerTest/CCControlPotentiometerTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlSliderTest/CCControlSliderTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlStepperTest/CCControlStepperTest.cpp \ -Classes/ExtensionsTest/ControlExtensionTest/CCControlSwitchTest/CCControlSwitchTest.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.cpp \ -Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp \ -Classes/ExtensionsTest/ComponentsTest/ComponentsTestScene.cpp \ -Classes/ExtensionsTest/ComponentsTest/EnemyController.cpp \ -Classes/ExtensionsTest/ComponentsTest/GameOverScene.cpp \ -Classes/ExtensionsTest/ComponentsTest/PlayerController.cpp \ -Classes/ExtensionsTest/ComponentsTest/ProjectileController.cpp \ -Classes/ExtensionsTest/ComponentsTest/SceneController.cpp \ -Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \ -Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp \ -Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp \ -Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp \ -Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp \ -Classes/ExtensionsTest/TableViewTest/CustomTableViewCell.cpp \ -Classes/ExtensionsTest/Scale9SpriteTest/Scale9SpriteTest.cpp \ -Classes/FontTest/FontTest.cpp \ -Classes/IntervalTest/IntervalTest.cpp \ -Classes/KeypadTest/KeypadTest.cpp \ -Classes/LabelTest/LabelTest.cpp \ -Classes/LayerTest/LayerTest.cpp \ -Classes/NodeTest/NodeTest.cpp \ -Classes/TextInputTest/TextInputTest.cpp \ -Classes/MenuTest/MenuTest.cpp \ -Classes/MotionStreakTest/MotionStreakTest.cpp \ -Classes/MutiTouchTest/MutiTouchTest.cpp \ -Classes/ParallaxTest/ParallaxTest.cpp \ -Classes/ParticleTest/ParticleTest.cpp \ -Classes/PerformanceTest/PerformanceNodeChildrenTest.cpp \ -Classes/PerformanceTest/PerformanceParticleTest.cpp \ -Classes/PerformanceTest/PerformanceSpriteTest.cpp \ -Classes/PerformanceTest/PerformanceTest.cpp \ -Classes/PerformanceTest/PerformanceTextureTest.cpp \ -Classes/PerformanceTest/PerformanceTouchesTest.cpp \ -Classes/RenderTextureTest/RenderTextureTest.cpp \ -Classes/RotateWorldTest/RotateWorldTest.cpp \ -Classes/SceneTest/SceneTest.cpp \ -Classes/SchedulerTest/SchedulerTest.cpp \ -Classes/ShaderTest/ShaderTest.cpp \ -Classes/SpineTest/SpineTest.cpp \ -Classes/SpriteTest/SpriteTest.cpp \ -Classes/TextureCacheTest/TextureCacheTest.cpp \ -Classes/Texture2dTest/Texture2dTest.cpp \ -Classes/TexturePackerEncryptionTest/TextureAtlasEncryptionTest.cpp \ -Classes/TileMapTest/TileMapTest.cpp \ -Classes/TouchesTest/Ball.cpp \ -Classes/TouchesTest/Paddle.cpp \ -Classes/TouchesTest/TouchesTest.cpp \ -Classes/TransitionsTest/TransitionsTest.cpp \ -Classes/UserDefaultTest/UserDefaultTest.cpp \ -Classes/ZwoptexTest/ZwoptexTest.cpp \ -Classes/FileUtilsTest/FileUtilsTest.cpp \ -Classes/DataVisitorTest/DataVisitorTest.cpp \ -Classes/ConfigurationTest/ConfigurationTest.cpp \ -Classes/controller.cpp \ -Classes/testBasic.cpp \ -Classes/AppDelegate.cpp \ -Classes/BaseTest.cpp \ -Classes/VisibleRect.cpp +dirs := $(shell find $(LOCAL_PATH)/classes -type d -print) +find_files = $(subst $(LOCAL_PATH)/,,$(wildcard $(dir)/*.cpp)) + +LOCAL_SRC_FILES := $(foreach dir, $(dirs), $(find_files)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/Classes