From a5f814a06d8530a0655b71689d97b0f14ff187b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Oct 2022 23:51:12 +0200 Subject: a --- src/chunk.hpp | 15 --------------- src/world.cpp | 8 ++++++++ src/world.hpp | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 src/world.cpp create mode 100644 src/world.hpp (limited to 'src') 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 -- cgit v1.2.3