Skip to content

Commit

Permalink
feat: red text to old level versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkittyy committed Mar 14, 2023
1 parent b649264 commit 8613a26
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions game/gui/leaderboard_modal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ void leaderboard_modal::imdraw(fsm* sm) {
for (int i = 0; i < res.scores.size(); ++i) {
ImGui::PushID(i);
ImGui::TableNextRow();
auto& score = res.scores[i];
bool outdated = score.levelVersion != m_lvl.version;
auto& score = res.scores[i];
bool outdatedLevel = score.levelVersion != m_lvl.version;
bool outdatedScore = score.version != api::get().version();
ImGui::TableNextColumn();
if (score == wr) {
ImGui::Image(resource::get().imtex("assets/gui/crown.png"), sf::Vector2f(16, 16));
Expand Down Expand Up @@ -195,12 +196,15 @@ void leaderboard_modal::imdraw(fsm* sm) {
std::strftime(date_fmt, 100, "%D %r", date_tm);
ImGui::Text("%s", date_fmt);
ImGui::TableNextColumn();
ImGui::TextColored(outdated ? sf::Color::Red : sf::Color::White, "%d%s", score.levelVersion, outdated ? " (outdated)" : "");
if (outdated && ImGui::IsItemHovered()) {
ImGui::TextColored(outdatedLevel ? sf::Color::Red : sf::Color::White, "%d%s", score.levelVersion, outdatedLevel ? " (outdated)" : "");
if (outdatedLevel && ImGui::IsItemHovered()) {
ImGui::SetTooltip("Level has been updated since this replay was ran.");
}
ImGui::TableNextColumn();
ImGui::Text("%s", score.version.c_str());
ImGui::TextColored(outdatedScore ? sf::Color::Red : sf::Color::White, "%s", score.version.c_str());
if (outdatedScore && ImGui::IsItemHovered()) {
ImGui::SetTooltip("Game has been updated since this replay was ran. May not work properly.");
}
ImGui::TableNextColumn();
if (ImGui::ImageButtonWithText(resource::get().imtex("assets/gui/download.png"), "Replay")) {
sm->swap_state<states::edit>(m_lvl, replay(score));
Expand Down

0 comments on commit 8613a26

Please sign in to comment.