summaryrefslogtreecommitdiffhomepage
path: root/entity/chunk.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:05:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:05:17 +0100
commit7d4f172bd280e77175f617f36673d99f50580d36 (patch)
tree0b4cd3e8978119e0c38173b70666c68b715ce945 /entity/chunk.cpp
parent06ccfd8b34c702da9ad695982e8210823d7b501c (diff)
wip
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