diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-27 21:04:41 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-27 21:06:57 +0100 |
| commit | b7f3cff0904214f7161fed16bb5162b26260d386 (patch) | |
| tree | b44ed9506e6fb1782987667ef92ebab9af1b8579 /editor | |
| parent | 11eb5a82f0cdddd79f051192110f9f3f4da7d58c (diff) | |
add speed field to object (yet unused)
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/inspect-types.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 5668d6b2..41a236b0 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -52,6 +52,10 @@ struct entity_accessors<object, inspect_intent_t> { [](const object& x) { return x.pass; }, [](object& x, pass_mode value) { x.set_bbox(x.offset, x.bbox_offset, x.bbox_size, value); }, }, + E::type<float>::field{"speed"_s, + [](const object& x) { return x.speed; }, + [](object& x, float value) { x.speed = Math::clamp(value, 0.f, 1e6f); } + }, E::type<Vector2b>::field{"bbox-offset"_s, [](const object& x) { return x.bbox_offset; }, [](object& x, Vector2b value) { x.set_bbox(x.offset, value, x.bbox_size, x.pass); }, @@ -202,18 +206,19 @@ struct entity_accessors<critter, inspect_intent_t> { static constexpr auto accessors() { using E = Entity<critter>; - auto tuple0 = entity_accessors<object, inspect_intent_t>::accessors(); - auto tuple = std::tuple{ + auto prev = entity_accessors<object, inspect_intent_t>::accessors(); + auto t0 = std::tuple{ E::type<String>::field{"name"_s, - [](const critter& x) { return x.name; }, - [](critter& x, const String& value) { x.name = value; }}, + [](const critter& x) { return x.name; }, + [](critter& x, const String& value) { x.name = value; } }, + }; + auto t1 = std::tuple{ E::type<bool>::field{"playable"_s, - [](const critter& x) { return x.playable; }, - [](critter& x, bool value) { x.playable = value; }, - constantly(constraints::max_length{128}), - }, + [](const critter& x) { return x.playable; }, + [](critter& x, bool value) { x.playable = value; }, + constantly(constraints::max_length{ 128 }) }, }; - return std::tuple_cat(tuple0, tuple); + return std::tuple_cat(t0, prev, t1); } }; |
