From a454e373c79f9e18030f1d2e20f934ec96ef42fa Mon Sep 17 00:00:00 2001 From: boyu0 Date: Tue, 17 Sep 2013 17:39:08 +0800 Subject: [PATCH] issue #2771: move include chipmunk and box2d to cpp --- cocos2dx/physics/CCPhysicsBody.cpp | 6 ++++++ cocos2dx/physics/CCPhysicsContact.cpp | 7 +++++++ cocos2dx/physics/CCPhysicsJoint.cpp | 7 +++++++ cocos2dx/physics/CCPhysicsSetting.h | 6 ------ cocos2dx/physics/CCPhysicsShape.cpp | 6 ++++++ cocos2dx/physics/CCPhysicsWorld.cpp | 6 ++++++ cocos2dx/physics/CCPhysicsWorld.h | 6 ++++++ cocos2dx/physics/chipmunk/CCPhysicsBodyInfo.h | 1 + cocos2dx/physics/chipmunk/CCPhysicsContactInfo.h | 1 + cocos2dx/physics/chipmunk/CCPhysicsHelper.h | 1 + cocos2dx/physics/chipmunk/CCPhysicsJointInfo.h | 3 +-- cocos2dx/physics/chipmunk/CCPhysicsShapeInfo.h | 5 +++-- cocos2dx/physics/chipmunk/CCPhysicsWorldInfo.h | 1 + tools/tojs/cocos2dx.ini | 2 +- tools/tojs/cocos2dx_extension.ini | 2 +- 15 files changed, 48 insertions(+), 12 deletions(-) diff --git a/cocos2dx/physics/CCPhysicsBody.cpp b/cocos2dx/physics/CCPhysicsBody.cpp index 655a57eb89..3fb5d485b1 100644 --- a/cocos2dx/physics/CCPhysicsBody.cpp +++ b/cocos2dx/physics/CCPhysicsBody.cpp @@ -26,6 +26,12 @@ #include +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include "chipmunk.h" +#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D) +#include "Box2D.h" +#endif + #include "CCPhysicsShape.h" #include "CCPhysicsJoint.h" #include "CCPhysicsWorld.h" diff --git a/cocos2dx/physics/CCPhysicsContact.cpp b/cocos2dx/physics/CCPhysicsContact.cpp index e7c5a8555a..928c8c9e59 100644 --- a/cocos2dx/physics/CCPhysicsContact.cpp +++ b/cocos2dx/physics/CCPhysicsContact.cpp @@ -23,6 +23,13 @@ ****************************************************************************/ #include "CCPhysicsContact.h" #ifdef CC_USE_PHYSICS + +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include "chipmunk.h" +#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D) +#include "Box2D.h" +#endif + #include "chipmunk/CCPhysicsContactInfo.h" #include "Box2D/CCPhysicsContactInfo.h" diff --git a/cocos2dx/physics/CCPhysicsJoint.cpp b/cocos2dx/physics/CCPhysicsJoint.cpp index 6b57ee2351..3e60d246ab 100644 --- a/cocos2dx/physics/CCPhysicsJoint.cpp +++ b/cocos2dx/physics/CCPhysicsJoint.cpp @@ -24,6 +24,13 @@ #include "CCPhysicsJoint.h" #ifdef CC_USE_PHYSICS + +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include "chipmunk.h" +#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D) +#include "Box2D.h" +#endif + #include "CCPhysicsBody.h" #include "chipmunk/CCPhysicsJointInfo.h" diff --git a/cocos2dx/physics/CCPhysicsSetting.h b/cocos2dx/physics/CCPhysicsSetting.h index 3d3aaaaf55..98b39f8f66 100644 --- a/cocos2dx/physics/CCPhysicsSetting.h +++ b/cocos2dx/physics/CCPhysicsSetting.h @@ -43,10 +43,4 @@ #define CC_USE_PHYSICS #endif -#if (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D) -#include "Box2D.h" -#elif (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) -#include "chipmunk.h" -#endif - #endif // __CCPHYSICS_SETTING_H__ diff --git a/cocos2dx/physics/CCPhysicsShape.cpp b/cocos2dx/physics/CCPhysicsShape.cpp index 002c848eff..e98dff0b5c 100644 --- a/cocos2dx/physics/CCPhysicsShape.cpp +++ b/cocos2dx/physics/CCPhysicsShape.cpp @@ -25,6 +25,12 @@ #include "CCPhysicsShape.h" #ifdef CC_USE_PHYSICS +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include "chipmunk.h" +#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D) +#include "Box2D.h" +#endif + #include "CCPhysicsBody.h" #include "chipmunk/CCPhysicsBodyInfo.h" diff --git a/cocos2dx/physics/CCPhysicsWorld.cpp b/cocos2dx/physics/CCPhysicsWorld.cpp index d35260d4cb..08857de24b 100644 --- a/cocos2dx/physics/CCPhysicsWorld.cpp +++ b/cocos2dx/physics/CCPhysicsWorld.cpp @@ -25,6 +25,12 @@ #include "CCPhysicsWorld.h" #ifdef CC_USE_PHYSICS +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include "chipmunk.h" +#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D) +#include "Box2D.h" +#endif + #include "CCPhysicsBody.h" #include "CCPhysicsShape.h" #include "CCPhysicsContact.h" diff --git a/cocos2dx/physics/CCPhysicsWorld.h b/cocos2dx/physics/CCPhysicsWorld.h index 425a831442..bd06fdf661 100644 --- a/cocos2dx/physics/CCPhysicsWorld.h +++ b/cocos2dx/physics/CCPhysicsWorld.h @@ -31,6 +31,12 @@ #include "cocoa/CCObject.h" #include "cocoa/CCGeometry.h" + +#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +typedef struct cpArbiter cpArbiter; +typedef struct cpSpace cpSpace; +#endif + NS_CC_BEGIN class PhysicsBody; diff --git a/cocos2dx/physics/chipmunk/CCPhysicsBodyInfo.h b/cocos2dx/physics/chipmunk/CCPhysicsBodyInfo.h index 796f384584..0faef2eb49 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsBodyInfo.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsBodyInfo.h @@ -27,6 +27,7 @@ #ifndef __CCPHYSICS_BODY_INFO_H__ #define __CCPHYSICS_BODY_INFO_H__ +#include "chipmunk.h" #include "platform/CCPlatformMacros.h" #include "cocoa/CCObject.h" diff --git a/cocos2dx/physics/chipmunk/CCPhysicsContactInfo.h b/cocos2dx/physics/chipmunk/CCPhysicsContactInfo.h index b0d123ae21..5033a2181d 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsContactInfo.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsContactInfo.h @@ -27,6 +27,7 @@ #ifndef __CCPHYSICS_CONTACT_INFO_H__ #define __CCPHYSICS_CONTACT_INFO_H__ +#include "chipmunk.h" #include "platform/CCPlatformMacros.h" NS_CC_BEGIN diff --git a/cocos2dx/physics/chipmunk/CCPhysicsHelper.h b/cocos2dx/physics/chipmunk/CCPhysicsHelper.h index 07508e9b13..a026d632b7 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsHelper.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsHelper.h @@ -28,6 +28,7 @@ #ifndef __CCPHYSICS_HELPER_H__ #define __CCPHYSICS_HELPER_H__ +#include "chipmunk.h" #include "platform/CCPlatformMacros.h" #include "cocoa/CCGeometry.h" diff --git a/cocos2dx/physics/chipmunk/CCPhysicsJointInfo.h b/cocos2dx/physics/chipmunk/CCPhysicsJointInfo.h index 4174c866f6..47b1fc6141 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsJointInfo.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsJointInfo.h @@ -27,9 +27,8 @@ #ifndef __CCPHYSICS_JOINT_INFO_H__ #define __CCPHYSICS_JOINT_INFO_H__ - +#include "chipmunk.h" #include "platform/CCPlatformMacros.h" - NS_CC_BEGIN class PhysicsJointInfo diff --git a/cocos2dx/physics/chipmunk/CCPhysicsShapeInfo.h b/cocos2dx/physics/chipmunk/CCPhysicsShapeInfo.h index 7114bd3961..7e0be63747 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsShapeInfo.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsShapeInfo.h @@ -27,10 +27,11 @@ #ifndef __CCPHYSICS_SHAPE_INFO_H__ #define __CCPHYSICS_SHAPE_INFO_H__ -#include -#include "platform/CCPlatformMacros.h" +#include #include +#include "chipmunk.h" +#include "platform/CCPlatformMacros.h" NS_CC_BEGIN diff --git a/cocos2dx/physics/chipmunk/CCPhysicsWorldInfo.h b/cocos2dx/physics/chipmunk/CCPhysicsWorldInfo.h index a1f1e66342..3bc0cf2bc4 100644 --- a/cocos2dx/physics/chipmunk/CCPhysicsWorldInfo.h +++ b/cocos2dx/physics/chipmunk/CCPhysicsWorldInfo.h @@ -27,6 +27,7 @@ #ifndef __CCPHYSICS_WORLD_INFO_H__ #define __CCPHYSICS_WORLD_INFO_H__ +#include "chipmunk.h" #include "platform/CCPlatformMacros.h" NS_CC_BEGIN diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 82440540cd..87551f1c09 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -13,7 +13,7 @@ android_flags = -D_SIZE_T_DEFINED_ clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include clang_flags = -nostdinc -x c++ -std=c++11 -cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include -I%(cocosdir)s/external/chipmunk/include/chipmunk +cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common diff --git a/tools/tojs/cocos2dx_extension.ini b/tools/tojs/cocos2dx_extension.ini index 9056fafb16..41ecc9e5a6 100644 --- a/tools/tojs/cocos2dx_extension.ini +++ b/tools/tojs/cocos2dx_extension.ini @@ -13,7 +13,7 @@ android_flags = -D_SIZE_T_DEFINED_ clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include clang_flags = -nostdinc -x c++ -std=c++11 -cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include -I%(cocosdir)s/extensions -I%(cocosdir)s/external/chipmunk/include/chipmunk +cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include -I%(cocosdir)s/extensions cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common