diff options
Diffstat (limited to 'src/shared/math/coords.hh')
| -rw-r--r-- | src/shared/math/coords.hh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/shared/math/coords.hh b/src/shared/math/coords.hh new file mode 100644 index 0000000..7a21bf9 --- /dev/null +++ b/src/shared/math/coords.hh @@ -0,0 +1,31 @@ +#ifndef SHARED_MATH_COORDS_HH_ +#define SHARED_MATH_COORDS_HH_ + +#include <compare> +#include <cstdint> + +namespace shared { +namespace math { + +// 2D coordinates. +struct coords { +public: + std::int32_t x; + std::int32_t z; + +public: + static bool is_inside_draw(const coords& a, const coords& b, + const std::int32_t draw_distance) noexcept; + +public: + coords operator+(const coords& c) const noexcept; + coords operator-(const coords& c) const noexcept; + +public: + auto operator<=>(const coords&) const noexcept = default; +}; + +} // namespace math +} // namespace shared + +#endif |
