Skip to content

Commit

Permalink
[WtqRect] Contains()
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingpie committed Jul 14, 2024
1 parent 84e1060 commit 4db65ef
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/10-Core/Wtq/Data/WtqRect.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Wtq.Data;
using System.Drawing;

namespace Wtq.Data;

public struct WtqRect : IEquatable<WtqRect>
{
Expand Down Expand Up @@ -36,6 +38,15 @@ public static WtqRect Lerp(WtqRect b1, WtqRect b2, float by)
};
}

public readonly bool Contains(Point pos)
{
return
X < pos.X &&
Y < pos.Y &&
X + Width > pos.X &&
Y + Height > pos.Y;
}

public readonly bool Contains(WtqVec2I pos)
{
return
Expand Down

0 comments on commit 4db65ef

Please sign in to comment.