mirror of https://github.com/PCSX2/pcsx2.git
FullscreenUI: Add horizontal padding to menu windows
Backport of 37a76a020a
This commit is contained in:
parent
4b1a4fdbb9
commit
4d67f71217
|
@ -618,7 +618,7 @@ uint32_t Achievements::ClientReadMemory(uint32_t address, uint8_t* buffer, uint3
|
|||
// Fast paths for known data sizes.
|
||||
switch (num_bytes)
|
||||
{
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
case 1: std::memcpy(buffer, ptr, 1); break;
|
||||
case 2: std::memcpy(buffer, ptr, 2); break;
|
||||
case 4: std::memcpy(buffer, ptr, 4); break;
|
||||
|
@ -2163,7 +2163,7 @@ void Achievements::DrawAchievementsWindow()
|
|||
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
|
||||
|
||||
if (ImGuiFullscreen::BeginFullscreenWindow(ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "achievements_heading",
|
||||
heading_background, 0.0f, 0.0f, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||
heading_background, 0.0f, ImVec2(), ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||
{
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
|
@ -2267,7 +2267,7 @@ void Achievements::DrawAchievementsWindow()
|
|||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||
ImVec2(0.0f, heading_height),
|
||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_HEIGHT)),
|
||||
"achievements", background, 0.0f, 0.0f, 0))
|
||||
"achievements", background, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f), 0))
|
||||
{
|
||||
static bool buckets_collapsed[NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS] = {};
|
||||
static const char* bucket_names[NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS] = {
|
||||
|
@ -2339,7 +2339,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT + 30.0f) - points_template_size.x);
|
||||
const ImVec2 summary_text_size(g_medium_font->CalcTextSizeA(g_medium_font->FontSize, FLT_MAX, summary_wrap_width, cheevo->description,
|
||||
cheevo->description + summary_length));
|
||||
|
||||
|
||||
// Messy, but need to undo LayoutScale in MenuButtonFrame()...
|
||||
const float extra_summary_height = LayoutUnscale(std::max(summary_text_size.y - g_medium_font->FontSize, 0.0f));
|
||||
|
||||
|
@ -2522,8 +2522,9 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWW").x;
|
||||
const float column_spacing = spacing * 2.0f;
|
||||
|
||||
if (ImGuiFullscreen::BeginFullscreenWindow(ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "leaderboards_heading",
|
||||
heading_background, 0.0f, 0.0f, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||
if (ImGuiFullscreen::BeginFullscreenWindow(ImVec2(), ImVec2(display_size.x, heading_height), "leaderboards_heading",
|
||||
heading_background, 0.0f, ImVec2(),
|
||||
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||
{
|
||||
bool visible, hovered;
|
||||
ImGuiFullscreen::MenuButtonFrame(
|
||||
|
@ -2697,7 +2698,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||
ImVec2(0.0f, heading_height),
|
||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_HEIGHT)),
|
||||
"leaderboards", background, 0.0f, 0.0f, 0))
|
||||
"leaderboards", background, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f), 0))
|
||||
{
|
||||
ImGuiFullscreen::BeginMenuButtons();
|
||||
|
||||
|
@ -2717,7 +2718,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||
ImVec2(0.0f, heading_height),
|
||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_HEIGHT)),
|
||||
"leaderboard", background, 0.0f, 0.0f, 0))
|
||||
"leaderboard", background, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f), 0))
|
||||
{
|
||||
ImGuiFullscreen::BeginMenuButtons();
|
||||
|
||||
|
|
|
@ -2906,7 +2906,8 @@ void FullscreenUI::DrawSettingsWindow()
|
|||
ImVec2(0.0f, heading_size.y),
|
||||
ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT)),
|
||||
TinyString::from_format("settings_page_{}", static_cast<u32>(s_settings_page)).c_str(),
|
||||
ImVec4(UIBackgroundColor.x, UIBackgroundColor.y, UIBackgroundColor.z, bg_alpha)))
|
||||
ImVec4(UIBackgroundColor.x, UIBackgroundColor.y, UIBackgroundColor.z, bg_alpha), 0.0f,
|
||||
ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f)))
|
||||
{
|
||||
ResetFocusHere();
|
||||
|
||||
|
@ -5039,8 +5040,8 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
|
|||
const ImVec2 window_size(LayoutScale(500.0f, LAYOUT_SCREEN_HEIGHT));
|
||||
const ImVec2 window_pos(0.0f, display_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT) - window_size.y);
|
||||
|
||||
if (BeginFullscreenWindow(
|
||||
window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 10.0f, ImGuiWindowFlags_NoBackground))
|
||||
if (BeginFullscreenWindow(window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f,
|
||||
ImVec2(10.0f, 10.0f), ImGuiWindowFlags_NoBackground))
|
||||
{
|
||||
static constexpr u32 submenu_item_count[] = {
|
||||
11, // None
|
||||
|
@ -6310,7 +6311,7 @@ void FullscreenUI::DrawGameListSettingsWindow()
|
|||
if (!BeginFullscreenWindow(
|
||||
ImVec2(0.0f, heading_size.y),
|
||||
ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT)),
|
||||
"settings_parent", UIBackgroundColor))
|
||||
"settings_parent", UIBackgroundColor, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f)))
|
||||
{
|
||||
EndFullscreenWindow();
|
||||
return;
|
||||
|
|
|
@ -688,8 +688,8 @@ void ImGuiFullscreen::EndFullscreenColumnWindow()
|
|||
}
|
||||
|
||||
bool ImGuiFullscreen::BeginFullscreenWindow(float left, float top, float width, float height, const char* name,
|
||||
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/, float padding /*= 0.0f*/,
|
||||
ImGuiWindowFlags flags /*= 0*/)
|
||||
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/,
|
||||
const ImVec2& padding /*= 0.0f*/, ImGuiWindowFlags flags /*= 0*/)
|
||||
{
|
||||
if (left < 0.0f)
|
||||
left = (LAYOUT_SCREEN_WIDTH - width) * -left;
|
||||
|
@ -702,14 +702,14 @@ bool ImGuiFullscreen::BeginFullscreenWindow(float left, float top, float width,
|
|||
}
|
||||
|
||||
bool ImGuiFullscreen::BeginFullscreenWindow(const ImVec2& position, const ImVec2& size, const char* name,
|
||||
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/, float padding /*= 0.0f*/,
|
||||
ImGuiWindowFlags flags /*= 0*/)
|
||||
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/,
|
||||
const ImVec2& padding /*= 0.0f*/, ImGuiWindowFlags flags /*= 0*/)
|
||||
{
|
||||
ImGui::SetNextWindowPos(position);
|
||||
ImGui::SetNextWindowSize(size);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, background);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(padding, padding));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(padding));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(rounding));
|
||||
|
||||
|
@ -1740,7 +1740,7 @@ bool ImGuiFullscreen::BeginHorizontalMenu(const char* name, const ImVec2& positi
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(item_spacing, 0.0f));
|
||||
|
||||
if (!BeginFullscreenWindow(position, size, name, UIBackgroundColor, 0.0f, 0.0f))
|
||||
if (!BeginFullscreenWindow(position, size, name, UIBackgroundColor, 0.0f, ImVec2()))
|
||||
return false;
|
||||
|
||||
ImGui::SetCursorPos(ImVec2((size.x - menu_width) * 0.5f, (size.y - menu_height) * 0.5f));
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace ImGuiFullscreen
|
|||
static constexpr float LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY = 26.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_Y_PADDING = 10.0f;
|
||||
static constexpr float LAYOUT_MENU_WINDOW_X_PADDING = 12.0f;
|
||||
static constexpr float LAYOUT_FOOTER_PADDING = 10.0f;
|
||||
static constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.0f;
|
||||
static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
||||
|
@ -131,9 +132,11 @@ namespace ImGuiFullscreen
|
|||
void EndFullscreenColumnWindow();
|
||||
|
||||
bool BeginFullscreenWindow(float left, float top, float width, float height, const char* name,
|
||||
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f, float padding = 0.0f, ImGuiWindowFlags flags = 0);
|
||||
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f, const ImVec2& padding = ImVec2(),
|
||||
ImGuiWindowFlags flags = 0);
|
||||
bool BeginFullscreenWindow(const ImVec2& position, const ImVec2& size, const char* name,
|
||||
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f, float padding = 0.0f, ImGuiWindowFlags flags = 0);
|
||||
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f, const ImVec2& padding = ImVec2(),
|
||||
ImGuiWindowFlags flags = 0);
|
||||
void EndFullscreenWindow();
|
||||
|
||||
bool IsGamepadInputSource();
|
||||
|
|
Loading…
Reference in New Issue