TugOfBaby.RenderManager.DrawLine C# (CSharp) Method

DrawLine() public method

public DrawLine ( SpriteBatch batch, float width, Color color, Vector2 point1, Vector2 point2 ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch
width float
color Color
point1 Vector2
point2 Vector2
return void
        public void DrawLine(SpriteBatch batch, float width, Color color, Vector2 point1, Vector2 point2)
        {
            float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);
            float length = Vector2.Distance(point1, point2);

            batch.Draw(_blank, point1, null, color,
                       angle, Vector2.Zero, new Vector2(length, width),
                       SpriteEffects.None, 0);
        }