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
|
@ -2163,7 +2163,7 @@ void Achievements::DrawAchievementsWindow()
|
||||||
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
|
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",
|
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;
|
ImRect bb;
|
||||||
bool visible, hovered;
|
bool visible, hovered;
|
||||||
|
@ -2267,7 +2267,7 @@ void Achievements::DrawAchievementsWindow()
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, heading_height),
|
ImVec2(0.0f, heading_height),
|
||||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_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 bool buckets_collapsed[NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS] = {};
|
||||||
static const char* bucket_names[NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS] = {
|
static const char* bucket_names[NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS] = {
|
||||||
|
@ -2522,8 +2522,9 @@ void Achievements::DrawLeaderboardsWindow()
|
||||||
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWW").x;
|
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWW").x;
|
||||||
const float column_spacing = spacing * 2.0f;
|
const float column_spacing = spacing * 2.0f;
|
||||||
|
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "leaderboards_heading",
|
if (ImGuiFullscreen::BeginFullscreenWindow(ImVec2(), ImVec2(display_size.x, heading_height), "leaderboards_heading",
|
||||||
heading_background, 0.0f, 0.0f, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
heading_background, 0.0f, ImVec2(),
|
||||||
|
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||||
{
|
{
|
||||||
bool visible, hovered;
|
bool visible, hovered;
|
||||||
ImGuiFullscreen::MenuButtonFrame(
|
ImGuiFullscreen::MenuButtonFrame(
|
||||||
|
@ -2697,7 +2698,7 @@ void Achievements::DrawLeaderboardsWindow()
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, heading_height),
|
ImVec2(0.0f, heading_height),
|
||||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_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();
|
ImGuiFullscreen::BeginMenuButtons();
|
||||||
|
|
||||||
|
@ -2717,7 +2718,7 @@ void Achievements::DrawLeaderboardsWindow()
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, heading_height),
|
ImVec2(0.0f, heading_height),
|
||||||
ImVec2(display_size.x, display_size.y - heading_height - LayoutScale(ImGuiFullscreen::LAYOUT_FOOTER_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();
|
ImGuiFullscreen::BeginMenuButtons();
|
||||||
|
|
||||||
|
|
|
@ -2906,7 +2906,8 @@ void FullscreenUI::DrawSettingsWindow()
|
||||||
ImVec2(0.0f, heading_size.y),
|
ImVec2(0.0f, heading_size.y),
|
||||||
ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT)),
|
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(),
|
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();
|
ResetFocusHere();
|
||||||
|
|
||||||
|
@ -5039,8 +5040,8 @@ void FullscreenUI::DrawPauseMenu(MainWindowType type)
|
||||||
const ImVec2 window_size(LayoutScale(500.0f, LAYOUT_SCREEN_HEIGHT));
|
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);
|
const ImVec2 window_pos(0.0f, display_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT) - window_size.y);
|
||||||
|
|
||||||
if (BeginFullscreenWindow(
|
if (BeginFullscreenWindow(window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f,
|
||||||
window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 10.0f, ImGuiWindowFlags_NoBackground))
|
ImVec2(10.0f, 10.0f), ImGuiWindowFlags_NoBackground))
|
||||||
{
|
{
|
||||||
static constexpr u32 submenu_item_count[] = {
|
static constexpr u32 submenu_item_count[] = {
|
||||||
11, // None
|
11, // None
|
||||||
|
@ -6310,7 +6311,7 @@ void FullscreenUI::DrawGameListSettingsWindow()
|
||||||
if (!BeginFullscreenWindow(
|
if (!BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, heading_size.y),
|
ImVec2(0.0f, heading_size.y),
|
||||||
ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT)),
|
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();
|
EndFullscreenWindow();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -688,8 +688,8 @@ void ImGuiFullscreen::EndFullscreenColumnWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGuiFullscreen::BeginFullscreenWindow(float left, float top, float width, float height, const char* name,
|
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*/,
|
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/,
|
||||||
ImGuiWindowFlags flags /*= 0*/)
|
const ImVec2& padding /*= 0.0f*/, ImGuiWindowFlags flags /*= 0*/)
|
||||||
{
|
{
|
||||||
if (left < 0.0f)
|
if (left < 0.0f)
|
||||||
left = (LAYOUT_SCREEN_WIDTH - width) * -left;
|
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,
|
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*/,
|
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */, float rounding /*= 0.0f*/,
|
||||||
ImGuiWindowFlags flags /*= 0*/)
|
const ImVec2& padding /*= 0.0f*/, ImGuiWindowFlags flags /*= 0*/)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowPos(position);
|
ImGui::SetNextWindowPos(position);
|
||||||
ImGui::SetNextWindowSize(size);
|
ImGui::SetNextWindowSize(size);
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, background);
|
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_WindowBorderSize, 0.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(rounding));
|
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_FrameBorderSize, LayoutScale(1.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(item_spacing, 0.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;
|
return false;
|
||||||
|
|
||||||
ImGui::SetCursorPos(ImVec2((size.x - menu_width) * 0.5f, (size.y - menu_height) * 0.5f));
|
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_HEIGHT_NO_SUMMARY = 26.0f;
|
||||||
static constexpr float LAYOUT_MENU_BUTTON_X_PADDING = 15.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_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_PADDING = 10.0f;
|
||||||
static constexpr float LAYOUT_FOOTER_HEIGHT = LAYOUT_MEDIUM_FONT_SIZE + LAYOUT_FOOTER_PADDING * 2.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;
|
static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
||||||
|
@ -131,9 +132,11 @@ namespace ImGuiFullscreen
|
||||||
void EndFullscreenColumnWindow();
|
void EndFullscreenColumnWindow();
|
||||||
|
|
||||||
bool BeginFullscreenWindow(float left, float top, float width, float height, const char* name,
|
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,
|
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();
|
void EndFullscreenWindow();
|
||||||
|
|
||||||
bool IsGamepadInputSource();
|
bool IsGamepadInputSource();
|
||||||
|
|
Loading…
Reference in New Issue