diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-06 23:51:12 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-06 23:51:12 +0200 |
commit | a5f814a06d8530a0655b71689d97b0f14ff187b4 (patch) | |
tree | 257798b105953f80d1a56ca3b09ccb56e908c9fb /src | |
parent | 85d9552871b1bbf2df86f9f20d93d5bac575dd12 (diff) |
a
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.hpp | 15 | ||||
-rw-r--r-- | src/world.cpp | 8 | ||||
-rw-r--r-- | src/world.hpp | 17 |
3 files changed, 25 insertions, 15 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index 39d64297..97db2940 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -40,19 +40,4 @@ constexpr void chunk::foreach_tile_(F&& fun) local_coords{(std::uint8_t)i, (std::uint8_t)j}); } -struct chunk_coords final { - std::int16_t x = 0, y = 0; - constexpr std::size_t to_index() const noexcept; - - static constexpr std::size_t max_bits = sizeof(chunk_coords::x)*8 * 3 / 4; - static_assert(max_bits*4/3/8 == sizeof(decltype(chunk_coords::x))); -}; - -struct global_coords final { - std::uint32_t x = 0, y = 0; - constexpr global_coords() noexcept = default; - constexpr global_coords(decltype(x) x, decltype(y) y) noexcept : x{x}, y{y} {} - constexpr global_coords(chunk_coords c, local_coords tile) noexcept; -}; - } // namespace Magnum::Examples diff --git a/src/world.cpp b/src/world.cpp new file mode 100644 index 00000000..a8ca7085 --- /dev/null +++ b/src/world.cpp @@ -0,0 +1,8 @@ +#include "world.hpp" + +namespace Magnum::Examples { + + + +} // namespace Magnum::Examples + diff --git a/src/world.hpp b/src/world.hpp new file mode 100644 index 00000000..bd4f24df --- /dev/null +++ b/src/world.hpp @@ -0,0 +1,17 @@ +#pragma once +#include "src/chunk.hpp" + +namespace Magnum::Examples { + +struct chunk_coords final { + std::int16_t x = 0, y = 0; + static constexpr std::size_t max_bits = sizeof(chunk_coords::x)*8 * 3 / 4; + static_assert(max_bits*4/3/8 == sizeof(decltype(chunk_coords::x))); +}; + +struct global_coords final { + chunk_coords chunk; + local_coords tile; +}; + +} // namespace Magnum::Examples |