Example #1
0
            public static void Line(Resource.Position p1, Resource.Position p2)
            {
                if (p1.X == p2.X)
                {
                    return;
                }
                double k = (p2.Y - p1.Y) / (p2.X - p1.X);

                int y(int x) => (int)(k * (x - p1.X) + p1.Y);

                if (p1.X < p2.X)
                {
                    for (int x = p1.X; x < p2.X; x++)
                    {
                        ExtendedConsole.SetChar(x, y(x), '#');
                    }
                }
                else
                {
                    for (int x = p2.X; x < p1.X; x++)
                    {
                        ExtendedConsole.SetChar(x, y(x), '#');
                    }
                }
            }