aboutsummaryrefslogtreecommitdiff
path: root/src/shared/math/coords.hh
blob: 7a21bf968a77d4928ba993ab93bb3019f5b4da59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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