FullscreenUI: Add horizontal padding to menu windows
This commit is contained in:
parent
69e0c1681c
commit
37a76a020a
|
@ -2179,8 +2179,8 @@ void Achievements::DrawAchievementsWindow()
|
||||||
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
|
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
|
||||||
|
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "achievements_heading", heading_background, 0.0f,
|
ImVec2(), ImVec2(display_size.x, heading_height), "achievements_heading", heading_background, 0.0f, ImVec2(),
|
||||||
0.0f, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||||
{
|
{
|
||||||
ImRect bb;
|
ImRect bb;
|
||||||
bool visible, hovered;
|
bool visible, hovered;
|
||||||
|
@ -2289,7 +2289,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] = {
|
||||||
|
@ -2563,8 +2563,8 @@ void Achievements::DrawLeaderboardsWindow()
|
||||||
const float column_spacing = spacing * 2.0f;
|
const float column_spacing = spacing * 2.0f;
|
||||||
|
|
||||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||||
ImVec2(0.0f, 0.0f), ImVec2(display_size.x, heading_height), "leaderboards_heading", heading_background, 0.0f,
|
ImVec2(), ImVec2(display_size.x, heading_height), "leaderboards_heading", heading_background, 0.0f, ImVec2(),
|
||||||
0.0f, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollWithMouse))
|
||||||
{
|
{
|
||||||
bool visible, hovered;
|
bool visible, hovered;
|
||||||
bool pressed = ImGuiFullscreen::MenuButtonFrame("leaderboards_heading", false, heading_height_unscaled, &visible,
|
bool pressed = ImGuiFullscreen::MenuButtonFrame("leaderboards_heading", false, heading_height_unscaled, &visible,
|
||||||
|
@ -2754,7 +2754,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();
|
||||||
|
|
||||||
|
@ -2774,7 +2774,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();
|
||||||
|
|
||||||
|
|
|
@ -2926,7 +2926,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();
|
||||||
|
|
||||||
|
@ -5239,8 +5240,8 @@ void FullscreenUI::DrawPauseMenu()
|
||||||
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(window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 10.0f,
|
if (BeginFullscreenWindow(window_pos, window_size, "pause_menu", ImVec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f,
|
||||||
ImGuiWindowFlags_NoBackground))
|
ImVec2(10.0f, 10.0f), ImGuiWindowFlags_NoBackground))
|
||||||
{
|
{
|
||||||
static constexpr u32 submenu_item_count[] = {
|
static constexpr u32 submenu_item_count[] = {
|
||||||
12, // None
|
12, // None
|
||||||
|
@ -6613,7 +6614,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;
|
||||||
|
|
|
@ -703,7 +703,7 @@ 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) */,
|
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */,
|
||||||
float rounding /*= 0.0f*/, float padding /*= 0.0f*/,
|
float rounding /*= 0.0f*/, const ImVec2& padding /*= 0.0f*/,
|
||||||
ImGuiWindowFlags flags /*= 0*/)
|
ImGuiWindowFlags flags /*= 0*/)
|
||||||
{
|
{
|
||||||
if (left < 0.0f)
|
if (left < 0.0f)
|
||||||
|
@ -718,14 +718,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) */,
|
const ImVec4& background /* = HEX_TO_IMVEC4(0x212121, 0xFF) */,
|
||||||
float rounding /*= 0.0f*/, float padding /*= 0.0f*/,
|
float rounding /*= 0.0f*/, const ImVec2& padding /*= 0.0f*/,
|
||||||
ImGuiWindowFlags flags /*= 0*/)
|
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));
|
||||||
|
|
||||||
|
@ -1945,7 +1945,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));
|
||||||
|
|
|
@ -35,6 +35,7 @@ static constexpr float LAYOUT_MENU_BUTTON_HEIGHT = 50.0f;
|
||||||
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;
|
||||||
|
@ -162,10 +163,10 @@ 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,
|
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f,
|
||||||
float padding = 0.0f, ImGuiWindowFlags flags = 0);
|
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,
|
const ImVec4& background = HEX_TO_IMVEC4(0x212121, 0xFF), float rounding = 0.0f,
|
||||||
float padding = 0.0f, ImGuiWindowFlags flags = 0);
|
const ImVec2& padding = ImVec2(), ImGuiWindowFlags flags = 0);
|
||||||
void EndFullscreenWindow();
|
void EndFullscreenWindow();
|
||||||
|
|
||||||
bool IsGamepadInputSource();
|
bool IsGamepadInputSource();
|
||||||
|
|
Loading…
Reference in New Issue