[nostalgia/core/studio] Add key binding to for switching tools in TileSheetEditor

This commit is contained in:
Gary Talent 2022-07-30 14:45:17 -05:00
parent 275e9dbff1
commit c8dc14dd8e

View File

@ -90,7 +90,15 @@ void TileSheetEditorImGui::keyStateChanged(core::Key key, bool down) {
auto pal = model()->pal(); auto pal = model()->pal();
if (pal) { if (pal) {
const auto colorCnt = pal->colors.size(); const auto colorCnt = pal->colors.size();
if (key >= core::Key::Num_1 && key <= core::Key::Num_0 + colorCnt) { if (key == core::Key::Alpha_D) {
m_tool = Tool::Draw;
model()->clearSelection();
} else if (key == core::Key::Alpha_S) {
m_tool = Tool::Select;
} else if (key == core::Key::Alpha_F) {
m_tool = Tool::Fill;
model()->clearSelection();
} else if (key >= core::Key::Num_1 && key <= core::Key::Num_9 && key <= core::Key::Num_0 + colorCnt) {
auto idx = ox::min<std::size_t>(static_cast<uint32_t>(key - core::Key::Num_1), colorCnt - 1); auto idx = ox::min<std::size_t>(static_cast<uint32_t>(key - core::Key::Num_1), colorCnt - 1);
m_tileSheetEditor.setPalIdx(idx); m_tileSheetEditor.setPalIdx(idx);
} else if (key == core::Key::Num_0 && colorCnt >= 10) { } else if (key == core::Key::Num_0 && colorCnt >= 10) {