[nostalgia/core/studio] Get Undo/Redo working

This commit is contained in:
2022-02-16 20:17:33 -06:00
parent c92ecdf499
commit 302dd23a36
6 changed files with 39 additions and 14 deletions

View File

@@ -56,6 +56,10 @@ void TileSheetEditorImGui::draw(core::Context*) noexcept {
ImGui::EndChild();
}
studio::UndoStack *TileSheetEditorImGui::undoStack() noexcept {
return m_tileSheetEditor.undoStack();
}
void TileSheetEditorImGui::saveItem() {
}
@@ -93,7 +97,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
const auto &winPos = ImGui::GetWindowPos();
clickPos.x -= winPos.x + 10;
clickPos.y -= winPos.y + 10;
m_tileSheetEditor.click(fbSize, clickPos, m_palIdx);
m_tileSheetEditor.click(fbSize, clickPos);
}
}
if (io.MouseReleased[0]) {
@@ -113,13 +117,13 @@ void TileSheetEditorImGui::drawPalettePicker() noexcept {
// Column: color idx
ImGui::TableNextColumn();
const auto label = ox::BString<8>() + (i + 1);
const auto rowSelected = i == m_palIdx;
const auto rowSelected = i == m_tileSheetEditor.palIdx();
if (ImGui::Selectable(label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
m_palIdx = i;
m_tileSheetEditor.setPalIdx(i);
}
// Column: color RGB
ImGui::TableNextColumn();
ImGui::Text("(%d, %d, %d)", red16(c), green16(c), blue16(c));
ImGui::Text("(%02d, %02d, %02d)", red16(c), green16(c), blue16(c));
ImGui::TableNextRow();
ImGui::PopID();
++i;