Add extension methods to Rectangle/RectangleF, remove a pile of ToPoint()'s.

This commit is contained in:
Paul Chote
2011-01-05 22:24:11 +13:00
parent 3e1db3e8ae
commit df460d7407
7 changed files with 24 additions and 13 deletions

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Drawing;
namespace OpenRA
{
@@ -95,5 +96,15 @@ namespace OpenRA
else
return val;
}
public static bool Contains(this Rectangle r, int2 p)
{
return r.Contains(p.ToPoint());
}
public static bool Contains(this RectangleF r, int2 p)
{
return r.Contains(p.ToPointF());
}
}
}