From b7f3cff0904214f7161fed16bb5162b26260d386 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Feb 2024 21:04:41 +0100 Subject: add speed field to object (yet unused) --- editor/inspect-types.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'editor') 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 { [](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::field{"speed"_s, + [](const object& x) { return x.speed; }, + [](object& x, float value) { x.speed = Math::clamp(value, 0.f, 1e6f); } + }, E::type::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 { static constexpr auto accessors() { using E = Entity; - auto tuple0 = entity_accessors::accessors(); - auto tuple = std::tuple{ + auto prev = entity_accessors::accessors(); + auto t0 = std::tuple{ E::type::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::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); } }; -- cgit v1.2.3