private void DrawSliderJoints(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < _physicsSimulator.JointList.Count; i++)
     {
         if (_physicsSimulator.JointList[i] is SliderJoint)
         {
             SliderJoint sliderJoint = (SliderJoint)_physicsSimulator.JointList[i];
             _sliderJointRectangleBrush.Draw(spriteBatch, sliderJoint.WorldAnchor1);
             _sliderJointRectangleBrush.Draw(spriteBatch, sliderJoint.WorldAnchor2);
             _sliderJointLineBrush.Draw(spriteBatch, sliderJoint.WorldAnchor1, sliderJoint.WorldAnchor2);
         }
     }
 }
 private void DrawPinJoints(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < _physicsSimulator.JointList.Count; i++)
     {
         if (_physicsSimulator.JointList[i] is PinJoint)
         {
             PinJoint pinJoint = (PinJoint)_physicsSimulator.JointList[i];
             _pinJointRectangleBrush.Draw(spriteBatch, pinJoint.WorldAnchor1);
             _pinJointRectangleBrush.Draw(spriteBatch, pinJoint.WorldAnchor2);
             _pinJointLineBrush.Draw(spriteBatch, pinJoint.WorldAnchor1, pinJoint.WorldAnchor2);
         }
     }
 }
예제 #3
0
 public void Draw(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < 4; i++)
     {
         _brush.Draw(spriteBatch, Body.Position, Body.Rotation);
     }
 }
예제 #4
0
 private void DrawObstacles()
 {
     for (int i = 0; i < _obstacleBodies.Length; i++)
     {
         _obstacleBrush.Draw(ScreenManager.SpriteBatch, _obstacleBodies[i].Position, _obstacleBodies[i].Rotation);
     }
 }
예제 #5
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend);
            _rectangleBrush.Draw(ScreenManager.SpriteBatch, _rectangleBody.Position, _rectangleBody.Rotation);
            ScreenManager.SpriteBatch.End();

            base.Draw(gameTime);
        }
        private void DrawRevoluteJoints(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < _physicsSimulator.JointList.Count; i++)
            {
                if (_physicsSimulator.JointList[i] is FixedRevoluteJoint)
                {
                    FixedRevoluteJoint fixedRevoluteJoint = (FixedRevoluteJoint)_physicsSimulator.JointList[i];
                    _revoluteJointRectangleBrush.Draw(spriteBatch, fixedRevoluteJoint.Anchor);
                }

                if (_physicsSimulator.JointList[i] is RevoluteJoint)
                {
                    RevoluteJoint revoluteJoint = (RevoluteJoint)_physicsSimulator.JointList[i];
                    _revoluteJointRectangleBrush.Draw(spriteBatch, revoluteJoint.CurrentAnchor);
                    _revoluteJointLineBrush.Draw(spriteBatch, revoluteJoint.CurrentAnchor, revoluteJoint.Body1.Position);
                    _revoluteJointLineBrush.Draw(spriteBatch, revoluteJoint.CurrentAnchor, revoluteJoint.Body2.Position);
                }
            }
        }
예제 #7
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend);

            _circleBrush.Draw(ScreenManager.SpriteBatch, _circleBody.Position);
            _rectangleBrush.Draw(ScreenManager.SpriteBatch, _rectangleBody.Position, _rectangleBody.Rotation);
            _lineBrush.Draw(ScreenManager.SpriteBatch, _p1, _p2);

            foreach (Vector2 point in _intersectingPoints)
            {
                _marker.Draw(ScreenManager.SpriteBatch, point);
            }

            ScreenManager.SpriteBatch.DrawString(ScreenManager.SpriteFonts.DetailsFont, string.Format("Colliding with {0} geometries", _intersectingGeoms.Count), new Vector2(50, ScreenManager.ScreenHeight - 70), Color.White);

            ScreenManager.SpriteBatch.End();

            base.Draw(gameTime);
        }
예제 #8
0
        static void DrawPrimitives(IEnumerable <Drawable> primitives, Cairo.Context grw)
        {
            foreach (var p in primitives)
            {
                var l = p as LineElement;
                if (l != null)
                {
                    LineBrush.Draw(grw, l);
                }

                var a = p as ArcElement;
                if (a != null)
                {
                    ArcBrush.Draw(grw, a);
                }

                var a3 = p as Arc3PointsElement;
                if (a3 != null)
                {
                    Arc3PointsBrush.Draw(grw, a3);
                }

                var t = p as TextElement;
                if (t != null)
                {
                    TextBrush.Draw(grw, t);
                }


                var r = p as RectangleElement;
                if (r != null)
                {
                    RectangleBrush.Draw(grw, r);
                }
            }
        }