#region File Description
//-----------------------------------------------------------------------------
// ExtensionMethods.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using Microsoft.Xna.Framework;
#endregion
namespace HoneycombRush
{
///
/// A class containing extension methods.
///
public static class ExtensionMethods
{
///
/// Returns a vector pointing to the rectangle's top left corner.
///
/// The rectangle for which to produce the vector.
/// A vector pointing to the rectangle's top left corner.
public static Vector2 GetVector(this Rectangle rect)
{
return new Vector2(rect.X, rect.Y);
}
///
/// Returns a vector pointing to the specified point.
///
/// The point for which to produce the vector.
/// A vector pointing to the specified point.
public static Vector2 GetVector(this Point point)
{
return new Vector2(point.X, point.Y);
}
///
/// Check for collision between two rectangle.
///
/// The first rectangle.
/// The second rectangle.
/// Returns true if the two rectangles collide,
/// false otherwise.
public static bool HasCollision(this Rectangle first, Rectangle second)
{
return first.Intersects(second);
}
}
}