From 58b7f813cc757ac41a4266caec231ac0760b6d03 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 18 Feb 2023 00:52:49 -0600 Subject: [PATCH] [nostalgia/core/studio] Make Edit Subsheet popup close on escape press --- src/nostalgia/core/studio/tilesheeteditor-imgui.cpp | 7 +++++++ src/nostalgia/core/studio/tilesheeteditor-imgui.hpp | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp index 395afd89..72971ed1 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.cpp @@ -87,6 +87,9 @@ void TileSheetEditorImGui::keyStateChanged(core::Key key, bool down) { if (!down) { return; } + if (key == core::Key::Escape) { + m_subsheetEditor.close(); + } auto pal = model()->pal(); if (pal) { const auto colorCnt = pal->colors.size(); @@ -427,4 +430,8 @@ void TileSheetEditorImGui::SubSheetEditor::draw() noexcept { } } +void TileSheetEditorImGui::SubSheetEditor::close() noexcept { + m_show = false; +} + } diff --git a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp index d770e7d6..b7631a64 100644 --- a/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp +++ b/src/nostalgia/core/studio/tilesheeteditor-imgui.hpp @@ -40,10 +40,11 @@ class TileSheetEditorImGui: public studio::BaseEditor { m_rows = rows; } void draw() noexcept; + void close() noexcept; }; std::size_t m_selectedPaletteIdx = 0; Context *m_ctx = nullptr; - ox::Vector m_paletteList{}; + ox::Vector m_paletteList; SubSheetEditor m_subsheetEditor; ox::String m_itemPath; ox::String m_itemName;