if(menu_index == 1)
{
- load_to_csv();
+ load_to_csv(playerText);
menu = true;
menu_index = 1;
}
}
//spara namn till fil
-void GameOver_menu::load_to_csv()
+void GameOver_menu::load_to_csv(sf::Text playertext)
{
- std::string current_line{"Gorilla, " + std::to_string(points)};
+ std::string current_line{playerText.getString() + ", " + std::to_string(points)};
std::ifstream highscore_file_r{"assets/highscore.csv"};
std::vector<std::string> lines_read;
void update(Context& context) override;
void render(sf::RenderWindow& window) const override;
void handle_input(sf::Event& event) override;
- void load_to_csv();
+ void load_to_csv(sf::Text playerText);
private:
sf::Texture texture;