summaryrefslogtreecommitdiffhomepage
path: root/editor/events.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-26 21:05:03 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-26 21:57:44 +0200
commit07f9e1834243783a8baa51da26869582214c6880 (patch)
treed347256d9f2df6279bab0e5bcde2ce0169c37313 /editor/events.cpp
parentdded6652999447b6a56f6c00d07e439a4c5d678c (diff)
add non-repeat keybindings
Diffstat (limited to 'editor/events.cpp')
-rw-r--r--editor/events.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/editor/events.cpp b/editor/events.cpp
index 513f71c6..58330433 100644
--- a/editor/events.cpp
+++ b/editor/events.cpp
@@ -89,10 +89,16 @@ void app::on_key_up_down(const floormat::key_event& event, bool is_down) noexcep
case SDLK_ESCAPE: return key::quit;
});
if (x != key::COUNT)
+ {
keys[x] = is_down;
+ keys_repeat[x] = is_down ? event.is_repeated : false;
+ }
}
else
+ {
keys = {};
+ keys_repeat = {};
+ }
}
void app::on_text_input_event(const floormat::text_input_event& event) noexcept
@@ -101,7 +107,10 @@ void app::on_text_input_event(const floormat::text_input_event& event) noexcept
accessor(Containers::StringView, text)
} e = {event.text};
if (_imgui.handleTextInputEvent(e))
+ {
keys = {};
+ keys_repeat = {};
+ }
}
void app::on_viewport_event(const Math::Vector2<int>& size) noexcept
@@ -113,6 +122,7 @@ void app::on_focus_out() noexcept
{
update_cursor_tile(std::nullopt);
keys = {};
+ keys_repeat = {};
}
void app::on_mouse_leave() noexcept