Skip to content

Commit

Permalink
OSD/Savestate: Add close menu hint to the selector
Browse files Browse the repository at this point in the history
Don't you hate it when you come up with more ideas just minutes AFTER the PR has been merged?
  • Loading branch information
kamfretoz authored and F0bes committed Oct 5, 2024
1 parent 5f0bc72 commit a304959
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pcsx2/ImGui/ImGuiOverlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ namespace SaveStateSelectorUI
static std::string s_save_legend;
static std::string s_prev_legend;
static std::string s_next_legend;
static std::string s_close_legend;

static std::array<ListEntry, VMManager::NUM_SAVE_STATE_SLOTS> s_slots;
static std::atomic_int32_t s_current_slot{0};
Expand Down Expand Up @@ -812,6 +813,7 @@ void SaveStateSelectorUI::Close()
s_save_legend = {};
s_prev_legend = {};
s_next_legend = {};
s_close_legend = {};
}

void SaveStateSelectorUI::RefreshList(const std::string& serial, u32 crc)
Expand Down Expand Up @@ -873,6 +875,8 @@ void SaveStateSelectorUI::RefreshHotkeyLegend()
TRANSLATE_STR("ImGuiOverlays", "Select Previous"));
s_next_legend = format_legend_entry(Host::GetSmallStringSettingValue("Hotkeys", "NextSaveStateSlot"),
TRANSLATE_STR("ImGuiOverlays", "Select Next"));
s_close_legend = format_legend_entry(Host::GetSmallStringSettingValue("Hotkeys", "OpenPauseMenu"),
TRANSLATE_STR("ImGuiOverlays", "Close Menu"));
}

void SaveStateSelectorUI::SelectNextSlot(bool open_selector)
Expand Down Expand Up @@ -960,9 +964,9 @@ void SaveStateSelectorUI::Draw()
const auto& io = ImGui::GetIO();
const float scale = ImGuiManager::GetGlobalScale();
const float width = (600.0f * scale);
const float height = (420.0f * scale);
const float height = (430.0f * scale);

const float padding_and_rounding = 15.0f * scale;
const float padding_and_rounding = 10.0f * scale;
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, padding_and_rounding);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(padding_and_rounding, padding_and_rounding));
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.11f, 0.15f, 0.17f, 0.8f));
Expand All @@ -975,7 +979,7 @@ void SaveStateSelectorUI::Draw()
ImGuiWindowFlags_NoScrollbar))
{
// Leave 2 lines for the legend
const float legend_margin = ImGui::GetFontSize() * 2.0f + ImGui::GetStyle().ItemSpacing.y * 3.0f;
const float legend_margin = ImGui::GetFontSize() * 3.0f + ImGui::GetStyle().ItemSpacing.y * 3.0f;
const float padding = 10.0f * scale;

ImGui::BeginChild("##item_list", ImVec2(0, -legend_margin), false,
Expand Down Expand Up @@ -1069,6 +1073,8 @@ void SaveStateSelectorUI::Draw()
ImGui::TextUnformatted(s_save_legend.c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(s_next_legend.c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(s_close_legend.c_str());

ImGui::EndTable();
}
Expand Down

0 comments on commit a304959

Please sign in to comment.