diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/app.hpp | 1 | ||||
-rw-r--r-- | editor/events.cpp | 1 | ||||
-rw-r--r-- | editor/imgui.cpp | 9 | ||||
-rw-r--r-- | editor/keys.hpp | 1 | ||||
-rw-r--r-- | editor/update.cpp | 2 |
5 files changed, 14 insertions, 0 deletions
diff --git a/editor/app.hpp b/editor/app.hpp index d12a7001..ff98ce99 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -91,6 +91,7 @@ private: void do_quicksave(); void do_quickload(); void do_new_file(); + void do_escape(); void draw_collision_boxes(); void draw_editor_pane(float main_menu_height); diff --git a/editor/events.cpp b/editor/events.cpp index bec91890..f8c90ed7 100644 --- a/editor/events.cpp +++ b/editor/events.cpp @@ -128,6 +128,7 @@ auto app::resolve_keybinding(int k_, int mods_) const -> std::tuple<key, int> case SDLK_F9: return { key_quickload, mods }; case SDLK_q | CTRL: return { key_quit, mods }; case SDLK_n | CTRL: return { key_new_file, mods }; + case SDLK_ESCAPE: return { key_escape, mods }; } } } diff --git a/editor/imgui.cpp b/editor/imgui.cpp index 1e7f8d4e..62479aaa 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -185,4 +185,13 @@ void app::draw_editor_pane(float main_menu_height) } } +void app::do_escape() +{ + if (auto* ed = _editor.current_scenery_editor()) + ed->clear_selection(); + if (auto* ed = _editor.current_tile_editor()) + ed->clear_selection(); + ImGui::FocusWindow(nullptr); +} + } // namespace floormat diff --git a/editor/keys.hpp b/editor/keys.hpp index eb1ed7db..eb7158ec 100644 --- a/editor/keys.hpp +++ b/editor/keys.hpp @@ -21,6 +21,7 @@ enum key : unsigned { key_new_file, key_quit, key_quicksave, key_quickload, + key_escape, key_COUNT, key_MIN = key_noop, }; diff --git a/editor/update.cpp b/editor/update.cpp index 115e58b9..afc3b6cc 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -134,6 +134,8 @@ void app::do_key(key k, int mods) return do_quickload(); case key_new_file: return do_new_file(); + case key_escape: + return do_escape(); case key_quit: return M->quit(0); } |