Quellcode durchsuchen

Merge pull request #729 from kwhatmough/next

Refix an accidental revert, and hide Bullet classes from public API
Sean Paul Taylor vor 13 Jahren
Ursprung
Commit
860772f021

+ 45 - 40
gameplay/src/PhysicsCollisionObject.h

@@ -21,6 +21,8 @@ class PhysicsCollisionObject
 {
     friend class PhysicsController;
     friend class PhysicsConstraint;
+    friend class PhysicsRigidBody;
+    friend class PhysicsGhostObject;
 
 public:
 
@@ -289,6 +291,7 @@ public:
     PhysicsVehicleWheel* asVehicleWheel();
 
 protected:
+
     /**
      * Handles collision event callbacks to Lua script functions.
      */
@@ -311,6 +314,40 @@ protected:
         std::string function;
     };
 
+    /**
+     * Constructor.
+     */
+    PhysicsCollisionObject(Node* node);
+
+    /**
+     * Returns the Bullet Physics collision object.
+     *
+     * @return The Bullet collision object.
+     */
+    virtual btCollisionObject* getCollisionObject() const = 0;
+
+    /**
+     * Pointer to Node contained by this collision object.
+     */ 
+    Node* _node;
+    
+    /**
+     * The PhysicsCollisionObject's collision shape.
+     */
+    PhysicsCollisionShape* _collisionShape;
+
+    /**
+     * If the collision object is enabled or not.
+     */
+    bool _enabled;
+
+    /**
+     * The list of script listeners.
+     */
+    std::vector<ScriptListener*>* _scriptListeners;
+
+private:
+
     /**
      * Interface between GamePlay and Bullet to keep object transforms synchronized properly.
      * 
@@ -321,7 +358,7 @@ protected:
         friend class PhysicsConstraint;
         
     public:
-
+        
         /**
          * Creates a physics motion state for a rigid body.
          * 
@@ -330,76 +367,44 @@ protected:
          * @param centerOfMassOffset The translation offset to the center of mass of the rigid body.
          */
         PhysicsMotionState(Node* node, PhysicsCollisionObject* collisionObject, const Vector3* centerOfMassOffset = NULL);
-
+        
         /**
          * Destructor.
          */
         virtual ~PhysicsMotionState();
-
+        
         /**
          * @see btMotionState::getWorldTransform
          */
         virtual void getWorldTransform(btTransform &transform) const;
-
+        
         /**
          * @see btMotionState::setWorldTransform
          */
         virtual void setWorldTransform(const btTransform &transform);
-
+        
         /**
          * Updates the motion state's world transform from the GamePlay Node object's world transform.
          */
         void updateTransformFromNode() const;
-
+        
         /**
          * Sets the center of mass offset for the associated collision shape.
          */
         void setCenterOfMassOffset(const Vector3& centerOfMassOffset);
-
+        
     private:
-
+        
         Node* _node;
         PhysicsCollisionObject* _collisionObject;
         btTransform _centerOfMassOffset;
         mutable btTransform _worldTransform;
     };
 
-    /**
-     * Constructor.
-     */
-    PhysicsCollisionObject(Node* node);
-
-    /**
-     * Returns the Bullet Physics collision object.
-     *
-     * @return The Bullet collision object.
-     */
-    virtual btCollisionObject* getCollisionObject() const = 0;
-
-    /**
-     * Pointer to Node contained by this collision object.
-     */ 
-    Node* _node;
-
     /** 
      * The PhysicsCollisionObject's motion state.
      */
     PhysicsMotionState* _motionState;
-    
-    /**
-     * The PhysicsCollisionObject's collision shape.
-     */
-    PhysicsCollisionShape* _collisionShape;
-
-    /**
-     * If the collision object is enabled or not.
-     */
-    bool _enabled;
-
-    /**
-     * The list of script listeners.
-     */
-    std::vector<ScriptListener*>* _scriptListeners;
 };
 
 }

+ 0 - 2
gameplay/src/PhysicsGhostObject.h

@@ -8,8 +8,6 @@
 namespace gameplay
 {
 
-class PhysicsMotionState;
-
 /**
  * Defines a class for physics ghost objects.
  */

+ 1 - 1
gameplay/src/PlatformMacOSX.mm

@@ -931,7 +931,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 - (void) mouseDragged: (NSEvent*) event
 {
     NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
-    if (__leftMouseDown)
+    if (__leftMouseDown && !__mouseCaptured)
     {
         [self mouse: Mouse::MOUSE_MOVE orTouchEvent: Touch::TOUCH_MOVE x: point.x y: __height - point.y s: 0];
     }