mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-29 14:50:20 +00:00
ImGuiOverlays: Draw larger status indicator icons
Always bugged me, but couldn't justify the rasterization time before dynamic fonts.
This commit is contained in:
parent
bf4a89e82e
commit
b98d521ff9
@ -272,7 +272,6 @@ void ImGuiManager::RenderTextOverlays(const GPUBackend* gpu)
|
|||||||
const float spacing = ImCeil(5.0f * scale);
|
const float spacing = ImCeil(5.0f * scale);
|
||||||
float position_y = ImFloor(f_margin);
|
float position_y = ImFloor(f_margin);
|
||||||
DrawPerformanceOverlay(gpu, position_y, scale, margin, spacing);
|
DrawPerformanceOverlay(gpu, position_y, scale, margin, spacing);
|
||||||
DrawFrameTimeOverlay(position_y, scale, margin, spacing);
|
|
||||||
DrawMediaCaptureOverlay(position_y, scale, margin, spacing);
|
DrawMediaCaptureOverlay(position_y, scale, margin, spacing);
|
||||||
|
|
||||||
if (g_gpu_settings.display_show_enhancements && !paused)
|
if (g_gpu_settings.display_show_enhancements && !paused)
|
||||||
@ -321,12 +320,15 @@ static void DrawPerformanceStat(ImDrawList* dl, float& position_y, ImFont* font,
|
|||||||
const size_t len = sv.length();
|
const size_t len = sv.length();
|
||||||
for (; pos < len; pos++)
|
for (; pos < len; pos++)
|
||||||
{
|
{
|
||||||
if (sv[pos] <= '\x04')
|
if (sv[pos] > 0 && sv[pos] <= '\x04')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (text.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
constexpr ImU32 color = IM_COL32(255, 255, 255, 255);
|
constexpr ImU32 color = IM_COL32(255, 255, 255, 255);
|
||||||
constexpr float default_weight = 0.0f;
|
constexpr float default_weight = 0.0f;
|
||||||
std::string_view::size_type pos = 0;
|
std::string_view::size_type pos = 0;
|
||||||
@ -426,10 +428,10 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float shadow_offset = std::ceil(1.0f * scale);
|
const float shadow_offset = std::ceil(1.0f * scale);
|
||||||
|
const float status_size = std::ceil(40.0f * scale);
|
||||||
ImFont* const fixed_font = ImGuiManager::GetFixedFont();
|
ImFont* const fixed_font = ImGuiManager::GetFixedFont();
|
||||||
const float fixed_font_size = ImGuiManager::GetFixedFontSize();
|
const float fixed_font_size = ImGuiManager::GetFixedFontSize();
|
||||||
ImFont* ui_font = ImGuiManager::GetTextFont();
|
ImFont* ui_font = ImGuiManager::GetTextFont();
|
||||||
const float ui_font_size = ImGuiManager::GetOSDFontSize();
|
|
||||||
const float rbound = ImGui::GetIO().DisplaySize.x - margin;
|
const float rbound = ImGui::GetIO().DisplaySize.x - margin;
|
||||||
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
ImDrawList* dl = ImGui::GetBackgroundDrawList();
|
||||||
SmallString text;
|
SmallString text;
|
||||||
@ -598,17 +600,18 @@ void ImGuiManager::DrawPerformanceOverlay(const GPUBackend* gpu, float& position
|
|||||||
position_y += spacing;
|
position_y += spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawFrameTimeOverlay(position_y, scale, margin, spacing);
|
||||||
|
|
||||||
if (g_gpu_settings.display_show_status_indicators)
|
if (g_gpu_settings.display_show_status_indicators)
|
||||||
{
|
{
|
||||||
SetStatusIndicatorIcons(text, false);
|
SetStatusIndicatorIcons(text, false);
|
||||||
if (!text.empty())
|
DrawPerformanceStat(dl, position_y, ui_font, status_size, 0.0f, 0, shadow_offset, rbound, text);
|
||||||
DRAW_LINE(ui_font, text, IM_COL32(255, 255, 255, 255));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_gpu_settings.display_show_status_indicators && !FullscreenUI::HasActiveWindow())
|
else if (g_gpu_settings.display_show_status_indicators && !FullscreenUI::HasActiveWindow())
|
||||||
{
|
{
|
||||||
SetStatusIndicatorIcons(text, true);
|
SetStatusIndicatorIcons(text, true);
|
||||||
DRAW_LINE(ui_font, text, IM_COL32(255, 255, 255, 255));
|
DrawPerformanceStat(dl, position_y, ui_font, status_size, 0.0f, 0, shadow_offset, rbound, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DRAW_LINE
|
#undef DRAW_LINE
|
||||||
|
@ -1264,6 +1264,11 @@ float ImGuiManager::GetOSDFontSize()
|
|||||||
return std::ceil(17.0f * s_state.global_scale);
|
return std::ceil(17.0f * s_state.global_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ImGuiManager::OSDScale(float size)
|
||||||
|
{
|
||||||
|
return std::ceil(size * s_state.global_scale);
|
||||||
|
}
|
||||||
|
|
||||||
bool ImGuiManager::WantsTextInput()
|
bool ImGuiManager::WantsTextInput()
|
||||||
{
|
{
|
||||||
return s_state.imgui_wants_keyboard.load(std::memory_order_acquire);
|
return s_state.imgui_wants_keyboard.load(std::memory_order_acquire);
|
||||||
|
@ -140,6 +140,9 @@ float GetDebugFontSize(float window_scale);
|
|||||||
/// Returns the font size for rendering the OSD.
|
/// Returns the font size for rendering the OSD.
|
||||||
float GetOSDFontSize();
|
float GetOSDFontSize();
|
||||||
|
|
||||||
|
/// Multiplies an arbitrary size by the OSD scale.
|
||||||
|
float OSDScale(float size);
|
||||||
|
|
||||||
/// Returns true if imgui wants to intercept text input.
|
/// Returns true if imgui wants to intercept text input.
|
||||||
bool WantsTextInput();
|
bool WantsTextInput();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user