/// <summary> /// Renders controls listed under this control's hierarchy. /// </summary> /// <param name="offset">The upper-left corner of this control in screen coordinates.</param> /// <param name="updateRect">The intersection rectangle, in screen coordinates, of the control hierarchy.</param> protected void _RenderChildControls(Vector2 offset, RectangleF updateRect) { int idx; int numObjects = GetNumObjects(); // store the clip RectangleF oldClip = DrawUtil.ClipRect; // offset is the upper-left corner of this control in screen coordinates // updateRect is the inter for (idx = 0; idx < numObjects; idx++) { GUIControl child = (GUIControl)GetObject(idx); if (child == null) break; if (child.Visible) { Vector2 childPosition = new Vector2(offset.X + child.Position.X, offset.Y + child.Position.Y); RectangleF childClip = new RectangleF(childPosition, child.Size); if (childClip.Intersect(updateRect)) { DrawUtil.ClipRect = childClip; child.OnRender(childPosition, childClip); } } } // restore the old clip DrawUtil.ClipRect = oldClip; }
/// <summary> /// Tests if this rectangle overlaps another rectangle. /// </summary> /// <param name="rect">The rectangle to test against.</param> /// <returns></returns> public bool Overlaps(RectangleF rect) { RectangleF test = new RectangleF(this); return test.Intersect(rect); }