AStarCollisionMap.DrawUtil.DrawLine C# (CSharp) Метод

DrawLine() публичный статический Метод

Draws a line!
public static DrawLine ( SpriteBatch batch, Point start, Point end, Color c, int width ) : void
batch Microsoft.Xna.Framework.Graphics.SpriteBatch The batch to draw on.
start Point Startpoint
end Point Endpoint
c Color The color of the line
width int
Результат void
        public static void DrawLine(SpriteBatch batch, Point start, Point end, Color c, int width)
        {
            if (lineTexture == null) lineTexture = GetClearTexture2D(batch);
            if (c.A == 0) return;
            if (end.X < start.X)
            {
                // Swap
                Point temp = start;
                start = end;
                end = temp;
            }
            double hypoteneuse = PathfindingUtil.GetHypoteneuseLength(start, end);
            float angle = PathfindingUtil.GetHypoteneuseAngleRad(start, end);
            batch.Draw(lineTexture, new Rectangle(start.X, start.Y, (int)Math.Round(hypoteneuse), width), null, c, angle,
                new Vector2(0, 0), SpriteEffects.None, 0);
        }