// GameOver menu --------------------------------------------
-GameOver_menu::GameOver_menu(int const points, json& params) : texture{}, texture2{}, sprite{}, rectangle{}, mouse_l{}, mouse_r{}, pointstext{},
+GameOver_menu::GameOver_menu(int const points, json& params) : texture{}, texture2{}, sprite{}, rectangle{}, mouse_l{}, mouse_r{}, linetext{}, entertext{}, pointstext{},
playerInput{}, data{}, playerText{}, savetext{}, quittext{}, font{}, exit_game{false}, menu{false}, menu_index{1}, points{points}
{
texture.loadFromFile("assets/game_over.png");
// transparent box
rectangle = sf::CircleShape{200};
- rectangle.setFillColor(sf::Color(255, 255, 0, 128));
+ rectangle.setFillColor(sf::Color(255, 255, 0, 180));
rectangle.setOutlineThickness(7);
- rectangle.setOutlineColor(sf::Color( 0, 0, 0, 200));
+ rectangle.setOutlineColor(sf::Color( 0, 0, 0, 128));
sf::FloatRect gbrs {rectangle.getGlobalBounds()};
rectangle.setOrigin(gbrs.width / 2, gbrs.height / 2);
rectangle.setPosition (S_WIDTH / 2, ((S_HEIGHT / 2)));
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 - 70, ((S_HEIGHT / 2) - 150));
+ pointstext.setPosition (S_WIDTH / 2 , ((S_HEIGHT / 2) - 100));
pointstext.setFillColor(sf::Color::Black);
- //player text input
+ // Enter text
+ entertext = sf::Text{ "Enter your name:", font, 24 };
+ sf::FloatRect gbe {entertext.getGlobalBounds()};
+ entertext.setOrigin(gbe.width / 2, gbe.height / 2);
+ entertext.setPosition (S_WIDTH / 2 , ((S_HEIGHT / 2) - 30));
+ entertext.setFillColor(sf::Color::Black);
+
+
+ // Player text input
playerText.setFont( font );
playerText.setCharacterSize( 24 );
sf::FloatRect gbpt {playerText.getGlobalBounds()};
playerText.setFillColor(sf::Color::Black);
+ // Line text
+ linetext = sf::Text{ "_________________________", font, 24 };
+ sf::FloatRect gblt {linetext.getGlobalBounds()};
+ linetext.setOrigin(gblt.width / 2, gblt.height / 2);
+ linetext.setPosition (S_WIDTH / 2 , ((S_HEIGHT / 2) + 10));
+ linetext.setFillColor(sf::Color::Black);
+
+
// mouse
- texture2.loadFromFile("assets/muspekareGul.png");
+ texture2.loadFromFile("assets/muspekareRed.png");
mouse_l.setTexture(texture2);
mouse_l.setScale(0.1, 0.1);
// changes color on text depending on selection
if( menu_index == 1)
{
- savetext.setFillColor(sf::Color::Yellow);
+ savetext.setFillColor(sf::Color(153, 0, 0));
quittext.setFillColor(sf::Color::Black);
}
else if( menu_index == 2)
{
savetext.setFillColor(sf::Color::Black);
- quittext.setFillColor(sf::Color::Yellow);
+ quittext.setFillColor(sf::Color(153, 0, 0));
}
// mouse placement
- mouse_r.setPosition(((S_WIDTH / 2) + 60), ((S_HEIGHT / 2) - 45 + 50*(menu_index - 1)));
- mouse_l.setPosition(((S_WIDTH / 2) - 58), ((S_HEIGHT / 2) + 2 + 50*(menu_index - 1)));
+ mouse_r.setPosition(((S_WIDTH / 2) + 60 - 30*(menu_index - 1)), ((S_HEIGHT / 2) + 85 + 50*(menu_index - 1)));
+ mouse_l.setPosition(((S_WIDTH / 2) - 58 + 30*(menu_index - 1)), ((S_HEIGHT / 2) + 132 + 50*(menu_index - 1)));
}
window.draw(mouse_l);
window.draw(mouse_r);
+ window.draw(entertext);
window.draw(playerText);
+ window.draw(linetext);
window.draw(pointstext);
window.draw(savetext);
window.draw(quittext);
}
//spara namn till fil
-void GameOver_menu::load_to_csv() const
+void GameOver_menu::load_to_csv()
{
- std::string current_line{"Gorilla," + std::to_string(points)};
+ std::string current_line{"Gorilla, " + std::to_string(points)};
std::ifstream highscore_file_r{"assets/highscore.csv"};
std::vector<std::string> lines_read;