Skip to content

Commit

Permalink
feat: add colour-coded patch notes #75
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazrius committed Mar 28, 2024
1 parent 08c3fea commit e907997
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChaosMod/Include/Components/ConfigManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ struct PatchNoteSettings
{
bool enable = false;
bool countDownWhileOnBases = true;
bool displayInColor = true;
float timeBetweenPatchesInMinutes = 10.f;
uint changesPerPatchMin = 7;
uint changesPerMinorMin = 15;
Expand Down
13 changes: 8 additions & 5 deletions ChaosMod/Include/ImGui/Menus/Configurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,16 @@ class Configurator final

void RenderRandomTab() const
{
ImGui::Checkbox("Enable Patch Notes", &config->chaosSettings.enable);
ImGui::NewLine();
ImGui::TextWrapped("Patch Notes is a feature where the game will frequently write updates to itself, updating the stats of equipment, ships, NPCs, "
"and everything in between. Periodically when the game deploys a new patch, it will pause and allow you to read what has changed.");
ImGui::NewLine();

ImGui::Checkbox("Enable Patch Notes", &config->patchNotes.enable);
ImGui::Checkbox("Display Colour Notes", &config->patchNotes.displayInColor);
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip(
"'Patch Notes' is a feature where the game will frequently write updates to itself, updating the stats of equipment, ships, NPCs, "
"and everything in between.\n"
"Periodically when the game deploys a new patch, it will pause and allow you to read what has changed.");
ImGui::SetTooltip("Every change within the patch note system can be positive, negative, or neither.\nIf enabled, they will be colour coded to green, red, and yellow respectively.");
}

ImGui::Checkbox("Count Down On Bases", &config->patchNotes.countDownWhileOnBases);
Expand Down
23 changes: 22 additions & 1 deletion ChaosMod/Include/ImGui/Menus/PatchNotesWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,28 @@ class PatchNotesWindow final

if (patchFilter[0] == '\0' || strstr(lowerA, patchFilter) != nullptr)
{
ImGui::Text(change.first.c_str()); // NOLINT(clang-diagnostic-format-security)
if (Get<ConfigManager>()->patchNotes.displayInColor)
{
ImVec4 col = { 1.f, 1.f, 1.f, 1.f };
if (change.first[0] == '+')
{
col = { 0.30f, 1.00f, 0.30f, 1.0f };
}
else if (change.first[0] == '-')
{
col = { 1.f, 0.15f, 0.f, 1.f };
}
else if (change.first[0] == '~')
{
col = { 1.f, 0.85f, 0.f, 1.f };
}

ImGui::TextColored(col, change.first.c_str());
}
else
{
ImGui::Text(change.first.c_str()); // NOLINT(clang-diagnostic-format-security)
}
}
free(lowerA);
}
Expand Down

0 comments on commit e907997

Please sign in to comment.