diff --git a/Voile/Source/UI/Widgets/Widget.cs b/Voile/Source/UI/Widgets/Widget.cs index 81bce9c..5ce7698 100644 --- a/Voile/Source/UI/Widgets/Widget.cs +++ b/Voile/Source/UI/Widgets/Widget.cs @@ -61,5 +61,18 @@ public abstract class Widget : IElement, IRenderableElement, IInputElement, IRes renderer.DrawRectangleOutline(new Vector2(Size.Width, Size.Height), Color.Red, 2.0f); } + /// + /// Determines if this contains a point within its confines. + /// + /// A global position of the point. + /// True if the point is inside the widget; otherwise, false. + public bool ContainsPoint(Vector2 pointPosition) + { + return pointPosition.X >= Position.X && + pointPosition.Y >= Position.Y && + pointPosition.X <= Position.X + Size.Width && + pointPosition.Y <= Position.Y + Size.Height; + } + private bool _isDirty = true; } \ No newline at end of file