summaryrefslogtreecommitdiffhomepage
path: root/entity/chunk.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:51:16 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:51:16 +0100
commit26b537d5f2e4e48e0c183cca30ecb056a41cd3be (patch)
tree9e9501ceab6ab0f264eecef96afac8270fc9133f /entity/chunk.cpp
parent7d4f172bd280e77175f617f36673d99f50580d36 (diff)
wip
Diffstat (limited to 'entity/chunk.cpp')
-rw-r--r--entity/chunk.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/entity/chunk.cpp b/entity/chunk.cpp
index 6857ac1d..f7b9aadc 100644
--- a/entity/chunk.cpp
+++ b/entity/chunk.cpp
@@ -2,6 +2,7 @@
#include "entity/accessor.hpp"
#include "src/scenery.hpp"
#include "src/anim-atlas.hpp"
+#include "src/tile-defs.hpp"
namespace floormat::entities {
@@ -11,10 +12,20 @@ template<> struct entity_accessors<scenery_ref> {
using entity = Entity<scenery_ref>;
using frame_t = scenery::frame_t;
constexpr auto tuple = std::make_tuple(
- entity::type<scenery::frame_t>::field{"frame",
+ entity::type<scenery::frame_t>::field{"frame"_s,
[](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)}; }
+ },
+ entity::type<Vector2b>::field{"offset"_s,
+ [](const scenery_ref& x) { return x.frame.offset; },
+ [](scenery_ref& x, Vector2b value) { x.frame.offset = value; },
+ constantly(constraints::range{Vector2b(iTILE_SIZE2/-2), Vector2b(iTILE_SIZE2/2)})
+ },
+ // todo pass_mode enum
+ entity::type<bool>::field{"interactive"_s,
+ [](const scenery_ref& x) { return x.frame.interactive; },
+ [](scenery_ref& x, bool value) { x.frame.interactive = value; }
}
);
return tuple;