From 8346fe4b4db247486d657d8dd03979257d94ce13 Mon Sep 17 00:00:00 2001 From: boyu0 Date: Tue, 26 Nov 2013 18:22:52 +0800 Subject: [PATCH] issue #2771: edit android.mk, CMakeLists.txt, change PHYSICS_CONTACT_POINT_MAX to PhysicsContactData:POINT_MAX --- cocos/2d/Android.mk | 9 ++------- cocos/2d/ccConfig.h | 4 ---- cocos/physics/CCPhysicsContact.cpp | 2 +- cocos/physics/CCPhysicsContact.h | 3 ++- cocos/physics/CMakeLists.txt | 5 ----- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/cocos/2d/Android.mk b/cocos/2d/Android.mk index 6d36b83b55..854d56829d 100644 --- a/cocos/2d/Android.mk +++ b/cocos/2d/Android.mk @@ -39,13 +39,13 @@ CCEventAcceleration.cpp \ CCEventCustom.cpp \ CCEventDispatcher.cpp \ CCEventKeyboard.cpp \ -CCEventMouse.cpp \ -CCEventListenerMouse.cpp \ CCEventListener.cpp \ CCEventListenerAcceleration.cpp \ CCEventListenerCustom.cpp \ CCEventListenerKeyboard.cpp \ +CCEventListenerMouse.cpp \ CCEventListenerTouch.cpp \ +CCEventMouse.cpp \ CCEventTouch.cpp \ CCFont.cpp \ CCFontAtlas.cpp \ @@ -149,11 +149,6 @@ platform/CCThread.cpp \ ../physics/CCPhysicsJoint.cpp \ ../physics/CCPhysicsShape.cpp \ ../physics/CCPhysicsWorld.cpp \ -../physics/box2d/CCPhysicsBodyInfo_box2d.cpp \ -../physics/box2d/CCPhysicsContactInfo_box2d.cpp \ -../physics/box2d/CCPhysicsJointInfo_box2d.cpp \ -../physics/box2d/CCPhysicsShapeInfo_box2d.cpp \ -../physics/box2d/CCPhysicsWorldInfo_box2d.cpp \ ../physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp \ ../physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp \ ../physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp \ diff --git a/cocos/2d/ccConfig.h b/cocos/2d/ccConfig.h index b8729d0d28..f801066bfe 100644 --- a/cocos/2d/ccConfig.h +++ b/cocos/2d/ccConfig.h @@ -266,8 +266,4 @@ To enable set it to a value different than 0. Disabled by default. #define CC_LUA_ENGINE_DEBUG 0 #endif -#ifdef CC_USE_PHYSICS -#define PHYSICS_CONTACT_POINT_MAX 4 -#endif - #endif // __CCCONFIG_H__ diff --git a/cocos/physics/CCPhysicsContact.cpp b/cocos/physics/CCPhysicsContact.cpp index e0233df958..649d0756f4 100644 --- a/cocos/physics/CCPhysicsContact.cpp +++ b/cocos/physics/CCPhysicsContact.cpp @@ -98,7 +98,7 @@ void PhysicsContact::generateContactData() cpArbiter* arb = static_cast(_contactInfo); _contactData = new PhysicsContactData(); _contactData->count = cpArbiterGetCount(arb); - for (int i=0; i<_contactData->count; ++i) + for (int i=0; i<_contactData->count && ipoints[i] = PhysicsHelper::cpv2point(cpArbiterGetPoint(arb, i)); } diff --git a/cocos/physics/CCPhysicsContact.h b/cocos/physics/CCPhysicsContact.h index d9655754f0..24eb0f4c69 100644 --- a/cocos/physics/CCPhysicsContact.h +++ b/cocos/physics/CCPhysicsContact.h @@ -44,7 +44,8 @@ typedef Point Vect; typedef struct PhysicsContactData { - Point points[PHYSICS_CONTACT_POINT_MAX]; + static const long POINT_MAX = 4; + Point points[POINT_MAX]; int count; Point normal; diff --git a/cocos/physics/CMakeLists.txt b/cocos/physics/CMakeLists.txt index 1586db2379..ef81f5ec6b 100644 --- a/cocos/physics/CMakeLists.txt +++ b/cocos/physics/CMakeLists.txt @@ -1,9 +1,4 @@ set(COCOS_PHYSICS_SRC - ${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsContactInfo_box2d.cpp - ${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsJointInfo_box2d.cpp - ${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsShapeInfo_box2d.cpp - ${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsBodyInfo_box2d.cpp - ${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsWorldInfo_box2d.cpp ${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp ${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp ${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp