summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-24 08:59:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-24 08:59:46 +0100
commit83bca7d6861a701e8ba383a93076f346db393a33 (patch)
tree2f16b71ef17003d9eac0138f6ebb2dad02a9d99c /editor
parenta68822c7e24d818b984ef6889c36d3b39202c887 (diff)
a
Diffstat (limited to 'editor')
-rw-r--r--editor/events.cpp2
-rw-r--r--editor/inspect-types.cpp14
-rw-r--r--editor/inspect.cpp4
3 files changed, 14 insertions, 6 deletions
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 <Corrade/Containers/ArrayViewStl.h>
+#include <Corrade/Containers/String.h>
+
+//#define TEST_STR
namespace floormat::entities {
+#ifdef TEST_STR
+static String my_str;
+#endif
+
template<> struct entity_accessors<scenery_ref> {
static constexpr auto accessors()
{
@@ -29,11 +36,16 @@ template<> struct entity_accessors<scenery_ref> {
[](const scenery_ref& x) { return x.frame.passability; },
[](scenery_ref& x, pass_mode value) { x.frame.passability = value; }
},
- // 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; }
}
+#ifdef TEST_STR
+ , entity::type<String>::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<String*>(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;