diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/app.hpp | 2 | ||||
-rw-r--r-- | editor/events.cpp | 4 | ||||
-rw-r--r-- | editor/imgui.cpp | 6 | ||||
-rw-r--r-- | editor/update.cpp | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/editor/app.hpp b/editor/app.hpp index 1be252ba..32d6ce56 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -152,7 +152,7 @@ private: void render_menu(); using key_set = enum_bitset<key, key_COUNT>; - void do_key(key k, int mods); + void do_key(key k, int mods, int keycode); void do_key(key k); void do_set_mode(editor_mode mode); void do_rotate(bool backward); diff --git a/editor/events.cpp b/editor/events.cpp index d559022c..1a259d0e 100644 --- a/editor/events.cpp +++ b/editor/events.cpp @@ -209,7 +209,7 @@ void app::on_key_up_down(const key_event& event, bool is_down) noexcept (x == key_COUNT || x == key_escape) && _editor->mode() == editor_mode::tests && tests_handle_key(event, is_down)) clear_non_global_keys(); else if (x >= key_NO_REPEAT) - is_down && !event.is_repeated ? do_key(x, mods) : void(); + is_down && !event.is_repeated ? do_key(x, mods, event.key & ~SDLK_SCANCODE_MASK) : void(); else { (*keys_)[x] = is_down; @@ -244,7 +244,7 @@ void app::on_mouse_leave() noexcept void app::do_key(key k) { - do_key(k, get_key_modifiers()); + do_key(k, get_key_modifiers(), 0); } int app::get_key_modifiers() diff --git a/editor/imgui.cpp b/editor/imgui.cpp index 9f43eda1..f35f6329 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -58,11 +58,11 @@ float app::draw_main_menu() ImGui::Separator(); ImGui::MenuItem("Quit", "Ctrl+Q", &do_quit); if (do_new) - do_key(key_new_file, kmod_none); + do_key(key_new_file); else if (do_quickload) - do_key(key_quickload, kmod_none); + do_key(key_quickload); else if (do_quit) - do_key(key_quit, kmod_none); + do_key(key_quit); } if (auto b = begin_menu("Editor")) { diff --git a/editor/update.cpp b/editor/update.cpp index d90023b7..0fe064c0 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -169,14 +169,14 @@ void app::do_escape() kill_popups(false); } -void app::do_key(key k, int mods) +void app::do_key(key k, int mods, int keycode) { (void)mods; switch (k) { default: if (k >= key_NO_REPEAT) - fm_warn("unhandled key: '%zu'", size_t(k)); + fm_warn("unhandled key: '%d'", keycode); return; case key_noop: return; @@ -222,7 +222,7 @@ void app::apply_commands(const key_set& keys) using value_type = key_set::value_type; for (value_type i = key_MIN; i < key_NO_REPEAT; i++) if (const auto k = key(i); keys[k]) - do_key(k, key_modifiers.data[i]); + do_key(k, key_modifiers.data[i], 0); } void app::update_world(Ns dt) |