From 83bca7d6861a701e8ba383a93076f346db393a33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 24 Feb 2023 08:59:46 +0100 Subject: a --- editor/events.cpp | 2 +- editor/inspect-types.cpp | 14 +++++++++++++- editor/inspect.cpp | 4 ---- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'editor') diff --git a/editor/events.cpp b/editor/events.cpp index cc1c0d7a..d0a57d8b 100644 --- a/editor/events.cpp +++ b/editor/events.cpp @@ -152,7 +152,7 @@ void app::on_key_up_down(const key_event& event, bool is_down) noexcept static_assert(key_GLOBAL >= key_NO_REPEAT); if (x == key_COUNT) - void(); + is_down ? _imgui.handleKeyPressEvent(e) : _imgui.handleKeyReleaseEvent(e); else if (x < key_GLOBAL && is_down ? _imgui.handleKeyPressEvent(e) : _imgui.handleKeyReleaseEvent(e)) clear_non_global_keys(); else if (x >= key_NO_REPEAT) diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 235ee72e..d4feb1c3 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -6,9 +6,16 @@ #include "entity/types.hpp" #include "inspect.hpp" #include +#include + +//#define TEST_STR namespace floormat::entities { +#ifdef TEST_STR +static String my_str; +#endif + template<> struct entity_accessors { static constexpr auto accessors() { @@ -29,11 +36,16 @@ template<> struct entity_accessors { [](const scenery_ref& x) { return x.frame.passability; }, [](scenery_ref& x, pass_mode value) { x.frame.passability = value; } }, - // todo pass_mode enum entity::type::field{"interactive"_s, [](const scenery_ref& x) { return x.frame.interactive; }, [](scenery_ref& x, bool value) { x.frame.interactive = value; } } +#ifdef TEST_STR + , entity::type::field{"string"_s, + [](const scenery_ref&) { return my_str; }, + [](scenery_ref&, String value) { my_str = std::move(value); } + } +#endif ); return tuple; } diff --git a/editor/inspect.cpp b/editor/inspect.cpp index cd2904fc..aa17029a 100644 --- a/editor/inspect.cpp +++ b/editor/inspect.cpp @@ -53,11 +53,7 @@ int corrade_string_resize_callback(ImGuiInputTextCallbackData* data) { auto* my_str = reinterpret_cast(data->UserData); fm_assert(my_str->begin() == data->Buf); - String tmp = std::move(*my_str); *my_str = String{ValueInit, (std::size_t)data->BufSize}; - auto len = std::min(tmp.size(), my_str->size()); - for (std::size_t i = 0; i < len; i++) - (*my_str)[i] = tmp[i]; data->Buf = my_str->begin(); } return 0; -- cgit v1.2.3