Пример #1
0
        public bool CheckCollission(AbstractSquare be)
        {
            Rectangle r1 = new Rectangle(x, y, size, size);
            Rectangle r2 = new Rectangle(be.x, be.y, be.GetSize(), be.GetSize());

            return(r1.IntersectsWith(r2));
        }
Пример #2
0
        private void RenderSquare(AbstractSquare square, PaintEventArgs e)
        {
            Brush     myBrush   = new SolidBrush(square.GetColor());
            int       size      = square.GetSize();
            Rectangle rectangle = new Rectangle(square.x, square.y, size, size);

            e.Graphics.FillRectangle(myBrush, rectangle);
        }