Ejemplo n.º 1
0
        //--------------- Internals Below -------------------

        static public b2Joint Create(b2JointDef def, object allocator)
        {
            b2Joint joint = null;

            if (def.type == e_distanceJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2DistanceJoint));
                joint = new b2DistanceJoint(def as b2DistanceJointDef);
            }
            else if (def.type == e_mouseJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2MouseJoint));
                joint = new b2MouseJoint(def as b2MouseJointDef);
            }
            else if (def.type == e_prismaticJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2PrismaticJoint));
                joint = new b2PrismaticJoint(def as b2PrismaticJointDef);
            }
            else if (def.type == e_revoluteJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2RevoluteJoint));
                joint = new b2RevoluteJoint(def as b2RevoluteJointDef);
            }
            else if (def.type == e_pulleyJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2PulleyJoint));
                joint = new b2PulleyJoint(def as b2PulleyJointDef);
            }
            else if (def.type == e_gearJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2GearJoint));
                joint = new b2GearJoint(def as b2GearJointDef);
            }
            else if (def.type == e_lineJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2LineJoint));
                joint = new b2LineJoint(def as b2LineJointDef);
            }
            else if (def.type == e_weldJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2WeldJoint));
                joint = new b2WeldJoint(def as b2WeldJointDef);
            }
            else if (def.type == e_frictionJoint)
            {
                //void* mem = allocator->Allocate(sizeof(b2FrictionJoint));
                joint = new b2FrictionJoint(def as b2FrictionJointDef);
            }
            else if (def.type == e_ropeJoint)
            {
                joint = new b2RopeJoint(def as b2RopeJointDef);
            }
            else
            {
                //b2Settings.b2Assert(false);
            }
            return(joint);
        }
Ejemplo n.º 2
0
 /** @private */
 public b2Joint(b2JointDef def)
 {
     b2Settings.b2Assert(def.bodyA != def.bodyB);
     m_type             = def.type;
     m_prev             = null;
     m_next             = null;
     m_bodyA            = def.bodyA;
     m_bodyB            = def.bodyB;
     m_collideConnected = def.collideConnected;
     m_islandFlag       = false;
     m_userData         = def.userData;
 }
Ejemplo n.º 3
0
        public b2Joint(b2JointDef def)
        {
            Debug.Assert(def.BodyA != def.BodyB);

            m_type             = def.JointType;
            Prev               = null;
            Next               = null;
            m_bodyA            = def.BodyA;
            m_bodyB            = def.BodyB;
            m_index            = 0;
            m_collideConnected = def.CollideConnected;
            m_islandFlag       = false;
            m_userData         = def.UserData;
            m_edgeA            = new b2JointEdge();
            m_edgeB            = new b2JointEdge();
        }
Ejemplo n.º 4
0
        public b2Joint(b2JointDef def)
        {
            Debug.Assert(def.BodyA != def.BodyB);

            m_type = def.JointType;
            Prev = null;
            Next = null;
            m_bodyA = def.BodyA;
            m_bodyB = def.BodyB;
            m_index = 0;
            m_collideConnected = def.CollideConnected;
            m_islandFlag = false;
            m_userData = def.UserData;

            m_edgeA.Joint = null;
            m_edgeA.Other = null;
            m_edgeA.Prev = null;
            m_edgeA.Next = null;

            m_edgeB.Joint = null;
            m_edgeB.Other = null;
            m_edgeB.Prev = null;
            m_edgeB.Next = null;
        }
Ejemplo n.º 5
0
        public static b2Joint Create(b2JointDef def)
        {
            b2Joint joint = null;

            switch (def.JointType)
            {
                case b2JointType.e_distanceJoint:
                    {
                        joint = new b2DistanceJoint((b2DistanceJointDef)def);
                    }
                    break;

                case b2JointType.e_mouseJoint:
                    {
                        joint = new b2MouseJoint((b2MouseJointDef)def);
                    }
                    break;

                case b2JointType.e_prismaticJoint:
                    {
                        joint = new b2PrismaticJoint((b2PrismaticJointDef)def);
                    }
                    break;

                case b2JointType.e_revoluteJoint:
                    {
                        joint = new b2RevoluteJoint((b2RevoluteJointDef)def);
                    }
                    break;

                case b2JointType.e_pulleyJoint:
                    {
                        joint = new b2PulleyJoint((b2PulleyJointDef)def);
                    }
                    break;

                case b2JointType.e_gearJoint:
                    {
                        joint = new b2GearJoint((b2GearJointDef)def);
                    }
                    break;

                case b2JointType.e_wheelJoint:
                    {
                        joint = new b2WheelJoint((b2WheelJointDef)def);
                    }
                    break;

                case b2JointType.e_weldJoint:
                    {
                        joint = new b2WeldJoint((b2WeldJointDef)def);
                    }
                    break;

                case b2JointType.e_frictionJoint:
                    {
                        joint = new b2FrictionJoint((b2FrictionJointDef)def);
                    }
                    break;

                case b2JointType.e_ropeJoint:
                    {
                        joint = new b2RopeJoint((b2RopeJointDef)def);
                    }
                    break;

                default:
                    Debug.Assert(false);
                    break;
            }

            return joint;
        }
Ejemplo n.º 6
0
        public static b2Joint Create(b2JointDef def)
        {
            b2Joint joint = null;

            switch (def.JointType)
            {
            case b2JointType.e_distanceJoint:
            {
                joint = new b2DistanceJoint((b2DistanceJointDef)def);
            }
            break;

            case b2JointType.e_mouseJoint:
            {
                joint = new b2MouseJoint((b2MouseJointDef)def);
            }
            break;

            case b2JointType.e_prismaticJoint:
            {
                joint = new b2PrismaticJoint((b2PrismaticJointDef)def);
            }
            break;

            case b2JointType.e_revoluteJoint:
            {
                joint = new b2RevoluteJoint((b2RevoluteJointDef)def);
            }
            break;

            case b2JointType.e_pulleyJoint:
            {
                joint = new b2PulleyJoint((b2PulleyJointDef)def);
            }
            break;

            case b2JointType.e_gearJoint:
            {
                joint = new b2GearJoint((b2GearJointDef)def);
            }
            break;

            case b2JointType.e_wheelJoint:
            {
                joint = new b2WheelJoint((b2WheelJointDef)def);
            }
            break;

            case b2JointType.e_weldJoint:
            {
                joint = new b2WeldJoint((b2WeldJointDef)def);
            }
            break;

            case b2JointType.e_frictionJoint:
            {
                joint = new b2FrictionJoint((b2FrictionJointDef)def);
            }
            break;

            case b2JointType.e_ropeJoint:
            {
                joint = new b2RopeJoint((b2RopeJointDef)def);
            }
            break;

            default:
                Debug.Assert(false);
                break;
            }

            return(joint);
        }