ImGuiManager: Split OSD and debug window fonts
Fixes the latter not fitting on screen anymore.
This commit is contained in:
parent
0ba068e843
commit
51cfea49fe
|
@ -232,7 +232,7 @@ void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, float
|
|||
|
||||
const float shadow_offset = std::ceil(1.0f * scale);
|
||||
ImFont* fixed_font = ImGuiManager::GetFixedFont();
|
||||
ImFont* standard_font = ImGuiManager::GetStandardFont();
|
||||
ImFont* standard_font = ImGuiManager::GetOSDFont();
|
||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||
SmallString text;
|
||||
ImVec2 text_size;
|
||||
|
@ -497,7 +497,7 @@ void ImGuiManager::DrawMediaCaptureOverlay(float& position_y, float scale, float
|
|||
return;
|
||||
|
||||
const float shadow_offset = std::ceil(scale);
|
||||
ImFont* const standard_font = ImGuiManager::GetStandardFont();
|
||||
ImFont* const standard_font = ImGuiManager::GetOSDFont();
|
||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||
|
||||
static constexpr const char* ICON = ICON_PF_CIRCLE;
|
||||
|
@ -605,7 +605,7 @@ void ImGuiManager::DrawInputsOverlay()
|
|||
const float shadow_offset = 1.0f * scale;
|
||||
const float margin = 10.0f * scale;
|
||||
const float spacing = 5.0f * scale;
|
||||
ImFont* font = ImGuiManager::GetStandardFont();
|
||||
ImFont* font = ImGuiManager::GetOSDFont();
|
||||
|
||||
static constexpr u32 text_color = IM_COL32(0xff, 0xff, 0xff, 255);
|
||||
static constexpr u32 shadow_color = IM_COL32(0x00, 0x00, 0x00, 100);
|
||||
|
@ -975,6 +975,7 @@ void SaveStateSelectorUI::Draw()
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, padding_and_rounding);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(padding_and_rounding, padding_and_rounding));
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.11f, 0.15f, 0.17f, 0.8f));
|
||||
ImGui::PushFont(ImGuiManager::GetOSDFont());
|
||||
ImGui::SetNextWindowSize(ImVec2(width, height), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f), ImGuiCond_Always,
|
||||
ImVec2(0.5f, 0.5f));
|
||||
|
@ -1094,6 +1095,7 @@ void SaveStateSelectorUI::Draw()
|
|||
}
|
||||
ImGui::End();
|
||||
|
||||
ImGui::PopFont();
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
|
|
|
@ -202,9 +202,8 @@ static std::vector<BackgroundProgressDialogData> s_background_progress_dialogs;
|
|||
static std::mutex s_background_progress_lock;
|
||||
} // namespace ImGuiFullscreen
|
||||
|
||||
void ImGuiFullscreen::SetFonts(ImFont* standard_font, ImFont* medium_font, ImFont* large_font)
|
||||
void ImGuiFullscreen::SetFonts(ImFont* medium_font, ImFont* large_font)
|
||||
{
|
||||
g_standard_font = standard_font;
|
||||
g_medium_font = medium_font;
|
||||
g_large_font = large_font;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ 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_standard_font;
|
||||
extern ImFont* g_medium_font;
|
||||
extern ImFont* g_large_font;
|
||||
|
||||
|
@ -121,7 +120,7 @@ ImRect CenterImage(const ImRect& fit_rect, const ImVec2& image_size);
|
|||
bool Initialize(const char* placeholder_image_path);
|
||||
|
||||
void SetTheme(bool light);
|
||||
void SetFonts(ImFont* standard_font, ImFont* medium_font, ImFont* large_font);
|
||||
void SetFonts(ImFont* medium_font, ImFont* large_font);
|
||||
bool UpdateLayoutScale();
|
||||
|
||||
/// Shuts down, clearing all state.
|
||||
|
|
|
@ -86,6 +86,7 @@ static std::vector<WCharType> s_font_range;
|
|||
static std::vector<WCharType> s_emoji_range;
|
||||
|
||||
static ImFont* s_standard_font;
|
||||
static ImFont* s_osd_font;
|
||||
static ImFont* s_fixed_font;
|
||||
static ImFont* s_medium_font;
|
||||
static ImFont* s_large_font;
|
||||
|
@ -274,7 +275,7 @@ void ImGuiManager::Shutdown()
|
|||
s_fixed_font = nullptr;
|
||||
s_medium_font = nullptr;
|
||||
s_large_font = nullptr;
|
||||
ImGuiFullscreen::SetFonts(nullptr, nullptr, nullptr);
|
||||
ImGuiFullscreen::SetFonts(nullptr, nullptr);
|
||||
}
|
||||
|
||||
float ImGuiManager::GetWindowWidth()
|
||||
|
@ -654,20 +655,24 @@ bool ImGuiManager::AddIconFonts(float size)
|
|||
|
||||
bool ImGuiManager::AddImGuiFonts(bool fullscreen_fonts)
|
||||
{
|
||||
const float standard_font_size = std::ceil(18.0f * s_global_scale);
|
||||
const float fixed_font_size = std::ceil(15.0f * s_global_scale);
|
||||
const float standard_font_size = std::ceil(15.0f * s_global_scale);
|
||||
const float osd_font_size = std::ceil(17.0f * s_global_scale);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->Clear();
|
||||
|
||||
s_standard_font = AddTextFont(standard_font_size);
|
||||
if (!s_standard_font || !AddIconFonts(standard_font_size))
|
||||
if (!s_standard_font)
|
||||
return false;
|
||||
|
||||
s_fixed_font = AddFixedFont(fixed_font_size);
|
||||
s_fixed_font = AddFixedFont(standard_font_size);
|
||||
if (!s_fixed_font)
|
||||
return false;
|
||||
|
||||
s_osd_font = AddTextFont(osd_font_size);
|
||||
if (!s_osd_font || !AddIconFonts(osd_font_size))
|
||||
return false;
|
||||
|
||||
if (fullscreen_fonts)
|
||||
{
|
||||
const float medium_font_size = ImGuiFullscreen::LayoutScale(ImGuiFullscreen::LAYOUT_MEDIUM_FONT_SIZE);
|
||||
|
@ -686,7 +691,7 @@ bool ImGuiManager::AddImGuiFonts(bool fullscreen_fonts)
|
|||
s_large_font = nullptr;
|
||||
}
|
||||
|
||||
ImGuiFullscreen::SetFonts(s_standard_font, s_medium_font, s_large_font);
|
||||
ImGuiFullscreen::SetFonts(s_medium_font, s_large_font);
|
||||
|
||||
return io.Fonts->Build();
|
||||
}
|
||||
|
@ -837,11 +842,11 @@ void ImGuiManager::DrawOSDMessages(Common::Timer::Value current_time)
|
|||
{
|
||||
static constexpr float MOVE_DURATION = 0.5f;
|
||||
|
||||
ImFont* const font = ImGui::GetFont();
|
||||
ImFont* const font = s_osd_font;
|
||||
const float scale = s_global_scale;
|
||||
const float spacing = std::ceil(6.0f * scale);
|
||||
const float margin = std::ceil(12.0f * scale);
|
||||
const float padding = std::ceil(10.0f * scale);
|
||||
const float margin = std::ceil(11.0f * scale);
|
||||
const float padding = std::ceil(9.0f * scale);
|
||||
const float rounding = std::ceil(6.0f * scale);
|
||||
const float max_width = s_window_width - (margin + padding) * 2.0f;
|
||||
float position_x = margin;
|
||||
|
@ -942,6 +947,11 @@ ImFont* ImGuiManager::GetStandardFont()
|
|||
return s_standard_font;
|
||||
}
|
||||
|
||||
ImFont* ImGuiManager::GetOSDFont()
|
||||
{
|
||||
return s_osd_font;
|
||||
}
|
||||
|
||||
ImFont* ImGuiManager::GetFixedFont()
|
||||
{
|
||||
return s_fixed_font;
|
||||
|
|
|
@ -69,6 +69,9 @@ bool AddFullscreenFontsIfMissing();
|
|||
/// Returns the standard font for external drawing.
|
||||
ImFont* GetStandardFont();
|
||||
|
||||
/// Returns the standard font for on-screen display drawing.
|
||||
ImFont* GetOSDFont();
|
||||
|
||||
/// Returns the fixed-width font for external drawing.
|
||||
ImFont* GetFixedFont();
|
||||
|
||||
|
|
Loading…
Reference in New Issue