Added extra end-game stats
This commit is contained in:
parent
f66952ef5c
commit
2227c7ac52
@ -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<int> 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});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user