[nostalgia/core/studio] Add key shortcuts for changing the selected color
This commit is contained in:
parent
1edd72dc7d
commit
5c5f8e748a
@ -55,6 +55,20 @@ void TileSheetEditorImGui::paste() {
|
|||||||
model()->paste();
|
model()->paste();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileSheetEditorImGui::keyStateChanged(core::Key key, bool down) {
|
||||||
|
if (!down) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto colorCnt = model()->pal().colors.size();
|
||||||
|
if (key >= core::Key::Num_1 && key <= core::Key::Num_0 + colorCnt) {
|
||||||
|
auto idx = ox::min<std::size_t>(key - core::Key::Num_1, colorCnt - 1);
|
||||||
|
m_tileSheetEditor.setPalIdx(idx);
|
||||||
|
} else if (key == core::Key::Num_0 && colorCnt >= 10) {
|
||||||
|
auto idx = ox::min<std::size_t>(key - core::Key::Num_1 + 9, colorCnt - 1);
|
||||||
|
m_tileSheetEditor.setPalIdx(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TileSheetEditorImGui::draw(core::Context*) noexcept {
|
void TileSheetEditorImGui::draw(core::Context*) noexcept {
|
||||||
const auto paneSize = ImGui::GetContentRegionAvail();
|
const auto paneSize = ImGui::GetContentRegionAvail();
|
||||||
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
||||||
|
@ -70,6 +70,8 @@ class TileSheetEditorImGui: public studio::BaseEditor {
|
|||||||
|
|
||||||
void paste() override;
|
void paste() override;
|
||||||
|
|
||||||
|
void keyStateChanged(core::Key key, bool down) override;
|
||||||
|
|
||||||
void draw(core::Context*) noexcept override;
|
void draw(core::Context*) noexcept override;
|
||||||
|
|
||||||
void drawSubsheetSelector(TileSheet::SubSheet*, TileSheet::SubSheetIdx *path) noexcept;
|
void drawSubsheetSelector(TileSheet::SubSheet*, TileSheet::SubSheetIdx *path) noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user