fix log highlighting

This commit is contained in:
Asuro
2025-05-10 14:44:25 +02:00
parent 234a9b1732
commit 5d1db591b7

View File

@@ -212,7 +212,9 @@ namespace Tools
ImGui::TableHeadersRow();
auto& logs = GetLogHistory();
for (int32_t i = 0; i < bx::min(100, LogInternal::LogHistorySize); ++i)
int32_t lineCount = bx::min(100, LogInternal::LogHistorySize);
for (int32_t i = 0; i < lineCount; ++i)
{
int32_t idx = logs.WriteIdx - i - 1;
if (idx < 0) idx += LogInternal::LogHistorySize;
@@ -226,20 +228,6 @@ namespace Tools
const char* filePathRes =
debug.ShortenLogFileNames ? bx::FilePath{filePath}.getFileName().getPtr() : filePath;
// ImVec4 texCol = {1.0f, 1.0f, 1.0f, 1.0f};
// if (logs.WriteType[idx] == ELogType::Warn)
// texCol = {1.0f, 1.0f, 0.8f, 1.0f};
// else if (logs.WriteType[idx] == ELogType::Error)
// texCol = {1.0f, 0.8f, 0.8f, 1.0f};
// ImGui::PushStyleColor(ImGuiCol_Text, texCol);
ImVec4 bgCol = {0.0f, 0.0f, 0.0f, 1.0f};
if (logs.WriteType[idx] == ELogType::Warn)
bgCol = {0.2f, 0.2f, 0.0f, 1.0f};
else if (logs.WriteType[idx] == ELogType::Error)
bgCol = {0.2f, 0.0f, 0.0f, 1.0f};
ImGui::PushStyleColor(ImGuiCol_TableRowBg, bgCol);
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, bgCol);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("%.01f", writeTime);
@@ -254,10 +242,20 @@ namespace Tools
ImGui::TableNextColumn();
ImGui::Text("%s", filePathRes);
ImGui::PopStyleColor(2);
if (i > 0) ImGui::PopStyleColor(2);
ImVec4 bgCol = {0.0f, 0.0f, 0.0f, 1.0f};
if (logs.WriteType[idx] == ELogType::Warn)
bgCol = {0.2f, 0.2f, 0.0f, 1.0f};
else if (logs.WriteType[idx] == ELogType::Error)
bgCol = {0.2f, 0.0f, 0.0f, 1.0f};
ImGui::PushStyleColor(ImGuiCol_TableRowBg, bgCol);
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, bgCol);
}
}
ImGui::EndTable();
if (lineCount > 0) ImGui::PopStyleColor(2);
}
ImGui::End();
if (ImGui::Begin("Rendering"))