2
0
Эх сурвалжийг харах

Merge branch 'next' of https://github.com/blackberry-gaming/GamePlay into next-kcunney

Kieran Cunney 13 жил өмнө
parent
commit
a88712e2af

BIN
gameplay-api/gameplay.png


+ 20 - 0
gameplay-api/header.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<meta http-equiv="X-UA-Compatible" content="IE=9"/>
+<title>gameplay: Main Page</title>
+
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="doxygen.css" rel="stylesheet" type="text/css" />
+
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="search/search.js"></script>
+<script type="text/javascript">
+  $(document).ready(function() { searchBox.OnSelectItem(0); });
+</script>
+
+</head>
+<body>
+<div id="top"><!-- do not remove this div! -->

+ 8 - 7
gameplay.doxyfile

@@ -45,7 +45,7 @@ PROJECT_BRIEF          =
 # exceed 55 pixels and the maximum width should not exceed 200 pixels. 
 # Doxygen will copy the logo to the output directory.
 
-PROJECT_LOGO           = ./gameplay-api/gameplay.png
+PROJECT_LOGO           = 
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
@@ -562,7 +562,7 @@ MAX_INITIALIZER_LINES  = 30
 # at the bottom of the documentation of classes and structs. If set to YES the 
 # list will mention the files that were used to generate the documentation.
 
-SHOW_USED_FILES        = YES
+SHOW_USED_FILES        = NO
 
 # If the sources in your project are distributed over multiple directories 
 # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
@@ -574,7 +574,7 @@ SHOW_DIRECTORIES       = NO
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
 
-SHOW_FILES             = YES
+SHOW_FILES             = NO
 
 # Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
 # Namespaces page.  This will remove the Namespaces entry from the Quick Index 
@@ -689,7 +689,8 @@ INPUT_ENCODING         = UTF-8
 # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py 
 # *.f90 *.f *.for *.vhd *.vhdl
 
-FILE_PATTERNS          = *.h
+FILE_PATTERNS          = *.h \
+                         *.dox
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories 
 # should be searched for input files as well. Possible values are YES and NO. 
@@ -839,7 +840,7 @@ USE_HTAGS              = NO
 # will generate a verbatim copy of the header file for each class for 
 # which an include is specified. Set to NO to disable this.
 
-VERBATIM_HEADERS       = YES
+VERBATIM_HEADERS       = NO
 
 #---------------------------------------------------------------------------
 # configuration options related to the alphabetical class index
@@ -896,7 +897,7 @@ HTML_FILE_EXTENSION    = .html
 # have to redo this when upgrading to a newer version of doxygen or when 
 # changing the value of configuration settings such as GENERATE_TREEVIEW!
 
-HTML_HEADER            = 
+HTML_HEADER            = gameplay-api/header.html
 
 # The HTML_FOOTER tag can be used to specify a personal HTML footer for 
 # each generated HTML page. If it is left blank doxygen will generate a 
@@ -1136,7 +1137,7 @@ DISABLE_INDEX          = NO
 # Since the tree basically has the same information as the tab index you 
 # could consider to set DISABLE_INDEX to NO when enabling this option.
 
-GENERATE_TREEVIEW      = YES
+GENERATE_TREEVIEW      = NO
 
 # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
 # (range [0,1..20]) that doxygen will group on one line in the generated HTML 

+ 3 - 0
gameplay/src/Node.cpp

@@ -1013,6 +1013,9 @@ PhysicsCollisionObject* Node::setCollisionObject(PhysicsCollisionObject::Type ty
             _collisionObject = new PhysicsCharacter(this, shape, rigidBodyParameters ? rigidBodyParameters->mass : 1.0f);
         }
         break;
+
+    case PhysicsCollisionObject::NONE:
+        break;  // Already deleted, Just don't add a new collision object back.
     }
 
     return _collisionObject;

+ 2 - 1
gameplay/src/Node.h

@@ -517,7 +517,8 @@ public:
      *        must point to a valid rigid body parameters object containing information
      *        about the rigid body; otherwise, this parmater may be NULL.
      */
