41 constexpr hitbox& operator=(
hitbox const&)
noexcept =
default;
42 constexpr hitbox& operator=(
hitbox&&)
noexcept =
default;
49 hitbox_type type = hitbox_type::_default) noexcept :
50 widget(widget), _elevation(elevation), type(type)
54 constexpr hitbox(
hi::widget const *widget,
point3 position, hitbox_type type = hitbox_type::_default) noexcept :
55 widget(widget), _elevation(-position.
z()), type(type)
59 [[nodiscard]]
constexpr friend std::strong_ordering operator<=>(
hitbox const& lhs,
hitbox const& rhs)
noexcept
61 if ((lhs.widget ==
nullptr) == (rhs.widget ==
nullptr)) {
63 hilet elevation_ordering = lhs._elevation <=> rhs._elevation;
64 if (elevation_ordering == std::partial_ordering::equivalent) {
65 return to_underlying(lhs.type) <=> to_underlying(rhs.type);
66 }
else if (elevation_ordering == std::partial_ordering::less) {
67 return std::strong_ordering::less;
68 }
else if (elevation_ordering == std::partial_ordering::greater) {
69 return std::strong_ordering::greater;
73 }
else if (lhs.widget ==
nullptr) {
75 return std::strong_ordering::less;
78 return std::strong_ordering::greater;