diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-01-24 11:00:58 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-01-24 11:00:58 -0600 |
| commit | c08671c4ce00dddf0ed85eb7cebfae4f2b01fc09 (patch) | |
| tree | 94b9dd60b872c918dd711954616d4cfbe0cf2fd4 /Source/Core/VideoCommon/OnScreenDisplay.cpp | |
| parent | 42c03c4dadd9e507a91b07bb01ff597bbd1df728 (diff) | |
VideoCommon/OSD: Process OSD messages even when they are disabled.
Diffstat (limited to 'Source/Core/VideoCommon/OnScreenDisplay.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/OnScreenDisplay.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 35e35b217f..68afd3e6ab 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -94,29 +94,31 @@ void AddMessage(std::string message, u32 ms, u32 rgba) void DrawMessages() { - if (!SConfig::GetInstance().bOnScreenDisplayMessages) - return; + const bool draw_messages = SConfig::GetInstance().bOnScreenDisplayMessages; + const u32 now = Common::Timer::GetTimeMs(); + const float current_x = LEFT_MARGIN * ImGui::GetIO().DisplayFramebufferScale.x; + float current_y = TOP_MARGIN * ImGui::GetIO().DisplayFramebufferScale.y; + int index = 0; - { - std::lock_guard lock{s_messages_mutex}; + std::lock_guard lock{s_messages_mutex}; - const u32 now = Common::Timer::GetTimeMs(); - float current_x = LEFT_MARGIN * ImGui::GetIO().DisplayFramebufferScale.x; - float current_y = TOP_MARGIN * ImGui::GetIO().DisplayFramebufferScale.y; - int index = 0; + for (auto it = s_messages.begin(); it != s_messages.end();) + { + const Message& msg = it->second; + const int time_left = static_cast<int>(msg.timestamp - now); - auto it = s_messages.begin(); - while (it != s_messages.end()) + if (time_left <= 0) { - const Message& msg = it->second; - const int time_left = static_cast<int>(msg.timestamp - now); - current_y += DrawMessage(index++, msg, ImVec2(current_x, current_y), time_left); - - if (time_left <= 0) - it = s_messages.erase(it); - else - ++it; + it = s_messages.erase(it); + continue; } + else + { + ++it; + } + + if (draw_messages) + current_y += DrawMessage(index++, msg, ImVec2(current_x, current_y), time_left); } } |