-    PhysicsCollisionObject* setCollisionObject(PhysicsCollisionObject::Type type, const PhysicsCollisionShape::Definition& shape, PhysicsRigidBody::Parameters* rigidBodyParameters = NULL);
+    PhysicsCollisionObject* setCollisionObject(PhysicsCollisionObject::Type type, const PhysicsCollisionShape::Definition& shape = PhysicsCollisionShape::box(), 
+                                               PhysicsRigidBody::Parameters* rigidBodyParameters = NULL);
 
     /**
      * Sets the physics collision object for this node using the data from the Properties object defined at the specified URL, 

+ 27 - 4
gameplay/src/PhysicsCollisionObject.cpp

@@ -14,9 +14,7 @@ struct CollidesWithCallback : public btCollisionWorld::ContactResultCallback
     /**
      * Called with each contact. Needed to implement collidesWith(PhysicsCollisionObject*).
      */
-    btScalar addSingleResult(btManifoldPoint& cp, 
-        const btCollisionObject* a, int partIdA, int indexA, 
-        const btCollisionObject* b, int partIdB, int indexB)
+    btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* a, int partIdA, int indexA, const btCollisionObject* b, int partIdB, int indexB)
     {
         result = true;
         return 0.0f;
@@ -29,7 +27,7 @@ struct CollidesWithCallback : public btCollisionWorld::ContactResultCallback
 };
 
 PhysicsCollisionObject::PhysicsCollisionObject(Node* node)
-    : _node(node), _motionState(NULL), _collisionShape(NULL)
+    : _node(node), _motionState(NULL), _collisionShape(NULL), _enabled(true)
 {
 }
 
@@ -81,6 +79,31 @@ bool PhysicsCollisionObject::isDynamic() const
     return !getCollisionObject()->isStaticOrKinematicObject();
 }
 
+bool PhysicsCollisionObject::isEnabled() const
+{
+    return _enabled;
+}
+
+void PhysicsCollisionObject::setEnabled(bool enable)
+{
+    if (enable)
+    {  
+        if (!_enabled)
+        {
+            Game::getInstance()->getPhysicsController()->addCollisionObject(this);
+            _enabled = true;
+        }
+    }
+    else
+    {
+        if (_enabled)
+        {
+            Game::getInstance()->getPhysicsController()->removeCollisionObject(this);
+            _enabled = false;
+        }
+    }
+}
+
 void PhysicsCollisionObject::addCollisionListener(CollisionListener* listener, PhysicsCollisionObject* object)
 {
     GP_ASSERT(Game::getInstance()->getPhysicsController());

+ 23 - 4
gameplay/src/PhysicsCollisionObject.h

@@ -155,7 +155,7 @@ public:
      * A kinematic collision object is an object that is not simulated by
      * the physics system and instead has its transform driven manually.
      *
-     * @return Whether the collision object is kinematic.
+     * @return true if the collision object is kinematic.
      */
     bool isKinematic() const;
 
@@ -165,10 +165,24 @@ public:
      * A dynamic collision object is simulated entirely by the physics system,
      * such as with dynamic rigid bodies. 
      *
-     * @return Whether the collision object is dynamic.
+     * @return true if the collision object is dynamic.
      */
     bool isDynamic() const;
 
+    /**
+     * Check if th collision object is enabled.
+     *
+     * @return true if the collision object is enabled.
+     */
+    bool isEnabled() const;
+
+    /**
+     * Sets the collision object be enabled or disabled.
+     *
+     * @param enable true enables the collision object, false diables it.
+     */
+    void setEnabled(bool enable);
+
     /**
      * Adds a collision listener for this collision object.
      * 
@@ -190,10 +204,11 @@ public:
      * 
      * @param object The collision object to test for collision with.
      * 
-     * @return True if this object collides with the specified one; false otherwise.
+     * @return true if this object collides with the specified one; false otherwise.
      */
     bool collidesWith(PhysicsCollisionObject* object) const;
 
+
 protected:
 
     /**
@@ -215,7 +230,6 @@ protected:
      */
     PhysicsMotionState* getMotionState() const;
 
-    // Common member variables
     /**
      * Pointer to Node contained by this collision object.
      */ 
@@ -231,6 +245,11 @@ protected:
      */
     PhysicsCollisionShape* _collisionShape;
 
+    /**
+     * If the collision object is enabled or not.
+     */
+    bool _enabled;
+
 };
 
 }