ImGuiFullscreen: Pack state in struct
This commit is contained in:
parent
5d7cb6c5dc
commit
53c08c52ed
|
@ -2153,8 +2153,8 @@ static float IndicatorOpacity(const T& i)
|
|||
|
||||
void Achievements::DrawGameOverlays()
|
||||
{
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
if (!HasActiveGame() || !g_settings.achievements_overlays)
|
||||
return;
|
||||
|
@ -2210,7 +2210,8 @@ void Achievements::DrawGameOverlays()
|
|||
|
||||
const char* text_start = s_state.active_progress_indicator->achievement->measured_progress;
|
||||
const char* text_end = text_start + std::strlen(text_start);
|
||||
const ImVec2 text_size = g_medium_font->CalcTextSizeA(g_medium_font->FontSize, FLT_MAX, 0.0f, text_start, text_end);
|
||||
const ImVec2 text_size =
|
||||
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, text_start, text_end);
|
||||
|
||||
const ImVec2 box_min = ImVec2(position.x - image_size.x - text_size.x - spacing - padding * 2.0f,
|
||||
position.y - image_size.y - padding * 2.0f);
|
||||
|
@ -2230,7 +2231,8 @@ void Achievements::DrawGameOverlays()
|
|||
const ImVec2 text_pos =
|
||||
box_min + ImVec2(padding + image_size.x + spacing, (box_max.y - box_min.y - text_size.y) * 0.5f);
|
||||
const ImVec4 text_clip_rect(text_pos.x, text_pos.y, box_max.x, box_max.y);
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, text_pos, col, text_start, text_end, 0.0f, &text_clip_rect);
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos, col, text_start, text_end, 0.0f,
|
||||
&text_clip_rect);
|
||||
|
||||
if (!indicator.active && opacity <= 0.01f)
|
||||
{
|
||||
|
@ -2252,8 +2254,8 @@ void Achievements::DrawGameOverlays()
|
|||
width_string.append(ICON_FA_STOPWATCH);
|
||||
for (u32 i = 0; i < indicator.text.length(); i++)
|
||||
width_string.append('0');
|
||||
const ImVec2 size = ImGuiFullscreen::g_medium_font->CalcTextSizeA(
|
||||
ImGuiFullscreen::g_medium_font->FontSize, FLT_MAX, 0.0f, width_string.c_str(), width_string.end_ptr());
|
||||
const ImVec2 size = ImGuiFullscreen::UIStyle.MediumFont->CalcTextSizeA(
|
||||
ImGuiFullscreen::UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, width_string.c_str(), width_string.end_ptr());
|
||||
|
||||
const ImVec2 box_min = ImVec2(position.x - size.x - padding * 2.0f, position.y - size.y - padding * 2.0f);
|
||||
const ImVec2 box_max = position;
|
||||
|
@ -2263,17 +2265,17 @@ void Achievements::DrawGameOverlays()
|
|||
dl->AddRect(box_min, box_max, ImGui::GetColorU32(ImVec4(0.8f, 0.8f, 0.8f, opacity)), box_rounding);
|
||||
|
||||
const u32 text_col = ImGui::GetColorU32(ImVec4(1.0f, 1.0f, 1.0f, opacity));
|
||||
const ImVec2 text_size = ImGuiFullscreen::g_medium_font->CalcTextSizeA(
|
||||
ImGuiFullscreen::g_medium_font->FontSize, FLT_MAX, 0.0f, indicator.text.c_str(),
|
||||
const ImVec2 text_size = ImGuiFullscreen::UIStyle.MediumFont->CalcTextSizeA(
|
||||
ImGuiFullscreen::UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, indicator.text.c_str(),
|
||||
indicator.text.c_str() + indicator.text.length());
|
||||
const ImVec2 text_pos = ImVec2(box_max.x - padding - text_size.x, box_min.y + padding);
|
||||
const ImVec4 text_clip_rect(box_min.x, box_min.y, box_max.x, box_max.y);
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, text_pos, text_col, indicator.text.c_str(),
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos, text_col, indicator.text.c_str(),
|
||||
indicator.text.c_str() + indicator.text.length(), 0.0f, &text_clip_rect);
|
||||
|
||||
const ImVec2 icon_pos = ImVec2(box_min.x + padding, box_min.y + padding);
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, icon_pos, text_col, ICON_FA_STOPWATCH, nullptr, 0.0f,
|
||||
&text_clip_rect);
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, icon_pos, text_col, ICON_FA_STOPWATCH, nullptr,
|
||||
0.0f, &text_clip_rect);
|
||||
|
||||
if (!indicator.active && opacity <= 0.01f)
|
||||
{
|
||||
|
@ -2297,9 +2299,8 @@ void Achievements::DrawGameOverlays()
|
|||
|
||||
void Achievements::DrawPauseMenuOverlays()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
if (!HasActiveGame())
|
||||
return;
|
||||
|
@ -2310,11 +2311,12 @@ void Achievements::DrawPauseMenuOverlays()
|
|||
return;
|
||||
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
ImFont* font = g_medium_font;
|
||||
ImFont* font = UIStyle.MediumFont;
|
||||
|
||||
const ImVec2 image_size(LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY));
|
||||
const float start_y = LayoutScale(10.0f + 4.0f + 4.0f) + g_large_font->FontSize + (g_medium_font->FontSize * 2.0f);
|
||||
const float start_y =
|
||||
LayoutScale(10.0f + 4.0f + 4.0f) + UIStyle.LargeFont->FontSize + (UIStyle.MediumFont->FontSize * 2.0f);
|
||||
const float margin = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
const float padding = LayoutScale(10.0f);
|
||||
|
@ -2398,9 +2400,8 @@ bool Achievements::PrepareAchievementsWindow()
|
|||
|
||||
void Achievements::DrawAchievementsWindow()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
if (!s_state.achievement_list)
|
||||
return;
|
||||
|
@ -2411,10 +2412,10 @@ void Achievements::DrawAchievementsWindow()
|
|||
static constexpr float heading_alpha = 0.95f;
|
||||
static constexpr float heading_height_unscaled = 110.0f;
|
||||
|
||||
const ImVec4 background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, alpha);
|
||||
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, heading_alpha);
|
||||
const ImVec4 background = ImGuiFullscreen::ModAlpha(UIStyle.BackgroundColor, alpha);
|
||||
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(UIStyle.BackgroundColor, heading_alpha);
|
||||
const ImVec2 display_size = ImGui::GetIO().DisplaySize;
|
||||
const float heading_height = ImGuiFullscreen::LayoutScale(heading_height_unscaled);
|
||||
const float heading_height = LayoutScale(heading_height_unscaled);
|
||||
bool close_window = false;
|
||||
|
||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||
|
@ -2427,9 +2428,9 @@ void Achievements::DrawAchievementsWindow()
|
|||
&bb.Min, &bb.Max, 0, heading_alpha);
|
||||
if (visible)
|
||||
{
|
||||
const float padding = ImGuiFullscreen::LayoutScale(10.0f);
|
||||
const float spacing = ImGuiFullscreen::LayoutScale(10.0f);
|
||||
const float image_height = ImGuiFullscreen::LayoutScale(85.0f);
|
||||
const float padding = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
const float image_height = LayoutScale(85.0f);
|
||||
|
||||
const ImVec2 icon_min(bb.Min + ImVec2(padding, padding));
|
||||
const ImVec2 icon_max(icon_min + ImVec2(image_height, image_height));
|
||||
|
@ -2452,23 +2453,23 @@ void Achievements::DrawAchievementsWindow()
|
|||
ImVec2 text_size;
|
||||
|
||||
close_window = (ImGuiFullscreen::FloatingButton(ICON_FA_WINDOW_CLOSE, 10.0f, 10.0f, -1.0f, -1.0f, 1.0f, 0.0f,
|
||||
true, g_large_font) ||
|
||||
true, UIStyle.LargeFont) ||
|
||||
ImGuiFullscreen::WantsToCloseMenu());
|
||||
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + g_large_font->FontSize));
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.LargeFont->FontSize));
|
||||
text.assign(s_state.game_title);
|
||||
|
||||
if (s_state.hardcore_mode)
|
||||
text.append(TRANSLATE_SV("Achievements", " (Hardcore Mode)"));
|
||||
|
||||
top += g_large_font->FontSize + spacing;
|
||||
top += UIStyle.LargeFont->FontSize + spacing;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, text.c_str(), text.end_ptr(), nullptr, ImVec2(0.0f, 0.0f),
|
||||
&title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font->FontSize));
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.MediumFont->FontSize));
|
||||
if (s_state.game_summary.num_core_achievements > 0)
|
||||
{
|
||||
if (s_state.game_summary.num_unlocked_achievements == s_state.game_summary.num_core_achievements)
|
||||
|
@ -2489,31 +2490,31 @@ void Achievements::DrawAchievementsWindow()
|
|||
text.assign(TRANSLATE_SV("Achievements", "This game has no achievements."));
|
||||
}
|
||||
|
||||
top += g_medium_font->FontSize + spacing;
|
||||
top += UIStyle.MediumFont->FontSize + spacing;
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, text.c_str(), text.end_ptr(), nullptr,
|
||||
ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (s_state.game_summary.num_core_achievements > 0)
|
||||
{
|
||||
const float progress_height = ImGuiFullscreen::LayoutScale(20.0f);
|
||||
const float progress_height = LayoutScale(20.0f);
|
||||
const ImRect progress_bb(ImVec2(left, top), ImVec2(right, top + progress_height));
|
||||
const float fraction = static_cast<float>(s_state.game_summary.num_unlocked_achievements) /
|
||||
static_cast<float>(s_state.game_summary.num_core_achievements);
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryDarkColor));
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(UIStyle.PrimaryDarkColor));
|
||||
dl->AddRectFilled(progress_bb.Min,
|
||||
ImVec2(progress_bb.Min.x + fraction * progress_bb.GetWidth(), progress_bb.Max.y),
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UISecondaryColor));
|
||||
ImGui::GetColorU32(UIStyle.SecondaryColor));
|
||||
|
||||
text.format("{}%", static_cast<int>(std::round(fraction * 100.0f)));
|
||||
text_size = ImGui::CalcTextSize(text.c_str(), text.end_ptr());
|
||||
const ImVec2 text_pos(
|
||||
progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
|
||||
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f));
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, text_pos,
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryTextColor), text.c_str(), text.end_ptr());
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos,
|
||||
ImGui::GetColorU32(UIStyle.PrimaryTextColor), text.c_str(), text.end_ptr());
|
||||
top += progress_height + spacing;
|
||||
}
|
||||
}
|
||||
|
@ -2587,10 +2588,9 @@ void Achievements::DrawAchievementsWindow()
|
|||
|
||||
void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::LayoutUnscale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
static constexpr float progress_height_unscaled = 20.0f;
|
||||
|
@ -2602,18 +2602,19 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
const std::string_view measured_progress(cheevo->measured_progress);
|
||||
const bool is_measured = !is_unlocked && !measured_progress.empty();
|
||||
const float unlock_size = is_unlocked ? (spacing + ImGuiFullscreen::LAYOUT_MEDIUM_FONT_SIZE) : 0.0f;
|
||||
const ImVec2 points_template_size(
|
||||
g_medium_font->CalcTextSizeA(g_medium_font->FontSize, FLT_MAX, 0.0f, TRANSLATE("Achievements", "XXX points")));
|
||||
const ImVec2 points_template_size(UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f,
|
||||
TRANSLATE("Achievements", "XXX points")));
|
||||
|
||||
const size_t summary_length = std::strlen(cheevo->description);
|
||||
const float summary_wrap_width =
|
||||
(ImGui::GetCurrentWindow()->WorkRect.GetWidth() - (ImGui::GetStyle().FramePadding.x * 2.0f) -
|
||||
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));
|
||||
const ImVec2 summary_text_size(UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->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));
|
||||
const float extra_summary_height = LayoutUnscale(std::max(summary_text_size.y - UIStyle.MediumFont->FontSize, 0.0f));
|
||||
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
|
@ -2653,10 +2654,10 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
|
||||
SmallString text;
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + spacing;
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + spacing;
|
||||
text = TRANSLATE_PLURAL_SSTR("Achievements", "%n points", "Achievement points", cheevo->points);
|
||||
const ImVec2 points_size(
|
||||
g_medium_font->CalcTextSizeA(g_medium_font->FontSize, FLT_MAX, 0.0f, text.c_str(), text.end_ptr()));
|
||||
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, FLT_MAX, 0.0f, text.c_str(), text.end_ptr()));
|
||||
const float points_template_start = bb.Max.x - points_template_size.x;
|
||||
const float points_start = points_template_start + ((points_template_size.x - points_size.x) * 0.5f);
|
||||
|
||||
|
@ -2682,23 +2683,24 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
break;
|
||||
}
|
||||
|
||||
const ImVec2 right_icon_size(g_large_font->CalcTextSizeA(g_large_font->FontSize, FLT_MAX, 0.0f, right_icon_text));
|
||||
const ImVec2 right_icon_size(
|
||||
UIStyle.LargeFont->CalcTextSizeA(UIStyle.LargeFont->FontSize, FLT_MAX, 0.0f, right_icon_text));
|
||||
|
||||
const float text_start_x = bb.Min.x + image_size.x + LayoutScale(15.0f);
|
||||
const ImRect title_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(points_start, midpoint));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint),
|
||||
ImVec2(points_start, midpoint + g_medium_font->FontSize + extra_summary_height));
|
||||
ImVec2(points_start, midpoint + UIStyle.MediumFont->FontSize + extra_summary_height));
|
||||
const ImRect points_bb(ImVec2(points_start, midpoint), bb.Max);
|
||||
const ImRect lock_bb(ImVec2(points_template_start + ((points_template_size.x - right_icon_size.x) * 0.5f), bb.Min.y),
|
||||
ImVec2(bb.Max.x, midpoint));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, cheevo->title, nullptr, nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::RenderTextClipped(lock_bb.Min, lock_bb.Max, right_icon_text, nullptr, &right_icon_size, ImVec2(0.0f, 0.0f),
|
||||
&lock_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
if (cheevo->description && summary_length > 0)
|
||||
{
|
||||
ImGui::RenderTextWrapped(summary_bb.Min, cheevo->description, cheevo->description + summary_length,
|
||||
|
@ -2722,19 +2724,19 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
|||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
const float progress_height = LayoutScale(progress_height_unscaled);
|
||||
const float progress_spacing = LayoutScale(progress_spacing_unscaled);
|
||||
const float top = midpoint + g_medium_font->FontSize + progress_spacing;
|
||||
const float top = midpoint + UIStyle.MediumFont->FontSize + progress_spacing;
|
||||
const ImRect progress_bb(ImVec2(text_start_x, top), ImVec2(bb.Max.x, top + progress_height));
|
||||
const float fraction = cheevo->measured_percent * 0.01f;
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryDarkColor));
|
||||
dl->AddRectFilled(progress_bb.Min, progress_bb.Max, ImGui::GetColorU32(ImGuiFullscreen::UIStyle.PrimaryDarkColor));
|
||||
dl->AddRectFilled(progress_bb.Min, ImVec2(progress_bb.Min.x + fraction * progress_bb.GetWidth(), progress_bb.Max.y),
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UISecondaryColor));
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.SecondaryColor));
|
||||
|
||||
const ImVec2 text_size =
|
||||
ImGui::CalcTextSize(measured_progress.data(), measured_progress.data() + measured_progress.size());
|
||||
const ImVec2 text_pos(progress_bb.Min.x + ((progress_bb.Max.x - progress_bb.Min.x) / 2.0f) - (text_size.x / 2.0f),
|
||||
progress_bb.Min.y + ((progress_bb.Max.y - progress_bb.Min.y) / 2.0f) - (text_size.y / 2.0f));
|
||||
dl->AddText(g_medium_font, g_medium_font->FontSize, text_pos,
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UIPrimaryTextColor), measured_progress.data(),
|
||||
dl->AddText(UIStyle.MediumFont, UIStyle.MediumFont->FontSize, text_pos,
|
||||
ImGui::GetColorU32(ImGuiFullscreen::UIStyle.PrimaryTextColor), measured_progress.data(),
|
||||
measured_progress.data() + measured_progress.size());
|
||||
}
|
||||
|
||||
|
@ -2769,9 +2771,8 @@ bool Achievements::PrepareLeaderboardsWindow()
|
|||
|
||||
void Achievements::DrawLeaderboardsWindow()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
static constexpr float heading_alpha = 0.95f;
|
||||
|
@ -2785,8 +2786,8 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
|
||||
ImRect bb;
|
||||
|
||||
const ImVec4 background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, alpha);
|
||||
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIBackgroundColor, heading_alpha);
|
||||
const ImVec4 background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIStyle.BackgroundColor, alpha);
|
||||
const ImVec4 heading_background = ImGuiFullscreen::ModAlpha(ImGuiFullscreen::UIStyle.BackgroundColor, heading_alpha);
|
||||
const ImVec2 display_size = ImGui::GetIO().DisplaySize;
|
||||
const float padding = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
|
@ -2802,13 +2803,15 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
}
|
||||
|
||||
const float rank_column_width =
|
||||
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "99999").x;
|
||||
UIStyle.LargeFont->CalcTextSizeA(UIStyle.LargeFont->FontSize, std::numeric_limits<float>::max(), -1.0f, "99999").x;
|
||||
const float name_column_width =
|
||||
g_large_font
|
||||
->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWWWWWWWWWWWWW")
|
||||
UIStyle.LargeFont
|
||||
->CalcTextSizeA(UIStyle.LargeFont->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWWWWWWWWWWWWW")
|
||||
.x;
|
||||
const float time_column_width =
|
||||
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWW").x;
|
||||
UIStyle.LargeFont
|
||||
->CalcTextSizeA(UIStyle.LargeFont->FontSize, std::numeric_limits<float>::max(), -1.0f, "WWWWWWWWWWW")
|
||||
.x;
|
||||
const float column_spacing = spacing * 2.0f;
|
||||
|
||||
if (ImGuiFullscreen::BeginFullscreenWindow(
|
||||
|
@ -2845,7 +2848,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
if (!is_leaderboard_open)
|
||||
{
|
||||
if (ImGuiFullscreen::FloatingButton(ICON_FA_WINDOW_CLOSE, 10.0f, 10.0f, -1.0f, -1.0f, 1.0f, 0.0f, true,
|
||||
g_large_font) ||
|
||||
UIStyle.LargeFont) ||
|
||||
ImGuiFullscreen::WantsToCloseMenu())
|
||||
{
|
||||
FullscreenUI::ReturnToPreviousWindow();
|
||||
|
@ -2854,31 +2857,31 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
else
|
||||
{
|
||||
if (ImGuiFullscreen::FloatingButton(ICON_FA_CARET_SQUARE_LEFT, 10.0f, 10.0f, -1.0f, -1.0f, 1.0f, 0.0f, true,
|
||||
g_large_font) ||
|
||||
UIStyle.LargeFont) ||
|
||||
ImGuiFullscreen::WantsToCloseMenu())
|
||||
{
|
||||
close_leaderboard_on_exit = true;
|
||||
}
|
||||
}
|
||||
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + g_large_font->FontSize));
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.LargeFont->FontSize));
|
||||
text.assign(Achievements::GetGameTitle());
|
||||
|
||||
top += g_large_font->FontSize + spacing;
|
||||
top += UIStyle.LargeFont->FontSize + spacing;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, text.c_str(), text.end_ptr(), nullptr, ImVec2(0.0f, 0.0f),
|
||||
&title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (is_leaderboard_open)
|
||||
{
|
||||
const ImRect subtitle_bb(ImVec2(left, top), ImVec2(right, top + g_large_font->FontSize));
|
||||
const ImRect subtitle_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.LargeFont->FontSize));
|
||||
text.assign(s_state.open_leaderboard->title);
|
||||
|
||||
top += g_large_font->FontSize + spacing_small;
|
||||
top += UIStyle.LargeFont->FontSize + spacing_small;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(subtitle_bb.Min, subtitle_bb.Max, text.c_str(), text.end_ptr(), nullptr,
|
||||
ImVec2(0.0f, 0.0f), &subtitle_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -2893,17 +2896,17 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
text = TRANSLATE_PLURAL_SSTR("Achievements", "This game has %n leaderboards.", "Leaderboard count", count);
|
||||
}
|
||||
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font->FontSize));
|
||||
top += g_medium_font->FontSize + spacing_small;
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.MediumFont->FontSize));
|
||||
top += UIStyle.MediumFont->FontSize + spacing_small;
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, text.c_str(), text.end_ptr(), nullptr,
|
||||
ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
|
||||
if (!is_leaderboard_open && !Achievements::IsHardcoreModeActive())
|
||||
{
|
||||
const ImRect hardcore_warning_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font->FontSize));
|
||||
top += g_medium_font->FontSize + spacing_small;
|
||||
const ImRect hardcore_warning_bb(ImVec2(left, top), ImVec2(right, top + UIStyle.MediumFont->FontSize));
|
||||
top += UIStyle.MediumFont->FontSize + spacing_small;
|
||||
|
||||
ImGui::RenderTextClipped(
|
||||
hardcore_warning_bb.Min, hardcore_warning_bb.Max,
|
||||
|
@ -2916,7 +2919,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
|
||||
if (is_leaderboard_open)
|
||||
{
|
||||
const float tab_width = (ImGui::GetWindowWidth() / ImGuiFullscreen::g_layout_scale) * 0.5f;
|
||||
const float tab_width = (ImGui::GetWindowWidth() / ImGuiFullscreen::UIStyle.LayoutScale) * 0.5f;
|
||||
ImGui::SetCursorPos(ImVec2(0.0f, top + spacing_small));
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_GamepadDpadLeft, false) ||
|
||||
|
@ -2953,10 +2956,10 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
&visible, &hovered, &bb.Min, &bb.Max, 0, alpha);
|
||||
UNREFERENCED_VARIABLE(pressed);
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
float text_start_x = bb.Min.x + LayoutScale(15.0f) + padding;
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
|
||||
const ImRect rank_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(bb.Max.x, midpoint));
|
||||
ImGui::RenderTextClipped(rank_bb.Min, rank_bb.Max, TRANSLATE("Achievements", "Rank"), nullptr, nullptr,
|
||||
|
@ -2991,7 +2994,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
|
||||
const float line_thickness = LayoutScale(1.0f);
|
||||
const float line_padding = LayoutScale(5.0f);
|
||||
const ImVec2 line_start(bb.Min.x, bb.Min.y + g_large_font->FontSize + line_padding);
|
||||
const ImVec2 line_start(bb.Min.x, bb.Min.y + UIStyle.LargeFont->FontSize + line_padding);
|
||||
const ImVec2 line_end(bb.Max.x, line_start.y);
|
||||
ImGui::GetWindowDrawList()->AddLine(line_start, line_end, ImGui::GetColorU32(ImGuiCol_TextDisabled),
|
||||
line_thickness);
|
||||
|
@ -3063,7 +3066,7 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
|
||||
const ImVec2 pos_min(0.0f, heading_height);
|
||||
const ImVec2 pos_max(display_size.x, display_size.y);
|
||||
|
@ -3092,10 +3095,10 @@ void Achievements::DrawLeaderboardsWindow()
|
|||
&bb.Min, &bb.Max);
|
||||
if (visible)
|
||||
{
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, TRANSLATE("Achievements", "Loading..."), nullptr,
|
||||
nullptr, ImVec2(0, 0), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -3130,8 +3133,8 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
|
|||
float rank_column_width, float name_column_width, float time_column_width,
|
||||
float column_spacing)
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
|
||||
|
@ -3143,13 +3146,13 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
|
|||
if (!visible)
|
||||
return;
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
float text_start_x = bb.Min.x + LayoutScale(15.0f);
|
||||
SmallString text;
|
||||
|
||||
text.format("{}", entry.rank);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
|
||||
if (is_self)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(255, 242, 0, 255));
|
||||
|
@ -3212,9 +3215,8 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
|
|||
}
|
||||
void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboard)
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
|
||||
|
@ -3228,18 +3230,18 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
|
|||
if (!visible)
|
||||
return;
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
const float text_start_x = bb.Min.x + LayoutScale(15.0f);
|
||||
const ImRect title_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint), bb.Max);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, lboard->title, nullptr, nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (lboard->description && lboard->description[0] != '\0')
|
||||
{
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, lboard->description, nullptr, nullptr, ImVec2(0.0f, 0.0f),
|
||||
&summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
|
|
@ -72,10 +72,6 @@ public:
|
|||
#define FSUI_NSTR(str) str
|
||||
|
||||
using ImGuiFullscreen::FocusResetType;
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_layout_padding_left;
|
||||
using ImGuiFullscreen::g_layout_padding_top;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::LAYOUT_FOOTER_HEIGHT;
|
||||
using ImGuiFullscreen::LAYOUT_LARGE_FONT_SIZE;
|
||||
using ImGuiFullscreen::LAYOUT_MEDIUM_FONT_SIZE;
|
||||
|
@ -85,21 +81,7 @@ using ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING;
|
|||
using ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING;
|
||||
using ImGuiFullscreen::LAYOUT_SCREEN_HEIGHT;
|
||||
using ImGuiFullscreen::LAYOUT_SCREEN_WIDTH;
|
||||
using ImGuiFullscreen::UIBackgroundColor;
|
||||
using ImGuiFullscreen::UIBackgroundHighlightColor;
|
||||
using ImGuiFullscreen::UIBackgroundLineColor;
|
||||
using ImGuiFullscreen::UIBackgroundTextColor;
|
||||
using ImGuiFullscreen::UIDisabledColor;
|
||||
using ImGuiFullscreen::UIPrimaryColor;
|
||||
using ImGuiFullscreen::UIPrimaryDarkColor;
|
||||
using ImGuiFullscreen::UIPrimaryLightColor;
|
||||
using ImGuiFullscreen::UIPrimaryLineColor;
|
||||
using ImGuiFullscreen::UIPrimaryTextColor;
|
||||
using ImGuiFullscreen::UISecondaryColor;
|
||||
using ImGuiFullscreen::UISecondaryStrongColor;
|
||||
using ImGuiFullscreen::UISecondaryTextColor;
|
||||
using ImGuiFullscreen::UISecondaryWeakColor;
|
||||
using ImGuiFullscreen::UITextHighlightColor;
|
||||
using ImGuiFullscreen::UIStyle;
|
||||
|
||||
using ImGuiFullscreen::ActiveButton;
|
||||
using ImGuiFullscreen::AddNotification;
|
||||
|
@ -331,33 +313,34 @@ static void DoSaveInputProfile(const std::string& name);
|
|||
|
||||
static bool DrawToggleSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, bool default_value, bool enabled = true, bool allow_tristate = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawIntListSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, int default_value, const char* const* options, size_t option_count,
|
||||
bool translate_options, int option_offset = 0, bool enabled = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font, const char* tr_context = TR_CONTEXT);
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont,
|
||||
const char* tr_context = TR_CONTEXT);
|
||||
static void DrawIntRangeSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, int default_value, int min_value, int max_value,
|
||||
const char* format = "%d", bool enabled = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, int default_value, int min_value, int max_value, int step_value,
|
||||
const char* format = "%d", bool enabled = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawFloatRangeSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, float default_value, float min_value, float max_value,
|
||||
const char* format = "%f", float multiplier = 1.0f, bool enabled = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, float default_value, float min_value, float max_value,
|
||||
float step_value, float multiplier, const char* format = "%f", bool enabled = true,
|
||||
float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
#if 0
|
||||
static void DrawIntRectSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* left_key, int default_left, const char* top_key, int default_top,
|
||||
|
@ -378,15 +361,15 @@ static void DrawEnumSetting(SettingsInterface* bsi, const char* title, const cha
|
|||
const char* (*to_string_function)(DataType value),
|
||||
const char* (*to_display_string_function)(DataType value), SizeType option_count,
|
||||
bool enabled = true, float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawFloatListSetting(SettingsInterface* bsi, const char* title, const char* summary, const char* section,
|
||||
const char* key, float default_value, const char* const* options,
|
||||
const float* option_values, size_t option_count, bool translate_options,
|
||||
bool enabled = true, float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
static void DrawFolderSetting(SettingsInterface* bsi, const char* title, const char* section, const char* key,
|
||||
const std::string& runtime_var, float height = ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
|
||||
static void PopulateGraphicsAdapterList();
|
||||
static void PopulateGameListDirectoryCache(SettingsInterface* si);
|
||||
|
@ -1293,14 +1276,14 @@ void FullscreenUI::DrawLandingTemplate(ImVec2* menu_pos, ImVec2* menu_size)
|
|||
*menu_pos = ImVec2(0.0f, heading_size.y);
|
||||
*menu_size = ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT));
|
||||
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "landing_heading", UIPrimaryColor))
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "landing_heading", UIStyle.PrimaryColor))
|
||||
{
|
||||
ImFont* const heading_font = g_large_font;
|
||||
ImFont* const heading_font = UIStyle.LargeFont;
|
||||
ImDrawList* const dl = ImGui::GetWindowDrawList();
|
||||
SmallString heading_str;
|
||||
|
||||
ImGui::PushFont(heading_font);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.PrimaryTextColor);
|
||||
|
||||
// draw branding
|
||||
{
|
||||
|
@ -1361,7 +1344,7 @@ void FullscreenUI::DrawLandingWindow()
|
|||
ImVec2 menu_pos, menu_size;
|
||||
DrawLandingTemplate(&menu_pos, &menu_size);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
|
||||
|
||||
if (BeginHorizontalMenu("landing_window", menu_pos, menu_size, 4))
|
||||
{
|
||||
|
@ -1433,7 +1416,7 @@ void FullscreenUI::DrawStartGameWindow()
|
|||
ImVec2 menu_pos, menu_size;
|
||||
DrawLandingTemplate(&menu_pos, &menu_size);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
|
||||
|
||||
if (BeginHorizontalMenu("start_game_window", menu_pos, menu_size, 4))
|
||||
{
|
||||
|
@ -1497,7 +1480,7 @@ void FullscreenUI::DrawExitWindow()
|
|||
ImVec2 menu_pos, menu_size;
|
||||
DrawLandingTemplate(&menu_pos, &menu_size);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
|
||||
|
||||
if (BeginHorizontalMenu("exit_window", menu_pos, menu_size, 3))
|
||||
{
|
||||
|
@ -1687,11 +1670,11 @@ void FullscreenUI::DrawInputBindingButton(SettingsInterface* bsi, InputBindingIn
|
|||
}
|
||||
}
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
|
||||
if (oneline)
|
||||
{
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
|
||||
const ImVec2 value_size(ImGui::CalcTextSize(value.empty() ? FSUI_CSTR("-") : value.c_str(), nullptr));
|
||||
const float text_end = bb.Max.x - value_size.x;
|
||||
|
@ -1708,12 +1691,12 @@ void FullscreenUI::DrawInputBindingButton(SettingsInterface* bsi, InputBindingIn
|
|||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, show_type ? title.c_str() : display_name, nullptr, nullptr,
|
||||
ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, value.empty() ? FSUI_CSTR("No Binding") : value.c_str(),
|
||||
nullptr, nullptr, ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -1849,7 +1832,7 @@ void FullscreenUI::DrawInputBindingWindow()
|
|||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(title);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -1983,7 +1966,7 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 194.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -2010,7 +1993,7 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
|
|||
}
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -2041,7 +2024,7 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, const char* tit
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 194.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -2071,7 +2054,7 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, const char* tit
|
|||
}
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -2107,7 +2090,7 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 194.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -2154,27 +2137,27 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
|||
// Align value text in middle.
|
||||
ImGui::SetCursorPosY(
|
||||
button_pos.y +
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) - g_large_font->FontSize) * 0.5f);
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) - UIStyle.LargeFont->FontSize) * 0.5f);
|
||||
ImGui::TextUnformatted(str_value);
|
||||
|
||||
float step = 0;
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true, g_large_font,
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true, UIStyle.LargeFont,
|
||||
&button_pos, true))
|
||||
{
|
||||
step = step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_CHEVRON_DOWN, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos, true))
|
||||
UIStyle.LargeFont, &button_pos, true))
|
||||
{
|
||||
step = -step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_KEYBOARD, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos))
|
||||
UIStyle.LargeFont, &button_pos))
|
||||
{
|
||||
manual_input = true;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_TRASH, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos))
|
||||
UIStyle.LargeFont, &button_pos))
|
||||
{
|
||||
dlg_value = default_value * multiplier;
|
||||
dlg_value_changed = true;
|
||||
|
@ -2201,7 +2184,7 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
|||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -2359,7 +2342,7 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 194.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -2400,27 +2383,27 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
|||
// Align value text in middle.
|
||||
ImGui::SetCursorPosY(
|
||||
button_pos.y +
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) - g_large_font->FontSize) * 0.5f);
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) - UIStyle.LargeFont->FontSize) * 0.5f);
|
||||
ImGui::TextUnformatted(str_value);
|
||||
|
||||
s32 step = 0;
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true, g_large_font,
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true, UIStyle.LargeFont,
|
||||
&button_pos, true))
|
||||
{
|
||||
step = step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_CHEVRON_DOWN, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos, true))
|
||||
UIStyle.LargeFont, &button_pos, true))
|
||||
{
|
||||
step = -step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_KEYBOARD, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos))
|
||||
UIStyle.LargeFont, &button_pos))
|
||||
{
|
||||
manual_input = true;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_TRASH, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos))
|
||||
UIStyle.LargeFont, &button_pos))
|
||||
{
|
||||
dlg_value = default_value;
|
||||
dlg_value_changed = true;
|
||||
|
@ -2447,7 +2430,7 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
|||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -2860,7 +2843,7 @@ void FullscreenUI::DrawSettingsWindow()
|
|||
const float bg_alpha = System::IsValid() ? (s_settings_page == SettingsPage::PostProcessing ? 0.50f : 0.90f) : 1.0f;
|
||||
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "settings_category",
|
||||
ImVec4(UIPrimaryColor.x, UIPrimaryColor.y, UIPrimaryColor.z, bg_alpha)))
|
||||
ImVec4(UIStyle.PrimaryColor.x, UIStyle.PrimaryColor.y, UIStyle.PrimaryColor.z, bg_alpha)))
|
||||
{
|
||||
static constexpr float ITEM_WIDTH = 25.0f;
|
||||
|
||||
|
@ -2959,7 +2942,7 @@ 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), 0.0f,
|
||||
ImVec4(UIStyle.BackgroundColor.x, UIStyle.BackgroundColor.y, UIStyle.BackgroundColor.z, bg_alpha), 0.0f,
|
||||
ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f)))
|
||||
{
|
||||
ResetFocusHere();
|
||||
|
@ -3597,7 +3580,7 @@ void FullscreenUI::DrawEmulationSettingsPage()
|
|||
"system requirements.");
|
||||
}
|
||||
|
||||
ActiveButton(rewind_summary, false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font);
|
||||
ActiveButton(rewind_summary, false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont);
|
||||
|
||||
EndMenuButtons();
|
||||
}
|
||||
|
@ -3986,7 +3969,7 @@ void FullscreenUI::DrawControllerSettingsPage()
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 180.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -4039,8 +4022,8 @@ void FullscreenUI::DrawControllerSettingsPage()
|
|||
break;
|
||||
case SettingInfo::Type::IntegerList:
|
||||
DrawIntListSetting(bsi, title, description, section.c_str(), si.name, si.IntegerDefaultValue(), si.options,
|
||||
0, true, si.IntegerMinValue(), true, LAYOUT_MENU_BUTTON_HEIGHT, g_large_font,
|
||||
g_medium_font, ci->name);
|
||||
0, true, si.IntegerMinValue(), true, LAYOUT_MENU_BUTTON_HEIGHT, UIStyle.LargeFont,
|
||||
UIStyle.MediumFont, ci->name);
|
||||
break;
|
||||
case SettingInfo::Type::Float:
|
||||
DrawFloatSpinBoxSetting(bsi, title, description, section.c_str(), si.name, si.FloatDefaultValue(),
|
||||
|
@ -4583,7 +4566,7 @@ void FullscreenUI::DrawGraphicsSettingsPage()
|
|||
MenuHeading(FSUI_CSTR("Texture Replacements"));
|
||||
|
||||
ActiveButton(FSUI_CSTR("The texture cache is currently experimental, and may cause rendering errors in some games."),
|
||||
false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font);
|
||||
false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont);
|
||||
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_ID_BADGE, "Enable Texture Cache"),
|
||||
FSUI_CSTR("Enables caching of guest textures, required for texture replacement."), "GPU",
|
||||
|
@ -4791,7 +4774,7 @@ void FullscreenUI::DrawPostProcessingSettingsPage()
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 190.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -4864,7 +4847,7 @@ void FullscreenUI::DrawPostProcessingSettingsPage()
|
|||
#endif
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -4890,7 +4873,7 @@ void FullscreenUI::DrawPostProcessingSettingsPage()
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 190.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -4962,7 +4945,7 @@ void FullscreenUI::DrawPostProcessingSettingsPage()
|
|||
#endif
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -5226,7 +5209,7 @@ void FullscreenUI::DrawAchievementsLoginWindow()
|
|||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
|
||||
const char* popup_title = FSUI_CSTR("RetroAchievements Login");
|
||||
bool popup_closed = false;
|
||||
|
@ -5482,7 +5465,7 @@ void FullscreenUI::DrawPatchesOrCheatsSettingsPage(bool cheats)
|
|||
ImGui::SetNextWindowSize(LayoutScale(500.0f, 194.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING,
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
@ -5501,24 +5484,24 @@ void FullscreenUI::DrawPatchesOrCheatsSettingsPage(bool cheats)
|
|||
ImVec2 button_pos(ImGui::GetCursorPos());
|
||||
|
||||
// Align value text in middle.
|
||||
ImGui::SetCursorPosY(
|
||||
button_pos.y +
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) - g_large_font->FontSize) * 0.5f);
|
||||
ImGui::SetCursorPosY(button_pos.y + ((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + padding.y * 2.0f) -
|
||||
UIStyle.LargeFont->FontSize) *
|
||||
0.5f);
|
||||
ImGui::TextUnformatted(visible_value.c_str(), visible_value.end_ptr());
|
||||
|
||||
s32 step = 0;
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true, g_large_font,
|
||||
&button_pos, true))
|
||||
if (FloatingButton(ICON_FA_CHEVRON_UP, padding.x, button_pos.y, -1.0f, -1.0f, 1.0f, 0.0f, true,
|
||||
UIStyle.LargeFont, &button_pos, true))
|
||||
{
|
||||
step = step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_CHEVRON_DOWN, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f,
|
||||
true, g_large_font, &button_pos, true))
|
||||
true, UIStyle.LargeFont, &button_pos, true))
|
||||
{
|
||||
step = -step_value;
|
||||
}
|
||||
if (FloatingButton(ICON_FA_TRASH, button_pos.x - padding.x, button_pos.y, -1.0f, -1.0f, -1.0f, 0.0f, true,
|
||||
g_large_font, &button_pos))
|
||||
UIStyle.LargeFont, &button_pos))
|
||||
{
|
||||
range_value = ci.option_range_start - 1;
|
||||
range_value_changed = true;
|
||||
|
@ -5555,7 +5538,7 @@ void FullscreenUI::DrawPatchesOrCheatsSettingsPage(bool cheats)
|
|||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font,
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont,
|
||||
ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
@ -5679,9 +5662,9 @@ void FullscreenUI::DrawPauseMenu()
|
|||
|
||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||
const ImVec2 display_size(ImGui::GetIO().DisplaySize);
|
||||
const ImU32 text_color = ImGui::GetColorU32(UIBackgroundTextColor) | IM_COL32_A_MASK;
|
||||
const ImU32 text_color = ImGui::GetColorU32(UIStyle.BackgroundTextColor) | IM_COL32_A_MASK;
|
||||
dl->AddRectFilled(ImVec2(0.0f, 0.0f), display_size,
|
||||
(ImGui::GetColorU32(UIBackgroundColor) & ~IM_COL32_A_MASK) | (200 << IM_COL32_A_SHIFT));
|
||||
(ImGui::GetColorU32(UIStyle.BackgroundColor) & ~IM_COL32_A_MASK) | (200 << IM_COL32_A_SHIFT));
|
||||
|
||||
// title info
|
||||
{
|
||||
|
@ -5695,15 +5678,15 @@ void FullscreenUI::DrawPauseMenu()
|
|||
const float image_width = 60.0f;
|
||||
const float image_height = 60.0f;
|
||||
|
||||
const ImVec2 title_size(
|
||||
g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f, title.c_str()));
|
||||
const ImVec2 subtitle_size(
|
||||
g_medium_font->CalcTextSizeA(g_medium_font->FontSize, std::numeric_limits<float>::max(), -1.0f, buffer.c_str()));
|
||||
const ImVec2 title_size(UIStyle.LargeFont->CalcTextSizeA(UIStyle.LargeFont->FontSize,
|
||||
std::numeric_limits<float>::max(), -1.0f, title.c_str()));
|
||||
const ImVec2 subtitle_size(UIStyle.MediumFont->CalcTextSizeA(
|
||||
UIStyle.MediumFont->FontSize, std::numeric_limits<float>::max(), -1.0f, buffer.c_str()));
|
||||
|
||||
ImVec2 title_pos(display_size.x - LayoutScale(10.0f + image_width + 20.0f) - title_size.x,
|
||||
display_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT) - LayoutScale(10.0f + image_height));
|
||||
ImVec2 subtitle_pos(display_size.x - LayoutScale(10.0f + image_width + 20.0f) - subtitle_size.x,
|
||||
title_pos.y + g_large_font->FontSize + LayoutScale(4.0f));
|
||||
title_pos.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f));
|
||||
|
||||
float rp_height = 0.0f;
|
||||
{
|
||||
|
@ -5713,24 +5696,25 @@ void FullscreenUI::DrawPauseMenu()
|
|||
if (!rp.empty())
|
||||
{
|
||||
const float wrap_width = LayoutScale(350.0f);
|
||||
const ImVec2 rp_size = g_medium_font->CalcTextSizeA(g_medium_font->FontSize, std::numeric_limits<float>::max(),
|
||||
wrap_width, rp.data(), rp.data() + rp.length());
|
||||
const ImVec2 rp_size =
|
||||
UIStyle.MediumFont->CalcTextSizeA(UIStyle.MediumFont->FontSize, std::numeric_limits<float>::max(), wrap_width,
|
||||
rp.data(), rp.data() + rp.length());
|
||||
|
||||
// Add a small extra gap if any Rich Presence is displayed
|
||||
rp_height = rp_size.y - g_medium_font->FontSize + LayoutScale(2.0f);
|
||||
rp_height = rp_size.y - UIStyle.MediumFont->FontSize + LayoutScale(2.0f);
|
||||
|
||||
const ImVec2 rp_pos(display_size.x - LayoutScale(20.0f + 50.0f + 20.0f) - rp_size.x,
|
||||
subtitle_pos.y + g_medium_font->FontSize + LayoutScale(4.0f) - rp_height);
|
||||
subtitle_pos.y + UIStyle.MediumFont->FontSize + LayoutScale(4.0f) - rp_height);
|
||||
|
||||
title_pos.y -= rp_height;
|
||||
subtitle_pos.y -= rp_height;
|
||||
|
||||
DrawShadowedText(dl, g_medium_font, rp_pos, text_color, rp.data(), rp.data() + rp.length(), wrap_width);
|
||||
DrawShadowedText(dl, UIStyle.MediumFont, rp_pos, text_color, rp.data(), rp.data() + rp.length(), wrap_width);
|
||||
}
|
||||
}
|
||||
|
||||
DrawShadowedText(dl, g_large_font, title_pos, text_color, title.c_str());
|
||||
DrawShadowedText(dl, g_medium_font, subtitle_pos, text_color, buffer.c_str());
|
||||
DrawShadowedText(dl, UIStyle.LargeFont, title_pos, text_color, title.c_str());
|
||||
DrawShadowedText(dl, UIStyle.MediumFont, subtitle_pos, text_color, buffer.c_str());
|
||||
|
||||
GPUTexture* const cover = GetCoverForCurrentGame();
|
||||
const ImVec2 image_min(display_size.x - LayoutScale(10.0f + image_width),
|
||||
|
@ -5746,10 +5730,10 @@ void FullscreenUI::DrawPauseMenu()
|
|||
{
|
||||
buffer.format("{:%X}", fmt::localtime(std::time(nullptr)));
|
||||
|
||||
const ImVec2 time_size(g_large_font->CalcTextSizeA(g_large_font->FontSize, std::numeric_limits<float>::max(), -1.0f,
|
||||
buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 time_size(UIStyle.LargeFont->CalcTextSizeA(
|
||||
UIStyle.LargeFont->FontSize, std::numeric_limits<float>::max(), -1.0f, buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 time_pos(display_size.x - LayoutScale(10.0f) - time_size.x, LayoutScale(10.0f));
|
||||
DrawShadowedText(dl, g_large_font, time_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
DrawShadowedText(dl, UIStyle.LargeFont, time_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
|
||||
const std::string& serial = System::GetGameSerial();
|
||||
if (!serial.empty())
|
||||
|
@ -5758,18 +5742,18 @@ void FullscreenUI::DrawPauseMenu()
|
|||
const std::time_t session_time = static_cast<std::time_t>(System::GetSessionPlayedTime());
|
||||
|
||||
buffer.format(FSUI_FSTR("Session: {}"), GameList::FormatTimespan(session_time, true));
|
||||
const ImVec2 session_size(g_medium_font->CalcTextSizeA(g_medium_font->FontSize, std::numeric_limits<float>::max(),
|
||||
-1.0f, buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 session_size(UIStyle.MediumFont->CalcTextSizeA(
|
||||
UIStyle.MediumFont->FontSize, std::numeric_limits<float>::max(), -1.0f, buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 session_pos(display_size.x - LayoutScale(10.0f) - session_size.x,
|
||||
time_pos.y + g_large_font->FontSize + LayoutScale(4.0f));
|
||||
DrawShadowedText(dl, g_medium_font, session_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
time_pos.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f));
|
||||
DrawShadowedText(dl, UIStyle.MediumFont, session_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
|
||||
buffer.format(FSUI_FSTR("All Time: {}"), GameList::FormatTimespan(cached_played_time + session_time, true));
|
||||
const ImVec2 total_size(g_medium_font->CalcTextSizeA(g_medium_font->FontSize, std::numeric_limits<float>::max(),
|
||||
-1.0f, buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 total_size(UIStyle.MediumFont->CalcTextSizeA(
|
||||
UIStyle.MediumFont->FontSize, std::numeric_limits<float>::max(), -1.0f, buffer.c_str(), buffer.end_ptr()));
|
||||
const ImVec2 total_pos(display_size.x - LayoutScale(10.0f) - total_size.x,
|
||||
session_pos.y + g_medium_font->FontSize + LayoutScale(4.0f));
|
||||
DrawShadowedText(dl, g_medium_font, total_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
session_pos.y + UIStyle.MediumFont->FontSize + LayoutScale(4.0f));
|
||||
DrawShadowedText(dl, UIStyle.MediumFont, total_pos, text_color, buffer.c_str(), buffer.end_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6109,7 +6093,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
ImVec2(io.DisplaySize.x, LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) +
|
||||
(LayoutScale(LAYOUT_MENU_BUTTON_Y_PADDING) * 2.0f) + LayoutScale(2.0f));
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIPrimaryColor, 0.9f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIStyle.PrimaryColor, 0.9f));
|
||||
|
||||
bool closed = false;
|
||||
bool was_close_not_back = false;
|
||||
|
@ -6126,7 +6110,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
}
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIBackgroundColor, 0.9f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIStyle.BackgroundColor, 0.9f));
|
||||
ImGui::SetCursorPos(ImVec2(0.0f, heading_size.y));
|
||||
|
||||
if (IsFocusResetFromWindowChange())
|
||||
|
@ -6149,8 +6133,8 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
const float image_width = item_width - (style.FramePadding.x * 2.0f);
|
||||
const float image_height = image_width / 1.33f;
|
||||
const ImVec2 image_size(image_width, image_height);
|
||||
const float item_height = (style.FramePadding.y * 2.0f) + image_height + title_spacing + g_large_font->FontSize +
|
||||
summary_spacing + g_medium_font->FontSize;
|
||||
const float item_height = (style.FramePadding.y * 2.0f) + image_height + title_spacing +
|
||||
UIStyle.LargeFont->FontSize + summary_spacing + UIStyle.MediumFont->FontSize;
|
||||
const ImVec2 item_size(item_width, item_height);
|
||||
const u32 grid_count_x = static_cast<u32>(std::floor(ImGui::GetWindowWidth() / item_width_with_spacing));
|
||||
const float start_x =
|
||||
|
@ -6166,18 +6150,18 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
{
|
||||
// can't use a choice dialog here, because we're already in a modal...
|
||||
ImGuiFullscreen::PushResetLayout();
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
|
||||
LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.PrimaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBg, UIStyle.PrimaryDarkColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIStyle.PrimaryColor);
|
||||
|
||||
const float width = LayoutScale(600.0f);
|
||||
const float title_height =
|
||||
g_large_font->FontSize + ImGui::GetStyle().FramePadding.y * 2.0f + ImGui::GetStyle().WindowPadding.y * 2.0f;
|
||||
const float title_height = UIStyle.LargeFont->FontSize + ImGui::GetStyle().FramePadding.y * 2.0f +
|
||||
ImGui::GetStyle().WindowPadding.y * 2.0f;
|
||||
const float height =
|
||||
title_height +
|
||||
((LayoutScale(LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) + (LayoutScale(LAYOUT_MENU_BUTTON_Y_PADDING) * 2.0f)) *
|
||||
|
@ -6190,7 +6174,7 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
if (ImGui::BeginPopupModal(entry.title.c_str(), &is_open,
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIBackgroundTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.BackgroundTextColor);
|
||||
|
||||
BeginMenuButtons();
|
||||
|
||||
|
@ -6305,17 +6289,17 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
|||
ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
|
||||
|
||||
const ImVec2 title_pos(bb.Min.x, bb.Min.y + image_height + title_spacing);
|
||||
const ImRect title_bb(title_pos, ImVec2(bb.Max.x, title_pos.y + g_large_font->FontSize));
|
||||
ImGui::PushFont(g_large_font);
|
||||
const ImRect title_bb(title_pos, ImVec2(bb.Max.x, title_pos.y + UIStyle.LargeFont->FontSize));
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, entry.title.c_str(), nullptr, nullptr, ImVec2(0.0f, 0.0f),
|
||||
&title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!entry.summary.empty())
|
||||
{
|
||||
const ImVec2 summary_pos(bb.Min.x, title_pos.y + g_large_font->FontSize + summary_spacing);
|
||||
const ImRect summary_bb(summary_pos, ImVec2(bb.Max.x, summary_pos.y + g_medium_font->FontSize));
|
||||
ImGui::PushFont(g_medium_font);
|
||||
const ImVec2 summary_pos(bb.Min.x, title_pos.y + UIStyle.LargeFont->FontSize + summary_spacing);
|
||||
const ImRect summary_bb(summary_pos, ImVec2(bb.Max.x, summary_pos.y + UIStyle.MediumFont->FontSize));
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, entry.summary.c_str(), nullptr, nullptr,
|
||||
ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -6413,7 +6397,7 @@ void FullscreenUI::DrawResumeStateSelector()
|
|||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(FSUI_CSTR("Load Resume State"));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
|
||||
|
@ -6660,7 +6644,8 @@ void FullscreenUI::DrawGameListWindow()
|
|||
|
||||
const float bg_alpha = System::IsValid() ? 0.90f : 1.0f;
|
||||
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "gamelist_view", MulAlpha(UIPrimaryColor, bg_alpha)))
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "gamelist_view",
|
||||
MulAlpha(UIStyle.PrimaryColor, bg_alpha)))
|
||||
{
|
||||
static constexpr float ITEM_WIDTH = 25.0f;
|
||||
static constexpr const char* icons[] = {ICON_FA_BORDER_ALL, ICON_FA_LIST};
|
||||
|
@ -6784,19 +6769,19 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
|
|||
ImGui::GetWindowDrawList()->AddImage(cover_texture, image_rect.Min, image_rect.Max, ImVec2(0.0f, 0.0f),
|
||||
ImVec2(1.0f, 1.0f), IM_COL32(255, 255, 255, 255));
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font->FontSize + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + UIStyle.LargeFont->FontSize + LayoutScale(4.0f);
|
||||
const float text_start_x = bb.Min.x + image_size.x + LayoutScale(15.0f);
|
||||
const ImRect title_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint), bb.Max);
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, entry->title.c_str(),
|
||||
entry->title.c_str() + entry->title.size(), nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (!summary.empty())
|
||||
{
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(summary_bb.Min, summary_bb.Max, summary.c_str(), summary.end_ptr(), nullptr,
|
||||
ImVec2(0.0f, 0.0f), &summary_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -6824,7 +6809,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
|
|||
}
|
||||
EndFullscreenColumnWindow();
|
||||
|
||||
if (BeginFullscreenColumnWindow(-530.0f, 0.0f, "game_list_info", UIPrimaryDarkColor))
|
||||
if (BeginFullscreenColumnWindow(-530.0f, 0.0f, "game_list_info", UIStyle.PrimaryDarkColor))
|
||||
{
|
||||
const GPUTexture* cover_texture =
|
||||
selected_entry ? GetGameListCover(selected_entry) : GetTextureForGameListEntryType(GameList::EntryType::Count);
|
||||
|
@ -6854,13 +6839,13 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
|
|||
if (selected_entry)
|
||||
{
|
||||
// title
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
text_width = ImGui::CalcTextSize(selected_entry->title.c_str(), nullptr, false, work_width).x;
|
||||
ImGui::SetCursorPosX((work_width - text_width) / 2.0f);
|
||||
ImGui::TextWrapped("%s", selected_entry->title.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
|
||||
// developer
|
||||
if (selected_entry->dbentry && !selected_entry->dbentry->developer.empty())
|
||||
|
@ -6936,7 +6921,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
|
|||
{
|
||||
// title
|
||||
const char* title = FSUI_CSTR("No Game Selected");
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
text_width = ImGui::CalcTextSize(title, nullptr, false, work_width).x;
|
||||
ImGui::SetCursorPosX((work_width - text_width) / 2.0f);
|
||||
ImGui::TextWrapped("%s", title);
|
||||
|
@ -6961,7 +6946,7 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
|
|||
if (!BeginFullscreenWindow(
|
||||
ImVec2(0.0f, heading_size.y),
|
||||
ImVec2(io.DisplaySize.x, io.DisplaySize.y - heading_size.y - LayoutScale(LAYOUT_FOOTER_HEIGHT)), "game_grid",
|
||||
UIBackgroundColor))
|
||||
UIStyle.BackgroundColor))
|
||||
{
|
||||
EndFullscreenWindow();
|
||||
return;
|
||||
|
@ -6982,7 +6967,7 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
|
|||
const float image_width = item_width - (style.FramePadding.x * 2.0f);
|
||||
const float image_height = image_width;
|
||||
const ImVec2 image_size(image_width, image_height);
|
||||
const float item_height = (style.FramePadding.y * 2.0f) + image_height + title_spacing + g_medium_font->FontSize;
|
||||
const float item_height = (style.FramePadding.y * 2.0f) + image_height + title_spacing + UIStyle.MediumFont->FontSize;
|
||||
const ImVec2 item_size(item_width, item_height);
|
||||
const u32 grid_count_x = static_cast<u32>(std::floor(ImGui::GetWindowWidth() / item_width_with_spacing));
|
||||
const float start_x =
|
||||
|
@ -7034,7 +7019,7 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
|
|||
const std::string_view title(
|
||||
std::string_view(entry->title).substr(0, (entry->title.length() > 31) ? 31 : std::string_view::npos));
|
||||
draw_title.format("{}{}", title, (title.length() == entry->title.length()) ? "" : "...");
|
||||
ImGui::PushFont(g_medium_font);
|
||||
ImGui::PushFont(UIStyle.MediumFont);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, draw_title.c_str(), draw_title.end_ptr(), nullptr,
|
||||
ImVec2(0.5f, 0.0f), &title_bb);
|
||||
ImGui::PopFont();
|
||||
|
@ -7209,7 +7194,8 @@ void FullscreenUI::DrawGameListSettingsWindow()
|
|||
|
||||
const float bg_alpha = System::IsValid() ? 0.90f : 1.0f;
|
||||
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "gamelist_view", MulAlpha(UIPrimaryColor, bg_alpha)))
|
||||
if (BeginFullscreenWindow(ImVec2(0.0f, 0.0f), heading_size, "gamelist_view",
|
||||
MulAlpha(UIStyle.PrimaryColor, bg_alpha)))
|
||||
{
|
||||
BeginNavBar();
|
||||
|
||||
|
@ -7228,7 +7214,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, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f)))
|
||||
"settings_parent", UIStyle.BackgroundColor, 0.0f, ImVec2(ImGuiFullscreen::LAYOUT_MENU_WINDOW_X_PADDING, 0.0f)))
|
||||
{
|
||||
EndFullscreenWindow();
|
||||
return;
|
||||
|
@ -7471,7 +7457,7 @@ void FullscreenUI::DrawAboutWindow()
|
|||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(FSUI_CSTR("About DuckStation"));
|
||||
|
||||
ImGui::PushFont(g_large_font);
|
||||
ImGui::PushFont(UIStyle.LargeFont);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(30.0f, 30.0f));
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -43,57 +43,62 @@ static constexpr float LAYOUT_HORIZONTAL_MENU_HEIGHT = 320.0f;
|
|||
static constexpr float LAYOUT_HORIZONTAL_MENU_PADDING = 30.0f;
|
||||
static constexpr float LAYOUT_HORIZONTAL_MENU_ITEM_WIDTH = 250.0f;
|
||||
|
||||
extern ImFont* g_medium_font;
|
||||
extern ImFont* g_large_font;
|
||||
struct ALIGN_TO_CACHE_LINE UIStyles
|
||||
{
|
||||
ImVec4 BackgroundColor;
|
||||
ImVec4 BackgroundTextColor;
|
||||
ImVec4 BackgroundLineColor;
|
||||
ImVec4 BackgroundHighlight;
|
||||
ImVec4 PopupBackgroundColor;
|
||||
ImVec4 DisabledColor;
|
||||
ImVec4 PrimaryColor;
|
||||
ImVec4 PrimaryLightColor;
|
||||
ImVec4 PrimaryDarkColor;
|
||||
ImVec4 PrimaryTextColor;
|
||||
ImVec4 TextHighlightColor;
|
||||
ImVec4 PrimaryLineColor;
|
||||
ImVec4 SecondaryColor;
|
||||
ImVec4 SecondaryWeakColor; // Not currently used.
|
||||
ImVec4 SecondaryStrongColor;
|
||||
ImVec4 SecondaryTextColor;
|
||||
|
||||
extern float g_layout_scale;
|
||||
extern float g_rcp_layout_scale;
|
||||
extern float g_layout_padding_left;
|
||||
extern float g_layout_padding_top;
|
||||
ImFont* MediumFont;
|
||||
ImFont* LargeFont;
|
||||
|
||||
extern ImVec4 UIBackgroundColor;
|
||||
extern ImVec4 UIBackgroundTextColor;
|
||||
extern ImVec4 UIBackgroundLineColor;
|
||||
extern ImVec4 UIBackgroundHighlightColor;
|
||||
extern ImVec4 UIPopupBackgroundColor;
|
||||
extern ImVec4 UIDisabledColor;
|
||||
extern ImVec4 UIPrimaryColor;
|
||||
extern ImVec4 UIPrimaryLightColor;
|
||||
extern ImVec4 UIPrimaryDarkColor;
|
||||
extern ImVec4 UIPrimaryTextColor;
|
||||
extern ImVec4 UITextHighlightColor;
|
||||
extern ImVec4 UIPrimaryLineColor;
|
||||
extern ImVec4 UISecondaryColor;
|
||||
extern ImVec4 UISecondaryWeakColor; // Not currently used.
|
||||
extern ImVec4 UISecondaryStrongColor;
|
||||
extern ImVec4 UISecondaryTextColor;
|
||||
float LayoutScale;
|
||||
float RcpLayoutScale;
|
||||
float LayoutPaddingLeft;
|
||||
float LayoutPaddingTop;
|
||||
};
|
||||
|
||||
extern UIStyles UIStyle;
|
||||
|
||||
ALWAYS_INLINE static float LayoutScale(float v)
|
||||
{
|
||||
return ImCeil(g_layout_scale * v);
|
||||
return ImCeil(UIStyle.LayoutScale * v);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static ImVec2 LayoutScale(const ImVec2& v)
|
||||
{
|
||||
return ImVec2(ImCeil(v.x * g_layout_scale), ImCeil(v.y * g_layout_scale));
|
||||
return ImVec2(ImCeil(v.x * UIStyle.LayoutScale), ImCeil(v.y * UIStyle.LayoutScale));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static ImVec2 LayoutScale(float x, float y)
|
||||
{
|
||||
return ImVec2(ImCeil(x * g_layout_scale), ImCeil(y * g_layout_scale));
|
||||
return ImVec2(ImCeil(x * UIStyle.LayoutScale), ImCeil(y * UIStyle.LayoutScale));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static float LayoutUnscale(float v)
|
||||
{
|
||||
return ImCeil(g_rcp_layout_scale * v);
|
||||
return ImCeil(UIStyle.RcpLayoutScale * v);
|
||||
}
|
||||
ALWAYS_INLINE static ImVec2 LayoutUnscale(const ImVec2& v)
|
||||
{
|
||||
return ImVec2(ImCeil(v.x * g_rcp_layout_scale), ImCeil(v.y * g_rcp_layout_scale));
|
||||
return ImVec2(ImCeil(v.x * UIStyle.RcpLayoutScale), ImCeil(v.y * UIStyle.RcpLayoutScale));
|
||||
}
|
||||
ALWAYS_INLINE static ImVec2 LayoutUnscale(float x, float y)
|
||||
{
|
||||
return ImVec2(ImCeil(x * g_rcp_layout_scale), ImCeil(y * g_rcp_layout_scale));
|
||||
return ImVec2(ImCeil(x * UIStyle.RcpLayoutScale), ImCeil(y * UIStyle.RcpLayoutScale));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static ImVec4 ModAlpha(const ImVec4& v, float a)
|
||||
|
@ -170,7 +175,7 @@ bool BeginFullscreenColumns(const char* title = nullptr, float pos_y = 0.0f, boo
|
|||
void EndFullscreenColumns();
|
||||
|
||||
bool BeginFullscreenColumnWindow(float start, float end, const char* name,
|
||||
const ImVec4& background = UIBackgroundColor);
|
||||
const ImVec4& background = UIStyle.BackgroundColor);
|
||||
void EndFullscreenColumnWindow();
|
||||
|
||||
bool BeginFullscreenWindow(float left, float top, float width, float height, const char* name,
|
||||
|
@ -200,39 +205,41 @@ void ResetMenuButtonFrame();
|
|||
void MenuHeading(const char* title, bool draw_line = true);
|
||||
bool MenuHeadingButton(const char* title, const char* value = nullptr, bool enabled = true, bool draw_line = true);
|
||||
bool ActiveButton(const char* title, bool is_active, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont);
|
||||
bool DefaultActiveButton(const char* title, bool is_active, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont);
|
||||
bool ActiveButtonWithRightText(const char* title, const char* right_title, bool is_active, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont);
|
||||
bool MenuButton(const char* title, const char* summary, bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
bool MenuButtonWithoutSummary(const char* title, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont,
|
||||
const ImVec2& text_align = ImVec2(0.0f, 0.0f));
|
||||
bool MenuButtonWithValue(const char* title, const char* summary, const char* value, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = UIStyle.LargeFont,
|
||||
ImFont* summary_font = UIStyle.MediumFont);
|
||||
bool MenuImageButton(const char* title, const char* summary, ImTextureID user_texture_id, const ImVec2& image_size,
|
||||
bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
const ImVec2& uv0 = ImVec2(0.0f, 0.0f), const ImVec2& uv1 = ImVec2(1.0f, 1.0f),
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font);
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont);
|
||||
bool FloatingButton(const char* text, float x, float y, float width = -1.0f,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, float anchor_x = 0.0f, float anchor_y = 0.0f,
|
||||
bool enabled = true, ImFont* font = g_large_font, ImVec2* out_position = nullptr,
|
||||
bool enabled = true, ImFont* font = UIStyle.LargeFont, ImVec2* out_position = nullptr,
|
||||
bool repeat_button = false);
|
||||
bool ToggleButton(const char* title, const char* summary, bool* v, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = UIStyle.LargeFont,
|
||||
ImFont* summary_font = UIStyle.MediumFont);
|
||||
bool ThreeWayToggleButton(const char* title, const char* summary, std::optional<bool>* v, bool enabled = true,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = g_large_font,
|
||||
ImFont* summary_font = g_medium_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT, ImFont* font = UIStyle.LargeFont,
|
||||
ImFont* summary_font = UIStyle.MediumFont);
|
||||
bool RangeButton(const char* title, const char* summary, s32* value, s32 min, s32 max, s32 increment,
|
||||
const char* format = "%d", bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font, const char* ok_text = "OK");
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont,
|
||||
const char* ok_text = "OK");
|
||||
bool RangeButton(const char* title, const char* summary, float* value, float min, float max, float increment,
|
||||
const char* format = "%f", bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font, const char* ok_text = "OK");
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont,
|
||||
const char* ok_text = "OK");
|
||||
bool EnumChoiceButtonImpl(const char* title, const char* summary, s32* value_pointer,
|
||||
const char* (*to_display_name_function)(s32 value, void* opaque), void* opaque, u32 count,
|
||||
bool enabled, float height, ImFont* font, ImFont* summary_font);
|
||||
|
@ -241,7 +248,7 @@ template<typename DataType, typename CountType>
|
|||
ALWAYS_INLINE static bool EnumChoiceButton(const char* title, const char* summary, DataType* value_pointer,
|
||||
const char* (*to_display_name_function)(DataType value), CountType count,
|
||||
bool enabled = true, float height = LAYOUT_MENU_BUTTON_HEIGHT,
|
||||
ImFont* font = g_large_font, ImFont* summary_font = g_medium_font)
|
||||
ImFont* font = UIStyle.LargeFont, ImFont* summary_font = UIStyle.MediumFont)
|
||||
{
|
||||
s32 value = static_cast<s32>(*value_pointer);
|
||||
auto to_display_name_wrapper = [](s32 value, void* opaque) -> const char* {
|
||||
|
@ -265,13 +272,13 @@ void DrawShadowedText(ImDrawList* dl, ImFont* font, const ImVec2& pos, u32 col,
|
|||
|
||||
void BeginNavBar(float x_padding = LAYOUT_MENU_BUTTON_X_PADDING, float y_padding = LAYOUT_MENU_BUTTON_Y_PADDING);
|
||||
void EndNavBar();
|
||||
void NavTitle(const char* title, float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
void NavTitle(const char* title, float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont);
|
||||
void RightAlignNavButtons(u32 num_items = 0, float item_width = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY,
|
||||
float item_height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY);
|
||||
bool NavButton(const char* title, bool is_active, bool enabled = true, float width = -1.0f,
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = g_large_font);
|
||||
float height = LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImFont* font = UIStyle.LargeFont);
|
||||
bool NavTab(const char* title, bool is_active, bool enabled, float width, float height, const ImVec4& background,
|
||||
ImFont* font = g_large_font);
|
||||
ImFont* font = UIStyle.LargeFont);
|
||||
|
||||
bool BeginHorizontalMenu(const char* name, const ImVec2& position, const ImVec2& size, u32 num_items);
|
||||
void EndHorizontalMenu();
|
||||
|
|
Loading…
Reference in New Issue