[UI] Slightly improved performance of on screen notifications and achievements

This commit is contained in:
Gliniak
2026-03-15 00:04:55 +01:00
parent 3f74dfef10
commit dfd450fcbb
4 changed files with 27 additions and 28 deletions

View File

@@ -48,9 +48,9 @@ void HostNotificationWindow::OnDraw(ImGuiIO& io) {
return;
}
const std::string longest_notification_text_line =
GetTitle().size() > GetDescription().size() ? GetTitle().c_str()
: GetDescription().c_str();
const std::string_view longest_notification_text_line =
GetTitle().size() > GetDescription().size() ? GetTitle()
: GetDescription();
const ImVec2 screen_size = io.DisplaySize;
const float window_scale =
@@ -59,7 +59,7 @@ void HostNotificationWindow::OnDraw(ImGuiIO& io) {
const float font_size = io.Fonts->Fonts[0]->FontSize;
const ImVec2 text_size = io.Fonts->Fonts[0]->CalcTextSizeA(
font_size * window_scale, FLT_MAX, -1.0f,
longest_notification_text_line.c_str());
longest_notification_text_line.data());
const ImVec2 notification_size =
CalculateNotificationSize(text_size, window_scale);
@@ -78,9 +78,9 @@ void HostNotificationWindow::OnDraw(ImGuiIO& io) {
{
ImGui::SetWindowFontScale(window_scale);
ImGui::Text("%s", GetTitle().c_str());
ImGui::Text("%s", GetTitle().data());
ImGui::Separator();
ImGui::Text("%s", GetDescription().c_str());
ImGui::Text("%s", GetDescription().data());
}
ImGui::End();
}