Skip to content

Commit

Permalink
Merge pull request doodlum#157 from TheRiverwoodModder/dev
Browse files Browse the repository at this point in the history
fix: fix ImGui Assert
  • Loading branch information
doodlum authored Jan 24, 2024
2 parents f989884 + 1d4bd31 commit 36215c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void SetupImGuiStyle()
}

bool IsEnabled = false;
ImVec4 TextColor = ImVec4{ 1.0f, 0.0f, 1.0f, 1.0f };

Menu::~Menu()
{
Expand Down Expand Up @@ -139,6 +140,7 @@ void Menu::DrawSettings()
ImGui::SetNextWindowSize({ 1000, 1000 }, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowPos({ 0, 0 }, ImGuiCond_FirstUseEver);
if (ImGui::Begin(std::format("Skyrim Community Shaders {}", Plugin::VERSION.string(".")).c_str(), &IsEnabled)) {
ImGui::PushStyleColor(ImGuiCol_Text, TextColor);
auto& shaderCache = SIE::ShaderCache::Instance();

if (ImGui::BeginTable("##LeButtons", 4, ImGuiTableFlags_SizingStretchSame)) {
Expand Down Expand Up @@ -488,6 +490,7 @@ void Menu::DrawSettings()

ImGui::EndTable();
}
ImGui::PopStyleColor(1);
}

ImGui::End();
Expand Down Expand Up @@ -543,7 +546,7 @@ void Menu::DrawOverlay()

ImGui::End();
} else if (failed) {
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 0, 0, 255));
TextColor = ImVec4{ 1.0f, 0.0f, 0.0f, 1.0f };
if (!hide) {
ImGui::SetNextWindowBgAlpha(1);
ImGui::SetNextWindowPos(ImVec2(10, 10));
Expand All @@ -552,12 +555,12 @@ void Menu::DrawOverlay()
return;
}

ImGui::Text("ERROR: %d shaders failed to compile. Check installation and CommunityShaders.log", failed, totalShaders);
ImGui::TextColored(TextColor, "ERROR: %d shaders failed to compile. Check installation and CommunityShaders.log", failed, totalShaders);
ImGui::End();
}
} else {
// Done compiling with no failures
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
TextColor = ImVec4{ 1.0f, 1.0f, 1.0f, 1.0f };
}

if (IsEnabled) {
Expand Down

0 comments on commit 36215c6

Please sign in to comment.