summaryrefslogtreecommitdiffhomepage
path: root/loader/ground-traits.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-07 23:38:31 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-08 08:43:49 +0100
commita6514d1a95d0f84f0935866215463ef6aed23e19 (patch)
tree639075646b1ea42a3cd4a76ae59af7dda0c4b14a /loader/ground-traits.hpp
parent4575194adb4615deeca174044a872093c3664ad4 (diff)
loader: work toward removing duplicate atlas code
Diffstat (limited to 'loader/ground-traits.hpp')
-rw-r--r--loader/ground-traits.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/loader/ground-traits.hpp b/loader/ground-traits.hpp
new file mode 100644
index 00000000..56923cd0
--- /dev/null
+++ b/loader/ground-traits.hpp
@@ -0,0 +1,25 @@
+#pragma once
+#include "atlas-loader-fwd.hpp"
+#include <memory>
+
+namespace floormat { struct ground_cell; class ground_atlas; }
+
+namespace floormat::loader_detail {
+
+template<> struct atlas_loader_traits<ground_atlas>
+{
+ using Atlas = ground_atlas;
+ using Cell = ground_cell; // convertible to atlas and holding the atlas
+ using Self = atlas_loader_traits<ground_atlas>;
+ using Storage = atlas_storage<ground_atlas, Self>;
+
+ static StringView loader_name();
+ static const std::shared_ptr<Atlas>& atlas_of(const Cell& x);
+ static StringView name_of(const Cell& x);
+ static StringView name_of(const Atlas& x);
+ static void ensure_atlases_loaded(Storage& st);
+ static const Cell& make_invalid_atlas(Storage& st);
+ static std::shared_ptr<Atlas> make_atlas(StringView name, const Cell& c);
+};
+
+} // namespace floormat::loader_detail