From 51801d9218ee834616ff5f08b6a873ab8e25e78a Mon Sep 17 00:00:00 2001 From: boyu0 Date: Wed, 23 Oct 2013 10:11:08 +0800 Subject: [PATCH] issue #2771: fix some compile error in android and win32 --- cocos/physics/CCPhysicsJoint.cpp | 18 ++++++------ cocos/physics/CCPhysicsWorld.cpp | 5 ++++ cocos/physics/CCPhysicsWorld.h | 1 + cocos/physics/chipmunk/CCPhysicsJointInfo.cpp | 3 ++ .../Classes/PhysicsTest/PhysicsTest.cpp | 29 +++++++++++++++++++ .../TestCpp/Classes/PhysicsTest/PhysicsTest.h | 9 +++++- 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/cocos/physics/CCPhysicsJoint.cpp b/cocos/physics/CCPhysicsJoint.cpp index 18f63b7101..09b1de36dd 100644 --- a/cocos/physics/CCPhysicsJoint.cpp +++ b/cocos/physics/CCPhysicsJoint.cpp @@ -103,15 +103,15 @@ void PhysicsJoint::setEnable(bool enable) } } -//PhysicsJointPin::PhysicsJointPin() -//{ -// -//} -// -//PhysicsJointPin::~PhysicsJointPin() -//{ -// -//} +PhysicsJointPin::PhysicsJointPin() +{ + +} + +PhysicsJointPin::~PhysicsJointPin() +{ + +} PhysicsJointFixed::PhysicsJointFixed() { diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index cab183ba7a..ec7514ef6d 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -561,6 +561,11 @@ void PhysicsWorld::rectQuery(PhysicsRectQueryCallback& callback, Rect rect, void } } +Array* getShapesAtPoint(Point point) +{ + +} + Array* PhysicsWorld::getAllBody() const { return _bodys; diff --git a/cocos/physics/CCPhysicsWorld.h b/cocos/physics/CCPhysicsWorld.h index e61cde2763..868889b539 100644 --- a/cocos/physics/CCPhysicsWorld.h +++ b/cocos/physics/CCPhysicsWorld.h @@ -97,6 +97,7 @@ public: void rayCast(PhysicsRayCastCallback& callback, Point point1, Point point2, void* data); void rectQuery(PhysicsRectQueryCallback& callback, Rect rect, void* data); + Array* getShapesAtPoint(Point point); Array* getAllBody() const; /** Register a listener to receive contact callbacks*/ diff --git a/cocos/physics/chipmunk/CCPhysicsJointInfo.cpp b/cocos/physics/chipmunk/CCPhysicsJointInfo.cpp index 7a44587ba5..b3fc376710 100644 --- a/cocos/physics/chipmunk/CCPhysicsJointInfo.cpp +++ b/cocos/physics/chipmunk/CCPhysicsJointInfo.cpp @@ -24,8 +24,11 @@ #include "CCPhysicsJointInfo.h" #if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK) +#include NS_CC_BEGIN +std::map PhysicsJointInfo::map; + PhysicsJointInfo::PhysicsJointInfo(PhysicsJoint* joint) : joint(joint) { diff --git a/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.cpp b/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.cpp index 0c67ddc204..240d3ee2e8 100644 --- a/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.cpp @@ -673,4 +673,33 @@ void PhysicsDemoRayCast::onTouchesEnded(const std::vector& touches, Even std::string PhysicsDemoRayCast::title() { return "Ray Cast"; +} + + +void PhysicsDemoJoints::onEnter() +{ + PhysicsDemo::onEnter(); + + setTouchEnabled(true); + + _scene->getPhysicsWorld()->setGravity(Point::ZERO); + + +} + +void PhysicsDemoJoints::onTouchesEnded(const std::vector& touches, Event* event) +{ + //Add a new body/atlas sprite at the touched location + + for( auto &touch: touches) + { + auto location = touch->getLocation(); + + + } +} + +std::string PhysicsDemoJoints::title() +{ + return "Joints"; } \ No newline at end of file diff --git a/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.h b/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.h index 65c1c6bad9..9df12624de 100644 --- a/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.h +++ b/samples/Cpp/TestCpp/Classes/PhysicsTest/PhysicsTest.h @@ -85,7 +85,6 @@ public: void onEnter() override; std::string title() override; void update(float delta) override; - void onTouchesEnded(const std::vector& touches, Event* event) override; void changeModeCallback(Object* sender); @@ -98,4 +97,12 @@ private: int _mode; }; +class PhysicsDemoJoints : public PhysicsDemo +{ +public: + void onEnter() override; + std::string title() override; + void onTouchesEnded(const std::vector& touches, Event* event) override; +}; + #endif