mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-11 22:49:56 +00:00
FSUI: Adjust sizes to match new font sizes
This commit is contained in:
+30
-24
@@ -2291,6 +2291,7 @@ void Achievements::DrawPauseMenuOverlays()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
|
||||
if (!HasActiveGame())
|
||||
@@ -2306,14 +2307,14 @@ void Achievements::DrawPauseMenuOverlays()
|
||||
|
||||
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.second + (g_medium_font.second * 2.0f);
|
||||
const float start_y = LayoutScale(10.0f + 4.0f + 4.0f) + GetLineHeight(g_large_font) + (GetLineHeight(g_medium_font) * 2.0f);
|
||||
const float margin = LayoutScale(10.0f);
|
||||
const float spacing = LayoutScale(10.0f);
|
||||
const float padding = LayoutScale(10.0f);
|
||||
|
||||
const float max_text_width = ImGuiFullscreen::LayoutScale(300.0f);
|
||||
const float row_width = max_text_width + padding + padding + image_size.x + spacing;
|
||||
const float title_height = padding + font.second + padding;
|
||||
const float title_height = padding + GetLineHeight(font) + padding;
|
||||
|
||||
if (!s_active_challenge_indicators.empty())
|
||||
{
|
||||
@@ -2327,7 +2328,7 @@ void Achievements::DrawPauseMenuOverlays()
|
||||
TRANSLATE("Achievements", "Active Challenge Achievements"));
|
||||
|
||||
const float y_advance = image_size.y + spacing;
|
||||
const float acheivement_name_offset = (image_size.y - font.second) / 2.0f;
|
||||
const float acheivement_name_offset = (image_size.y - GetLineHeight(font)) / 2.0f;
|
||||
const float max_non_ellipised_text_width = max_text_width - LayoutScale(10.0f);
|
||||
ImVec2 position(box_min.x + padding, box_min.y + title_height);
|
||||
|
||||
@@ -2396,6 +2397,7 @@ void Achievements::DrawAchievementsWindow()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
|
||||
if (!s_achievement_list)
|
||||
@@ -2457,19 +2459,19 @@ void Achievements::DrawAchievementsWindow()
|
||||
FullscreenUI::ReturnToPreviousWindow();
|
||||
}
|
||||
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + g_large_font.second));
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_large_font)));
|
||||
text.assign(s_open_subset ? s_open_subset->title : s_game_title);
|
||||
|
||||
if (s_hardcore_mode)
|
||||
text.append(TRANSLATE_SV("Achievements", " (Hardcore Mode)"));
|
||||
|
||||
top += g_large_font.second + spacing;
|
||||
top += GetLineHeight(g_large_font) + spacing;
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
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.second));
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_medium_font)));
|
||||
UpdateGameSummary();
|
||||
|
||||
rc_client_user_game_summary_t display_summary = {};
|
||||
@@ -2499,7 +2501,7 @@ void Achievements::DrawAchievementsWindow()
|
||||
text.assign(TRANSLATE_SV("Achievements", "This game has no achievements."));
|
||||
}
|
||||
|
||||
top += g_medium_font.second + spacing;
|
||||
top += GetLineHeight(g_medium_font) + spacing;
|
||||
|
||||
ImGui::PushFont(g_medium_font.first, g_medium_font.second);
|
||||
ImGui::RenderTextClipped(
|
||||
@@ -2735,6 +2737,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
using ImGuiFullscreen::LayoutUnscale;
|
||||
|
||||
@@ -2758,7 +2761,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
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.second, 0.0f));
|
||||
const float extra_summary_height = LayoutUnscale(std::max(summary_text_size.y - GetLineHeight(g_medium_font), 0.0f));
|
||||
|
||||
ImRect bb;
|
||||
bool visible, hovered;
|
||||
@@ -2796,7 +2799,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
|
||||
SmallString text;
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + spacing;
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + spacing;
|
||||
text.format((cheevo->points != 1) ? TRANSLATE_FS("Achievements", "{} points") : TRANSLATE_FS("Achievements", "{} point"), cheevo->points);
|
||||
|
||||
const ImVec2 points_size(g_medium_font.first->CalcTextSizeA(g_medium_font.second, FLT_MAX, 0.0f, text.c_str(), text.end_ptr()));
|
||||
@@ -2869,7 +2872,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
|
||||
}
|
||||
|
||||
const ImRect title_bb(ImVec2(text_start_x, bb.Min.y), ImVec2(title_max_x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint), ImVec2(points_start, midpoint + g_medium_font.second + extra_summary_height));
|
||||
const ImRect summary_bb(ImVec2(text_start_x, midpoint), ImVec2(points_start, midpoint + GetLineHeight(g_medium_font) + 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));
|
||||
@@ -2916,7 +2919,7 @@ 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.second + progress_spacing;
|
||||
const float top = midpoint + GetLineHeight(g_medium_font) + 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));
|
||||
@@ -2962,6 +2965,7 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
@@ -3061,10 +3065,10 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
}
|
||||
}
|
||||
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + g_large_font.second));
|
||||
const ImRect title_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_large_font)));
|
||||
text.assign(Achievements::GetGameTitle());
|
||||
|
||||
top += g_large_font.second + spacing;
|
||||
top += GetLineHeight(g_large_font) + spacing;
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
ImGui::RenderTextClipped(title_bb.Min, title_bb.Max, text.c_str(), text.end_ptr(), nullptr, ImVec2(0.0f, 0.0f), &title_bb);
|
||||
@@ -3072,10 +3076,10 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
|
||||
if (is_leaderboard_open)
|
||||
{
|
||||
const ImRect subtitle_bb(ImVec2(left, top), ImVec2(right, top + g_large_font.second));
|
||||
const ImRect subtitle_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_large_font)));
|
||||
text.assign(s_open_leaderboard->title);
|
||||
|
||||
top += g_large_font.second + spacing_small;
|
||||
top += GetLineHeight(g_large_font) + spacing_small;
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
ImGui::RenderTextClipped(
|
||||
@@ -3092,8 +3096,8 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
text.format(TRANSLATE_FS("Achievements", "This game has {} leaderboards."), count);
|
||||
}
|
||||
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font.second));
|
||||
top += g_medium_font.second + spacing_small;
|
||||
const ImRect summary_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_medium_font)));
|
||||
top += GetLineHeight(g_medium_font) + spacing_small;
|
||||
|
||||
ImGui::PushFont(g_medium_font.first, g_medium_font.second);
|
||||
ImGui::RenderTextClipped(
|
||||
@@ -3101,8 +3105,8 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
|
||||
if (!is_leaderboard_open && !Achievements::IsHardcoreModeActive())
|
||||
{
|
||||
const ImRect hardcore_warning_bb(ImVec2(left, top), ImVec2(right, top + g_medium_font.second));
|
||||
top += g_medium_font.second + spacing_small;
|
||||
const ImRect hardcore_warning_bb(ImVec2(left, top), ImVec2(right, top + GetLineHeight(g_medium_font)));
|
||||
top += GetLineHeight(g_medium_font) + spacing_small;
|
||||
|
||||
ImGui::RenderTextClipped(hardcore_warning_bb.Min, hardcore_warning_bb.Max,
|
||||
TRANSLATE("Achievements", "Submitting scores is disabled because hardcore mode is off. Leaderboards are read-only."),
|
||||
@@ -3147,7 +3151,7 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
ImGuiFullscreen::MenuButtonFrame(
|
||||
"legend", false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, &visible, &hovered, &bb.Min, &bb.Max, 0, alpha);
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + LayoutScale(4.0f);
|
||||
const float icon_column_width = bb.Max.y - bb.Min.y;
|
||||
float column_left = bb.Min.x + LayoutScale(15.0f) + padding;
|
||||
|
||||
@@ -3189,7 +3193,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.second + line_padding);
|
||||
const ImVec2 line_start(bb.Min.x, bb.Min.y + GetLineHeight(g_large_font) + 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);
|
||||
}
|
||||
@@ -3279,7 +3283,7 @@ void Achievements::DrawLeaderboardsWindow()
|
||||
ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, &visible, &hovered, &bb.Min, &bb.Max);
|
||||
if (visible)
|
||||
{
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
@@ -3323,6 +3327,7 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
|
||||
float name_column_width, float time_column_width, float column_spacing)
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
@@ -3334,7 +3339,7 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + LayoutScale(4.0f);
|
||||
const float column_padding = LayoutScale(15.0f);
|
||||
const float icon_column_width = bb.Max.y - bb.Min.y;
|
||||
float column_left = bb.Min.x + column_padding;
|
||||
@@ -3403,6 +3408,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
|
||||
{
|
||||
using ImGuiFullscreen::g_large_font;
|
||||
using ImGuiFullscreen::g_medium_font;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::LayoutScale;
|
||||
|
||||
static constexpr float alpha = 0.8f;
|
||||
@@ -3424,7 +3430,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
|
||||
s_restore_leaderboard_focus = false;
|
||||
}
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + 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);
|
||||
|
||||
@@ -2642,7 +2642,7 @@ void FullscreenUI::DrawGameList(const ImVec2& heading_size)
|
||||
|
||||
DrawGameCover(entry, ImGui::GetWindowDrawList(), bb.Min, bb.Min + image_size);
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + 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);
|
||||
|
||||
@@ -70,6 +70,7 @@ using ImGuiFullscreen::GetCachedSvgTexture;
|
||||
using ImGuiFullscreen::GetCachedSvgTextureAsync;
|
||||
using ImGuiFullscreen::GetCachedTexture;
|
||||
using ImGuiFullscreen::GetCachedTextureAsync;
|
||||
using ImGuiFullscreen::GetLineHeight;
|
||||
using ImGuiFullscreen::GetPlaceholderTexture;
|
||||
using ImGuiFullscreen::GetQueuedFocusResetType;
|
||||
using ImGuiFullscreen::HorizontalMenuItem;
|
||||
|
||||
@@ -291,7 +291,7 @@ void FullscreenUI::DrawInputBindingButton(
|
||||
}
|
||||
}
|
||||
|
||||
const float midpoint = bb.Min.y + g_large_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(g_large_font) + LayoutScale(4.0f);
|
||||
|
||||
if (oneline)
|
||||
{
|
||||
|
||||
@@ -1404,7 +1404,7 @@ bool ImGuiFullscreen::MenuButton(const char* title, const char* summary, bool en
|
||||
if (!visible)
|
||||
return false;
|
||||
|
||||
const float midpoint = bb.Min.y + font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(font) + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
@@ -1437,7 +1437,7 @@ bool ImGuiFullscreen::MenuButtonWithoutSummary(const char* title, bool enabled,
|
||||
if (!visible)
|
||||
return false;
|
||||
|
||||
const float midpoint = bb.Min.y + font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(font) + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
@@ -1467,7 +1467,7 @@ bool ImGuiFullscreen::MenuImageButton(const char* title, const char* summary, Im
|
||||
ImGui::GetWindowDrawList()->AddImage(user_texture_id, bb.Min, bb.Min + image_size, uv0, uv1,
|
||||
enabled ? IM_COL32(255, 255, 255, 255) : ImGui::GetColorU32(ImGuiCol_TextDisabled));
|
||||
|
||||
const float midpoint = bb.Min.y + title_font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(title_font) + 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);
|
||||
@@ -1592,7 +1592,7 @@ bool ImGuiFullscreen::ToggleButton(
|
||||
if (!visible)
|
||||
return false;
|
||||
|
||||
const float midpoint = bb.Min.y + font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(font) + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
@@ -1663,7 +1663,7 @@ bool ImGuiFullscreen::ThreeWayToggleButton(
|
||||
if (!visible)
|
||||
return false;
|
||||
|
||||
const float midpoint = bb.Min.y + font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(font) + LayoutScale(4.0f);
|
||||
const ImRect title_bb(bb.Min, ImVec2(bb.Max.x, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), bb.Max);
|
||||
|
||||
@@ -1742,7 +1742,7 @@ bool ImGuiFullscreen::MenuButtonWithValue(
|
||||
|
||||
const ImVec2 value_size(ImGui::CalcTextSize(value));
|
||||
|
||||
const float midpoint = bb.Min.y + font.second + LayoutScale(4.0f);
|
||||
const float midpoint = bb.Min.y + GetLineHeight(font) + LayoutScale(4.0f);
|
||||
const float text_end = bb.Max.x - value_size.x;
|
||||
const ImRect title_bb(bb.Min, ImVec2(text_end, midpoint));
|
||||
const ImRect summary_bb(ImVec2(bb.Min.x, midpoint), ImVec2(text_end, bb.Max.y));
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace ImGuiFullscreen
|
||||
|
||||
static constexpr float LAYOUT_SCREEN_WIDTH = 1280.0f;
|
||||
static constexpr float LAYOUT_SCREEN_HEIGHT = 720.0f;
|
||||
static constexpr float LAYOUT_LARGE_FONT_SIZE = 26.0f;
|
||||
static constexpr float LAYOUT_MEDIUM_FONT_SIZE = 16.0f;
|
||||
static constexpr float LAYOUT_LARGE_FONT_SIZE = 22.0f;
|
||||
static constexpr float LAYOUT_MEDIUM_FONT_SIZE = 14.0f;
|
||||
static constexpr float LAYOUT_SMALL_FONT_SIZE = 10.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_HEIGHT = 50.0f;
|
||||
static constexpr float LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY = 26.0f;
|
||||
@@ -71,6 +71,9 @@ namespace ImGuiFullscreen
|
||||
static __fi float LayoutScale(float v) { return ImCeil(g_layout_scale * v); }
|
||||
static __fi ImVec2 LayoutScale(const ImVec2& v) { return ImVec2(ImCeil(v.x * g_layout_scale), ImCeil(v.y * g_layout_scale)); }
|
||||
static __fi ImVec2 LayoutScale(float x, float y) { return ImVec2(ImCeil(x * g_layout_scale), ImCeil(y * g_layout_scale)); }
|
||||
/// Get the height of a line of text including the space to the next line.
|
||||
/// Matches the result returned by CalcTextSizeA for one line of text.
|
||||
static __fi float GetLineHeight(std::pair<ImFont*, float> font) { return ImCeil(font.second * font.first->LineHeight); }
|
||||
|
||||
static __fi float LayoutUnscale(float v) { return ImCeil(g_rcp_layout_scale * v); }
|
||||
static __fi ImVec2 LayoutUnscale(const ImVec2& v) { return ImVec2(ImCeil(v.x * g_rcp_layout_scale), ImCeil(v.y * g_rcp_layout_scale)); }
|
||||
|
||||
@@ -490,6 +490,8 @@ static u32 GetFontIndex(const ImGuiManager::FontInfo& font)
|
||||
|
||||
// A resonable default font size is recommended
|
||||
#define FONT_BASE_SIZE 15.0f
|
||||
#define FONT_LINE_HEIGHT 1.25f
|
||||
#define FONT_ICON_SIZE (FONT_BASE_SIZE * 1.2f)
|
||||
|
||||
ImFont* ImGuiManager::AddTextFont()
|
||||
{
|
||||
@@ -500,6 +502,7 @@ ImFont* ImGuiManager::AddTextFont()
|
||||
|
||||
std::vector<ImWchar> exclude;
|
||||
ImFontConfig cfg;
|
||||
cfg.LineHeight = FONT_LINE_HEIGHT;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
ImFont* res = nullptr;
|
||||
for (const FontInfo& info : s_font_info)
|
||||
@@ -533,6 +536,7 @@ ImFont* ImGuiManager::AddTextFont()
|
||||
ImFont* ImGuiManager::AddFixedFont()
|
||||
{
|
||||
ImFontConfig cfg;
|
||||
cfg.LineHeight = FONT_LINE_HEIGHT;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
return ImGui::GetIO().Fonts->AddFontFromMemoryTTF(
|
||||
s_fixed_font_data.data(), static_cast<int>(s_fixed_font_data.size()), FONT_BASE_SIZE, &cfg, nullptr);
|
||||
@@ -548,8 +552,8 @@ bool ImGuiManager::AddIconFonts()
|
||||
ImFontConfig cfg;
|
||||
cfg.MergeMode = true;
|
||||
cfg.PixelSnapH = true;
|
||||
cfg.GlyphMinAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMinAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.GlyphExcludeRanges = range_exclude_emojis;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
|
||||
@@ -567,13 +571,13 @@ bool ImGuiManager::AddIconFonts()
|
||||
ImFontConfig cfg;
|
||||
cfg.MergeMode = true;
|
||||
cfg.PixelSnapH = true;
|
||||
cfg.GlyphMinAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMinAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.GlyphExcludeRanges = range_exclude_non_bmp;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
|
||||
if (!ImGui::GetIO().Fonts->AddFontFromMemoryTTF(
|
||||
s_icon_fa_font_data.data(), static_cast<int>(s_icon_fa_font_data.size()), FONT_BASE_SIZE * 0.75f, &cfg, nullptr))
|
||||
s_icon_fa_font_data.data(), static_cast<int>(s_icon_fa_font_data.size()), FONT_BASE_SIZE * 0.9f, &cfg, nullptr))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -626,8 +630,8 @@ bool ImGuiManager::AddEmojiFont()
|
||||
ImFontConfig cfg;
|
||||
cfg.MergeMode = true;
|
||||
// Set GlyphMin/MaxAdvanceX to allow replacing FA/PF icons.
|
||||
cfg.GlyphMinAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_BASE_SIZE;
|
||||
cfg.GlyphMinAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.GlyphMaxAdvanceX = FONT_ICON_SIZE;
|
||||
cfg.FontLoaderFlags |= ImGuiFreeTypeLoaderFlags_LoadColor;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
|
||||
@@ -960,7 +964,7 @@ ImFont* ImGuiManager::GetFixedFont()
|
||||
|
||||
float ImGuiManager::GetFontSizeStandard()
|
||||
{
|
||||
return std::ceil(15.0f * s_global_scale);
|
||||
return std::ceil(12.0f * s_global_scale);
|
||||
}
|
||||
|
||||
float ImGuiManager::GetFontSizeMedium()
|
||||
|
||||
@@ -190,6 +190,7 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
|
||||
|
||||
ImFont* const fixed_font = ImGuiManager::GetFixedFont();
|
||||
const float font_size = ImGuiManager::GetFontSizeStandard();
|
||||
const float line_height = ImGuiFullscreen::GetLineHeight({ fixed_font, font_size });
|
||||
|
||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||
ImVec2 text_size;
|
||||
@@ -201,14 +202,14 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
|
||||
case OsdOverlayPos::Center:
|
||||
case OsdOverlayPos::CenterRight:
|
||||
|
||||
position_y = (GetWindowHeight() - (font_size * 8.0f)) * 0.5f;
|
||||
position_y = (GetWindowHeight() - (line_height * 8.0f)) * 0.5f;
|
||||
break;
|
||||
|
||||
case OsdOverlayPos::BottomLeft:
|
||||
case OsdOverlayPos::BottomCenter:
|
||||
case OsdOverlayPos::BottomRight:
|
||||
|
||||
position_y = GetWindowHeight() - margin - (font_size * 15.0f + spacing * 14.0f);
|
||||
position_y = GetWindowHeight() - margin - (line_height * 15.0f + spacing * 14.0f);
|
||||
break;
|
||||
|
||||
case OsdOverlayPos::TopLeft:
|
||||
@@ -522,9 +523,9 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
|
||||
min_text_x = wpos.x + history_size.x - text_size.x - spacing; // Right alignment within window
|
||||
break;
|
||||
}
|
||||
win_dl->AddText(ImVec2(min_text_x + shadow_offset, wpos.y + history_size.y - font_size + shadow_offset),
|
||||
win_dl->AddText(ImVec2(min_text_x + shadow_offset, wpos.y + history_size.y - text_size.y + shadow_offset),
|
||||
IM_COL32(0, 0, 0, 100), frame_times_text.c_str(), frame_times_text.c_str() + frame_times_text.length());
|
||||
win_dl->AddText(ImVec2(min_text_x, wpos.y + history_size.y - font_size),
|
||||
win_dl->AddText(ImVec2(min_text_x, wpos.y + history_size.y - text_size.y),
|
||||
white_color, frame_times_text.c_str(), frame_times_text.c_str() + frame_times_text.length());
|
||||
}
|
||||
ImGui::End();
|
||||
@@ -687,6 +688,7 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
|
||||
const float shadow_offset = std::ceil(scale);
|
||||
ImFont* const font = ImGuiManager::GetStandardFont();
|
||||
const float font_size = ImGuiManager::GetFontSizeStandard();
|
||||
const float line_height = ImGuiFullscreen::GetLineHeight({ font, font_size });
|
||||
|
||||
static constexpr u32 text_color = IM_COL32(0xff, 0xff, 0xff, 255);
|
||||
static constexpr u32 shadow_color = IM_COL32(0x00, 0x00, 0x00, 100);
|
||||
@@ -709,7 +711,7 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
|
||||
}
|
||||
|
||||
float current_x = ImFloor(margin);
|
||||
float current_y = ImFloor(display_size.y - margin - ((static_cast<float>(num_ports) * (font_size + spacing)) - spacing));
|
||||
float current_y = ImFloor(display_size.y - margin - ((static_cast<float>(num_ports) * (line_height + spacing)) - spacing));
|
||||
const ImVec4 clip_rect(current_x, current_y, display_size.x - margin, display_size.y);
|
||||
|
||||
SmallString text;
|
||||
@@ -761,12 +763,12 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
|
||||
}
|
||||
}
|
||||
|
||||
dl->AddText(font, font_size, ImVec2(current_x + shadow_offset, current_y + shadow_offset), shadow_color, text.c_str(),
|
||||
text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(
|
||||
font, font_size, ImVec2(current_x, current_y), text_color, text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(font, font_size, ImVec2(current_x + shadow_offset, current_y + shadow_offset), shadow_color,
|
||||
text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(font, font_size, ImVec2(current_x, current_y), text_color,
|
||||
text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
|
||||
current_y += font_size + spacing;
|
||||
current_y += line_height + spacing;
|
||||
}
|
||||
|
||||
for (u32 port = 0; port < USB::NUM_PORTS; port++)
|
||||
@@ -814,12 +816,12 @@ __ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spaci
|
||||
}
|
||||
}
|
||||
|
||||
dl->AddText(font, font_size, ImVec2(current_x + shadow_offset, current_y + shadow_offset), shadow_color, text.c_str(),
|
||||
text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(
|
||||
font, font_size, ImVec2(current_x, current_y), text_color, text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(font, font_size, ImVec2(current_x + shadow_offset, current_y + shadow_offset), shadow_color,
|
||||
text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
dl->AddText(font, font_size, ImVec2(current_x, current_y), text_color,
|
||||
text.c_str(), text.c_str() + text.length(), 0.0f, &clip_rect);
|
||||
|
||||
current_y += font_size + spacing;
|
||||
current_y += line_height + spacing;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user