// Points text
- pointstext = sf::Text{ "Your points: " + std::to_string(points), font, 30 };
+ pointstext = sf::Text{ "Your points: " + std::to_string(points), font, 30};
sf::FloatRect gbp {pointstext.getGlobalBounds()};
pointstext.setOrigin(gbp.width / 2, gbp.height / 2);
pointstext.setPosition (S_WIDTH / 2 , ((S_HEIGHT / 2) - 100));
pointstext.setFillColor(sf::Color::Black);
// Fun fact
- funfacttext = sf::Text{"You can buy: " + std::to_string(static_cast<float>(points)/static_cast<float>(79)) + " Kir!", font, 14 };
+ funfacttext = sf::Text{"You can buy: " +
+ std::to_string(static_cast<float>(points)/static_cast<float>(79)) +
+ " Kir!", font, 14 };
sf::FloatRect gbff {funfacttext.getGlobalBounds()};
funfacttext.setOrigin(gbff.width / 2, gbff.height / 2);
funfacttext.setPosition (S_WIDTH / 2 , ((S_HEIGHT / 2) - 70));
}
// mouse placement
- mouse_r.setPosition(((S_WIDTH / 2) + 60 - 30*(menu_index - 1)), ((S_HEIGHT / 2) + 80 + 50*(menu_index - 1)));
- mouse_l.setPosition(((S_WIDTH / 2) - 58 + 30*(menu_index - 1)), ((S_HEIGHT / 2) + 80 + 50*(menu_index - 1)));
+ mouse_r.setPosition(((S_WIDTH / 2) + 60 - 30*(menu_index - 1)),
+ ((S_HEIGHT / 2) + 80 + 50*(menu_index - 1)));
+ mouse_l.setPosition(((S_WIDTH / 2) - 58 + 30*(menu_index - 1)),
+ ((S_HEIGHT / 2) + 80 + 50*(menu_index - 1)));
}
void GameOver_menu::load_to_csv()
{
- std::string current_line{playerText.getString() + ", " + std::to_string(points)};
+ std::string current_line{playerText.getString() +
+ ", " + std::to_string(points)};
- std::ifstream highscore_file_r{data["game_constants"]["highscore_file"].get<std::string>()};
+ std::ifstream highscore_file_r{
+ data["game_constants"]["highscore_file"].get<std::string>()};
std::vector<std::string> lines_read;
std::vector<std::string> lines_write;
- for (std::string one_line; std::getline(highscore_file_r, one_line);lines_read.push_back(one_line));
+ for (std::string one_line; std::getline(highscore_file_r, one_line);)
+ {
+ lines_read.push_back(one_line);
+ }
+
bool added {false};
- for (std::string::size_type line_count{0}; line_count < lines_read.size(); line_count++)
+ for (std::string::size_type line_count{0};
+ line_count < lines_read.size(); line_count++)
{
- if (!added && points > std::stoi(lines_read[line_count].substr(lines_read[line_count].find_first_of(',') + 1)))
+ if (!added && points > std::stoi(lines_read[line_count].substr(
+ lines_read[line_count].find_first_of(',') + 1)))
{
lines_write.push_back(current_line);
added = true;
}
- if (lines_write.size() > data["game_constants"]["scoreboard"]) lines_write.pop_back();
+ if (lines_write.size() > data["game_constants"]["scoreboard"])
+ {
+ lines_write.pop_back();
+ }
highscore_file_r.close();
- std::ofstream highscore_file_w{data["game_constants"]["highscore_file"].get<std::string>()};
- for (std::string::size_type line_count{0}; line_count < lines_write.size(); highscore_file_w << lines_write[line_count++] << std::endl);
+ std::ofstream highscore_file_w{
+ data["game_constants"]["highscore_file"].get<std::string>()};
+ for (std::string::size_type line_count{0}; line_count < lines_write.size();
+ highscore_file_w << lines_write[line_count++] << std::endl);
highscore_file_w.close();
}