Skip to content

Commit 486f08a

Browse files
committed
Adding up and down buttons to move the overlays around.
1 parent 67fd977 commit 486f08a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/gui/gui.cc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ bool PCSX::GUI::configure() {
719719
m_overlayLoadSizes.resize(overlays.size());
720720
int counter = 0;
721721
int overlayToRemove = -1;
722+
int swapMe = -1;
722723
for (auto& overlay : overlays) {
723724
std::string id = "overlay" + std::to_string(counter);
724725
ImGui::BeginChild(id.c_str(), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 7.0f), true);
@@ -760,13 +761,28 @@ bool PCSX::GUI::configure() {
760761
ImGui::SameLine();
761762
if (ImGui::Button(_("Remove"))) {
762763
overlayToRemove = counter;
763-
changed = true;
764+
}
765+
ImGui::SameLine();
766+
if (ImGui::Button(_("Move up"))) {
767+
swapMe = counter - 1;
768+
}
769+
ImGui::SameLine();
770+
if (ImGui::Button(_("Move down"))) {
771+
swapMe = counter;
764772
}
765773
ImGui::EndChild();
766774
counter++;
767775
}
768776
if (overlayToRemove >= 0) {
769777
overlays.erase(overlays.begin() + overlayToRemove);
778+
changed = true;
779+
}
780+
if ((swapMe >= 0) && (swapMe != (overlays.size() - 1))) {
781+
std::iter_swap(overlays.begin() + swapMe, overlays.begin() + swapMe + 1);
782+
std::iter_swap(m_overlayFileOffsets.begin() + swapMe, m_overlayFileOffsets.begin() + swapMe + 1);
783+
std::iter_swap(m_overlayLoadOffsets.begin() + swapMe, m_overlayLoadOffsets.begin() + swapMe + 1);
784+
std::iter_swap(m_overlayLoadSizes.begin() + swapMe, m_overlayLoadSizes.begin() + swapMe + 1);
785+
changed = true;
770786
}
771787
}
772788
}

0 commit comments

Comments
 (0)