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(); }
public void SetSize(Size size) { Size = size; Text = new char[Height, Width]; Colors = new ColorInfo[Height, Width]; Cursor = new Point(0, 0); }
public TextBuffer(Size size) { SetSize(size); CurrentColor = new ColorInfo(ConsoleColor.DarkRed, ConsoleColor.White); }