예제 #1
0
        public void DebugDraw()
        {
            if (_debugDraw == null)
            {
                _debugDraw = new PhysicsDebugDraw(this);

                _debugDraw.Flags = PhysicsDrawFlags.All;
            }

            //var space = this._info.getSpace();
            //_debugDraw.Begin();
            //space.EachShape(shape =>
            //{
            //	_debugDraw.DrawShape(shape);
            //});
            //_debugDraw.End();
            //return;

            if (_debugDraw != null && _bodies.Count > 0)
            {
                if (_debugDraw.Begin())
                {
                    if ((_debugDrawMask & DEBUGDRAW_SHAPE) > 0)
                    {
                        foreach (CCPhysicsBody body in _bodies)
                        {
                            //hysicsBody body = dynamic_cast<PhysicsBody*>(obj);

                            if (!body.IsEnabled())
                            {
                                continue;
                            }

                            foreach (CCPhysicsShape shape in body.GetShapes())
                            {
                                _debugDraw.DrawShape(shape);
                            }
                        }
                    }

                    if ((_debugDrawMask & DEBUGDRAW_JOINT) > 0)
                    {
                        foreach (CCPhysicsJoint joint in _joints)
                        {
                            _debugDraw.DrawJoint(joint);
                        }
                    }

                    _debugDraw.End();
                }
            }
        }
예제 #2
0
        public void DebugDraw()
        {
            if (_debugDraw == null)
            {
                _debugDraw = new PhysicsDebugDraw(this);

                _debugDraw.Flags = PhysicsDrawFlags.All;
            }

            if (_debugDraw != null && Bodies.Count > 0)
            {
                if (_debugDraw.Begin())
                {
                    if ((debugDrawMask & DEBUGDRAW_SHAPE) > 0)
                    {
                        foreach (CCPhysicsBody body in Bodies)
                        {
                            //hysicsBody body = dynamic_cast<PhysicsBody*>(obj);

                            if (!body.IsEnabled())
                            {
                                continue;
                            }

                            foreach (CCPhysicsShape shape in body.GetShapes())
                            {
                                _debugDraw.DrawShape(shape);
                            }
                        }
                    }

                    if ((debugDrawMask & DEBUGDRAW_JOINT) > 0)
                    {
                        foreach (CCPhysicsJoint joint in Joints)
                        {
                            _debugDraw.DrawJoint(joint);
                        }
                    }

                    _debugDraw.End();
                }
            }
        }