Beispiel #1
0
        public void PrintToConsole(Point position, bool clear = false)
        {
            ColorInfo color = ColorInfo.FromConsole();

            Rectangle drawarea = new Rectangle(position, Size);

            if (clear)
            {
                Console.Clear();
            }

            for (int y = drawarea.Top; y < drawarea.Bottom; y++)
            {
                Console.SetCursorPosition(position.X, y);

                for (int x = drawarea.Left; x < drawarea.Right; x++)
                {
                    int local_x = x - drawarea.Left;
                    int local_y = y - drawarea.Top;

                    Colors[local_y, local_x].SetConsoleColor();
                    Console.Write(Text[local_y, local_x]);
                }
                Console.WriteLine();
            }

            color.SetConsoleColor();
        }
Beispiel #2
0
        public void SetSize(Size size)
        {
            Size = size;

            Text   = new char[Height, Width];
            Colors = new ColorInfo[Height, Width];
            Cursor = new Point(0, 0);
        }
Beispiel #3
0
 public TextBuffer(Size size)
 {
     SetSize(size);
     CurrentColor = new ColorInfo(ConsoleColor.DarkRed, ConsoleColor.White);
 }