using Godot;
///
/// 辅助工具类
///
public class H {
///
/// 判断矩形是否包含点(包含边界)
///
/// 矩形区域
/// 点坐标
/// 如果点在矩形内(包括边界)则返回true
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;
}
}