MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DrawPauseMenu

Method DrawPauseMenu

pcsx2/ImGui/FullscreenUI.cpp:1553–1869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1551}
1552
1553void FullscreenUI::DrawPauseMenu(MainWindowType type)
1554{
1555 ImDrawList* dl = ImGui::GetBackgroundDrawList();
1556 const ImVec2 display_size(ImGui::GetIO().DisplaySize);
1557 const ImU32 text_color = IM_COL32(UIBackgroundTextColor.x * 255, UIBackgroundTextColor.y * 255, UIBackgroundTextColor.z * 255, 255);
1558 dl->AddRectFilled(
1559 ImVec2(0.0f, 0.0f), display_size, IM_COL32(UIBackgroundColor.x * 255, UIBackgroundColor.y * 255, UIBackgroundColor.z * 255, 200));
1560
1561 // title info
1562 {
1563 const float image_width = 60.0f;
1564 const float image_height = 90.0f;
1565 const std::string_view path_string(Path::GetFileName(s_current_disc_path));
1566 const ImVec2 title_size(
1567 g_large_font.first->CalcTextSizeA(g_large_font.second, std::numeric_limits<float>::max(), -1.0f, s_current_game_title.c_str()));
1568 const ImVec2 path_size(path_string.empty() ?
1569 ImVec2(0.0f, 0.0f) :
1570 g_medium_font.first->CalcTextSizeA(g_medium_font.second, std::numeric_limits<float>::max(), -1.0f,
1571 path_string.data(), path_string.data() + path_string.length()));
1572 const ImVec2 subtitle_size(g_medium_font.first->CalcTextSizeA(
1573 g_medium_font.second, std::numeric_limits<float>::max(), -1.0f, s_current_game_subtitle.c_str()));
1574
1575 ImVec2 title_pos(display_size.x - LayoutScale(10.0f + image_width + 20.0f) - title_size.x,
1576 display_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT) - LayoutScale(10.0f + image_height));
1577 ImVec2 path_pos(display_size.x - LayoutScale(10.0f + image_width + 20.0f) - path_size.x,
1578 title_pos.y + g_large_font.second + LayoutScale(4.0f));
1579 ImVec2 subtitle_pos(display_size.x - LayoutScale(10.0f + image_width + 20.0f) - subtitle_size.x,
1580 (path_string.empty() ? title_pos.y + g_large_font.second : path_pos.y + g_medium_font.second) + LayoutScale(4.0f));
1581
1582 float rp_height = 0.0f;
1583 {
1584 const auto lock = Achievements::GetLock();
1585 const std::string& rp = Achievements::IsActive() ? Achievements::GetRichPresenceString() : std::string();
1586
1587 if (!rp.empty())
1588 {
1589 const float wrap_width = LayoutScale(350.0f);
1590 const ImVec2 rp_size = g_medium_font.first->CalcTextSizeA(
1591 g_medium_font.second, std::numeric_limits<float>::max(), wrap_width, rp.data(), rp.data() + rp.length());
1592
1593 // Add a small extra gap if any Rich Presence is displayed
1594 rp_height = rp_size.y - g_medium_font.second + LayoutScale(2.0f);
1595
1596 const ImVec2 rp_pos(display_size.x - LayoutScale(20.0f + 50.0f + 20.0f) - rp_size.x,
1597 subtitle_pos.y + g_medium_font.second + LayoutScale(4.0f) - rp_height);
1598
1599 title_pos.y -= rp_height;
1600 path_pos.y -= rp_height;
1601 subtitle_pos.y -= rp_height;
1602
1603 DrawShadowedText(dl, g_medium_font, rp_pos, text_color, rp.data(), rp.data() + rp.length(), wrap_width);
1604 }
1605 }
1606
1607 DrawShadowedText(dl, g_large_font, title_pos, text_color, s_current_game_title.c_str());
1608 if (!path_string.empty())
1609 {
1610 DrawShadowedText(dl, g_medium_font, path_pos, text_color, path_string.data(), path_string.data() + path_string.length());

Callers

nothing calls this directly

Calls 15

LayoutScaleFunction · 0.85
DrawShadowedTextFunction · 0.85
ImVec4Class · 0.85
GetFocusIDFunction · 0.85
GetCurrentWindowFunction · 0.85
GSQueueSnapshotFunction · 0.85
GSIsHardwareRendererFunction · 0.85
AddRectFilledMethod · 0.80
CalcTextSizeAMethod · 0.80
confirmMethod · 0.80
ImVec2Class · 0.70
maxFunction · 0.50

Tested by

no test coverage detected