From 2227c7ac525bfc6a8e4c8306137f76ce58fbbc5f Mon Sep 17 00:00:00 2001 From: Gordon Weeks <627684+gcweeks@users.noreply.github.com> Date: Sat, 31 Jan 2026 17:54:11 -0800 Subject: [PATCH] Added extra end-game stats --- src/samples/ghhb_game.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/samples/ghhb_game.h b/src/samples/ghhb_game.h index 45030e0..b26024e 100644 --- a/src/samples/ghhb_game.h +++ b/src/samples/ghhb_game.h @@ -1027,11 +1027,50 @@ public: DrawTextEx(font, final_score_text.c_str(), {screen_width / 2.0f - score_w / 2.0f, screen_height / 2.0f - 20}, score_font_size, 1, Color{220, 220, 255, 255}); + std::string longest_combo_text = "Longest combo: " + std::to_string(longest_combo); + float longest_combo_w = MeasureTextEx(font, longest_combo_text.c_str(), score_font_size, 1).x; + DrawTextEx(font, longest_combo_text.c_str(), + {screen_width / 2.0f - longest_combo_w / 2.0f, screen_height / 2.0f + 10}, + score_font_size, 1, Color{220, 220, 255, 255}); + int max_notes = 0; + for (int i = 0; i < MAX_GAMEPADS; i++) + { + if (notes_hit_by_player[i] > max_notes) + max_notes = notes_hit_by_player[i]; + } + if (max_notes > 0) + { + std::vector leaders; + for (int i = 0; i < MAX_GAMEPADS; i++) + { + if (notes_hit_by_player[i] == max_notes) + leaders.push_back(i + 1); + } + std::string most_notes_text; + if (leaders.size() == 1) + most_notes_text = "Most notes: Player " + std::to_string(leaders[0]) + " (" + std::to_string(max_notes) + ")"; + else + { + most_notes_text = "Most notes: Players "; + for (size_t i = 0; i < leaders.size(); i++) + { + if (i > 0) + most_notes_text += " & "; + most_notes_text += std::to_string(leaders[i]); + } + most_notes_text += " (" + std::to_string(max_notes) + ")"; + } + float most_notes_w = MeasureTextEx(font, most_notes_text.c_str(), score_font_size, 1).x; + DrawTextEx(font, most_notes_text.c_str(), + {screen_width / 2.0f - most_notes_w / 2.0f, screen_height / 2.0f + 40}, + score_font_size, 1, Color{220, 220, 255, 255}); + } const char* prompt = "Press Enter to return to menu"; const float prompt_font_size = 20.0f; float prompt_w = MeasureTextEx(font, prompt, prompt_font_size, 1).x; + float prompt_y = (max_notes > 0) ? (screen_height / 2.0f + 70) : (screen_height / 2.0f + 40); DrawTextEx(font, prompt, - {screen_width / 2.0f - prompt_w / 2.0f, screen_height / 2.0f + 40}, + {screen_width / 2.0f - prompt_w / 2.0f, prompt_y}, prompt_font_size, 1, Color{180, 180, 200, 255}); } }