public static void ClearArea(Rectangle rect) { int x_t = Console.CursorLeft; int y_t = Console.CursorTop; for(int x = rect.Left; x < rect.Right; x++) { for(int y = rect.Top; y < rect.Bottom; y++) { Console.SetCursorPosition(x, y); Console.Write(" "); } } Console.SetCursorPosition(x_t, y_t); }
private bool IntersectCheck(Rectangle first, Rectangle second) { return first.Top < second.Bottom && first.Top > second.Top && first.Left < second.Right && first.Left > second.Left; }
public bool Intersects(Rectangle rect) { return IntersectCheck(this, rect) || IntersectCheck(rect, this); }
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(); }