supervisor-simulator/scripts/Helpers.cs
2024-12-06 23:53:02 +08:00

16 lines
405 B
C#

using Godot;
public class H {
public static bool RectHasPointInclusive(Rect2I r, Vector2I p) {
if (r.HasPoint(p)) {
return true;
}
if (r.End.Y == p.Y && p.X >= r.Position.X && p.X <= r.End.X) {
return true;
}
if (r.End.X == p.X && p.Y >= r.Position.Y && p.Y <= r.End.Y) {
return true;
}
return false;
}
}