Files
Firebird_2D/Firebird2D.SFMLExtensions/FloatRectangeExtension.cs
T
2025-02-23 14:29:32 +01:00

23 lines
730 B
C#

using SFML.Graphics;
using SFML.System;
namespace Firebird2D.SFMLExtensions
{
public static class FloatRectangeExtension
{
public static bool Contains(this FloatRect rect, FloatRect other)
{
return (other.Left >= rect.Left) &&
(other.Top >= rect.Top) &&
(other.Left + other.Width <= rect.Left + rect.Width) &&
(other.Top + other.Height <= rect.Top + rect.Height);
}
public static Vector2f Location(this FloatRect rect) { return new Vector2f(rect.Left, rect.Top); }
public static Vector2f Center(this FloatRect rect) { return new Vector2f(rect.Left + rect.Width /2, rect.Top + rect.Height /2);}
}
}