summaryrefslogtreecommitdiffhomepage
path: root/tile.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-02 03:23:05 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-02 03:23:05 +0200
commit35cf1d65b454985c38b1e00a91670663b1583670 (patch)
tree1e47893775fbea27a79bf799fb99360b954a85ca /tile.hpp
parent5ec89ae3a42308dd5e43e5fed207824918123023 (diff)
a
Diffstat (limited to 'tile.hpp')
-rw-r--r--tile.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tile.hpp b/tile.hpp
index 6a717a26..39271cfb 100644
--- a/tile.hpp
+++ b/tile.hpp
@@ -10,6 +10,8 @@ namespace Magnum::Examples {
struct tile_atlas;
constexpr inline Vector3 TILE_SIZE = { 50, 50, 50 };
+constexpr inline std::size_t TILE_MAX_DIM = 16;
+constexpr inline std::size_t TILE_COUNT = TILE_MAX_DIM*TILE_MAX_DIM;
struct tile_image final
{
@@ -28,4 +30,12 @@ struct tile final
pass_mode passability = pass_shoot_through;
};
+struct local_coords final {
+ std::uint8_t x = 0, y = 0;
+ constexpr local_coords() = default;
+ local_coords(std::size_t x, std::size_t y);
+ constexpr local_coords(std::uint8_t x, std::uint8_t y) : x{x}, y{y} {}
+ constexpr std::size_t to_index() const { return y*TILE_MAX_DIM + x; }
+};
+
} //namespace Magnum::Examples