GameOver_menu::GameOver_menu(int const points, json& params) : texture{}, texture2{}, sprite{}, rectangle{}, mouse_l{}, mouse_r{}, linetext{}, funfacttext{}, entertext{}, pointstext{},
playerInput{}, data{}, playerText{}, savetext{}, quittext{}, font{}, exit_game{false}, menu{false}, menu_index{1}, points{points}
{
- texture.loadFromFile("assets/game_over.png");
- sprite.setTexture(texture);;
+ std::cout << params["texture"] << "hejsan" << std::endl;
+
+ texture.loadFromFile(params["texture"]);
+ sprite.setTexture(texture);
sprite.setScale(S_SCALE_KOEFF, S_SCALE_KOEFF);
sf::FloatRect gb {sprite.getGlobalBounds()};
sprite.setPosition(0, 0);
// load textfont
- if ( !font.loadFromFile ("assets/fonts/Philosopher-Regular.ttf") )
+ if ( !font.loadFromFile (params["font"]) )
throw std::invalid_argument ("Unable to load font");
//spara namn till fil
void GameOver_menu::load_to_csv(sf::Text playertext)
-{
+{
+ std::cout << data["highscore_file"] << "hej" << std::endl;
+ std::cout << data["game_constants"]["scoreboard"] << "hejdå" << std::endl;
+
std::string current_line{playerText.getString() + ", " + std::to_string(points)};
std::ifstream highscore_file_r{"assets/highscore.csv"};
}
- if (lines_write.size() > data["game_constants"]["scoreboard"]) lines_write.pop_back();
+ if (lines_write.size() > data["scoreboard"]) lines_write.pop_back();
highscore_file_r.close();