mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 20:15:32 +00:00
FullscreenUI: Improve look of slider popups
This commit is contained in:
parent
ddf906f377
commit
7aa831c8df
@ -97,6 +97,7 @@ using ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING;
|
|||||||
using ImGuiFullscreen::LAYOUT_SCREEN_HEIGHT;
|
using ImGuiFullscreen::LAYOUT_SCREEN_HEIGHT;
|
||||||
using ImGuiFullscreen::LAYOUT_SCREEN_WIDTH;
|
using ImGuiFullscreen::LAYOUT_SCREEN_WIDTH;
|
||||||
using ImGuiFullscreen::LAYOUT_SMALL_POPUP_PADDING;
|
using ImGuiFullscreen::LAYOUT_SMALL_POPUP_PADDING;
|
||||||
|
using ImGuiFullscreen::LAYOUT_WIDGET_FRAME_ROUNDING;
|
||||||
using ImGuiFullscreen::UIStyle;
|
using ImGuiFullscreen::UIStyle;
|
||||||
|
|
||||||
using ImGuiFullscreen::AddNotification;
|
using ImGuiFullscreen::AddNotification;
|
||||||
@ -2940,6 +2941,9 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, std::string_view
|
|||||||
|
|
||||||
BeginMenuButtons();
|
BeginMenuButtons();
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetCurrentWindow()->WorkRect.GetWidth());
|
ImGui::SetNextItemWidth(ImGui::GetCurrentWindow()->WorkRect.GetWidth());
|
||||||
s32 dlg_value = static_cast<s32>(value.value_or(default_value));
|
s32 dlg_value = static_cast<s32>(value.value_or(default_value));
|
||||||
if (ImGui::SliderInt("##value", &dlg_value, min_value, max_value, format, ImGuiSliderFlags_NoInput))
|
if (ImGui::SliderInt("##value", &dlg_value, min_value, max_value, format, ImGuiSliderFlags_NoInput))
|
||||||
@ -2952,6 +2956,8 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, std::string_view
|
|||||||
SetSettingsChanged(bsi);
|
SetSettingsChanged(bsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||||
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||||
ImVec2(0.5f, 0.0f)))
|
ImVec2(0.5f, 0.0f)))
|
||||||
@ -2986,6 +2992,9 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, std::string_vie
|
|||||||
|
|
||||||
BeginMenuButtons();
|
BeginMenuButtons();
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||||
ImGui::SetNextItemWidth(end);
|
ImGui::SetNextItemWidth(end);
|
||||||
float dlg_value = value.value_or(default_value) * multiplier;
|
float dlg_value = value.value_or(default_value) * multiplier;
|
||||||
@ -3002,6 +3011,8 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, std::string_vie
|
|||||||
SetSettingsChanged(bsi);
|
SetSettingsChanged(bsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||||
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||||
ImVec2(0.5f, 0.0f)))
|
ImVec2(0.5f, 0.0f)))
|
||||||
@ -3059,12 +3070,17 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, std::string_v
|
|||||||
((tmp_value.value() - std::floor(tmp_value.value())) < 0.01f) ? "%.0f" : "%f", tmp_value.value());
|
((tmp_value.value() - std::floor(tmp_value.value())) < 0.01f) ? "%.0f" : "%f", tmp_value.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
||||||
{
|
{
|
||||||
dlg_value = StringUtil::FromChars<float>(str_value).value_or(dlg_value);
|
dlg_value = StringUtil::FromChars<float>(str_value).value_or(dlg_value);
|
||||||
dlg_value_changed = true;
|
dlg_value_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3172,6 +3188,9 @@ bool FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, std::string_view t
|
|||||||
|
|
||||||
BeginMenuButtons();
|
BeginMenuButtons();
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
const float midpoint = LayoutScale(150.0f);
|
const float midpoint = LayoutScale(150.0f);
|
||||||
const float end = (ImGui::GetCurrentWindow()->WorkRect.GetWidth() - midpoint) + ImGui::GetStyle().WindowPadding.x;
|
const float end = (ImGui::GetCurrentWindow()->WorkRect.GetWidth() - midpoint) + ImGui::GetStyle().WindowPadding.x;
|
||||||
ImGui::TextUnformatted("Left: ");
|
ImGui::TextUnformatted("Left: ");
|
||||||
@ -3231,6 +3250,8 @@ bool FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, std::string_view t
|
|||||||
if (changed)
|
if (changed)
|
||||||
SetSettingsChanged(bsi);
|
SetSettingsChanged(bsi);
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
if (MenuButtonWithoutSummary(FSUI_VSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||||
ImVec2(0.5f, 0.0f)))
|
ImVec2(0.5f, 0.0f)))
|
||||||
{
|
{
|
||||||
@ -3285,6 +3306,9 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, std::string_vie
|
|||||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||||
ImGui::SetNextItemWidth(end);
|
ImGui::SetNextItemWidth(end);
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
std::snprintf(str_value, std::size(str_value), "%d", dlg_value);
|
std::snprintf(str_value, std::size(str_value), "%d", dlg_value);
|
||||||
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
||||||
{
|
{
|
||||||
@ -3292,6 +3316,8 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, std::string_vie
|
|||||||
dlg_value_changed = true;
|
dlg_value_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6391,7 +6417,7 @@ void FullscreenUI::DrawAchievementsLoginWindow()
|
|||||||
|
|
||||||
BeginMenuButtons();
|
BeginMenuButtons();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, DarkerColor(ImGui::GetStyle().Colors[ImGuiCol_Text]));
|
ImGui::PushStyleColor(ImGuiCol_Text, DarkerColor(ImGui::GetStyle().Colors[ImGuiCol_Text]));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(20.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
if (!login_error)
|
if (!login_error)
|
||||||
|
@ -1926,8 +1926,13 @@ bool ImGuiFullscreen::RangeButton(std::string_view title, std::string_view summa
|
|||||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||||
ImGui::SetNextItemWidth(end);
|
ImGui::SetNextItemWidth(end);
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
changed = ImGui::SliderInt("##value", value, min, max, format, ImGuiSliderFlags_NoInput);
|
changed = ImGui::SliderInt("##value", value, min, max, format, ImGuiSliderFlags_NoInput);
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||||
if (MenuButtonWithoutSummary(ok_text, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
if (MenuButtonWithoutSummary(ok_text, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||||
ImVec2(0.5f, 0.0f)))
|
ImVec2(0.5f, 0.0f)))
|
||||||
@ -1987,8 +1992,13 @@ bool ImGuiFullscreen::RangeButton(std::string_view title, std::string_view summa
|
|||||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||||
ImGui::SetNextItemWidth(end);
|
ImGui::SetNextItemWidth(end);
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(LAYOUT_WIDGET_FRAME_ROUNDING));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||||
|
|
||||||
changed = ImGui::SliderFloat("##value", value, min, max, format, ImGuiSliderFlags_NoInput);
|
changed = ImGui::SliderFloat("##value", value, min, max, format, ImGuiSliderFlags_NoInput);
|
||||||
|
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
if (MenuButtonWithoutSummary(ok_text, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
if (MenuButtonWithoutSummary(ok_text, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||||
ImVec2(0.5f, 0.0f)))
|
ImVec2(0.5f, 0.0f)))
|
||||||
{
|
{
|
||||||
@ -2285,7 +2295,7 @@ bool ImGuiFullscreen::BeginHorizontalMenu(const char* name, const ImVec2& positi
|
|||||||
|
|
||||||
const float item_padding = LayoutScale(LAYOUT_HORIZONTAL_MENU_PADDING);
|
const float item_padding = LayoutScale(LAYOUT_HORIZONTAL_MENU_PADDING);
|
||||||
const float item_width = LayoutScale(LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH);
|
const float item_width = LayoutScale(LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH);
|
||||||
const float item_spacing = LayoutScale(30.0f);
|
const float item_spacing = LayoutScale(40.0f);
|
||||||
const float menu_width = static_cast<float>(num_items) * (item_width + item_spacing) - item_spacing;
|
const float menu_width = static_cast<float>(num_items) * (item_width + item_spacing) - item_spacing;
|
||||||
const float menu_height = LayoutScale(LAYOUT_HORIZONTAL_MENU_HEIGHT);
|
const float menu_height = LayoutScale(LAYOUT_HORIZONTAL_MENU_HEIGHT);
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ static constexpr float LAYOUT_SHADOW_OFFSET = 1.0f;
|
|||||||
static constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f;
|
static constexpr float LAYOUT_SMALL_POPUP_PADDING = 20.0f;
|
||||||
static constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f;
|
static constexpr float LAYOUT_LARGE_POPUP_PADDING = 30.0f;
|
||||||
static constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f;
|
static constexpr float LAYOUT_LARGE_POPUP_ROUNDING = 40.0f;
|
||||||
|
static constexpr float LAYOUT_WIDGET_FRAME_ROUNDING = 20.0f;
|
||||||
|
|
||||||
struct ALIGN_TO_CACHE_LINE UIStyles
|
struct ALIGN_TO_CACHE_LINE UIStyles
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user