summaryrefslogtreecommitdiffhomepage
path: root/entity/chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'entity/chunk.cpp')
-rw-r--r--entity/chunk.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/entity/chunk.cpp b/entity/chunk.cpp
new file mode 100644
index 00000000..6857ac1d
--- /dev/null
+++ b/entity/chunk.cpp
@@ -0,0 +1,24 @@
+#include "entity/metadata.hpp"
+#include "entity/accessor.hpp"
+#include "src/scenery.hpp"
+#include "src/anim-atlas.hpp"
+
+namespace floormat::entities {
+
+template<> struct entity_accessors<scenery_ref> {
+ static constexpr auto accessors()
+ {
+ using entity = Entity<scenery_ref>;
+ using frame_t = scenery::frame_t;
+ constexpr auto tuple = std::make_tuple(
+ entity::type<scenery::frame_t>::field{"frame",
+ [](const scenery_ref& x) { return x.frame.frame; },
+ [](scenery_ref& x, frame_t value) { x.frame.frame = value; },
+ [](const scenery_ref& x) { return constraints::range<frame_t>{0, !x.atlas ? frame_t(0) : frame_t(x.atlas->info().nframes)}; }
+ }
+ );
+ return tuple;
+ }
+};
+
+} // namespace floormat::entities