// Scoreboard menu --------------------------------------------
-Scoreboard_menu::Scoreboard_menu() : /*texture{},*/ texture2{}, /*sprite{},*/ menu{false}, exit_game{false},
- startmenutext{}, quittext{}, mouse_r{}, mouse_l{}, font{}, menu_index{1}
+Scoreboard_menu::Scoreboard_menu() : texture{}, texture2{}, sprite{}, menu{false}, exit_game{false},
+ scoreboardtext{}, firstplacetext{}, startmenutext{}, quittext{}, mouse_r{}, mouse_l{}, font{}, menu_index{1}
{
- // Add background later
- /*
- texture.loadFromFile("assets/Pause_bild.png");
+ texture.loadFromFile("assets/scoreboard.png");
sprite.setTexture(texture);;
sprite.setScale(S_SCALE_KOEFF, S_SCALE_KOEFF);
sf::FloatRect gb {sprite.getGlobalBounds()};
sprite.setPosition(0, 0);
- */
+
// mouse
- texture2.loadFromFile("assets/muspekareGul.png");
+ texture2.loadFromFile("assets/muspekare2.png");
mouse_l.setTexture(texture2);
mouse_l.setScale(0.1, 0.1);
throw std::invalid_argument ("Unable to load font");
+ // Scoreboard text
+ scoreboardtext = sf::Text{ "Scoreboard:", font, 39 };
+ sf::FloatRect gbs {scoreboardtext.getGlobalBounds()};
+ scoreboardtext.setOrigin(gbs.width / 2, gbs.height / 2);
+ scoreboardtext.setPosition (S_WIDTH / 2 - 15, ((S_HEIGHT / 2) - 120));
+ scoreboardtext.setFillColor(sf::Color::Red);
+
+ // -----------------------------------------------------------------------
+ // First place text
+ firstplacetext = sf::Text{ "1. NAME 100p\n 2. NAME 39p" , font, 18 };
+ sf::FloatRect gbfp {firstplacetext.getGlobalBounds()};
+ firstplacetext.setOrigin(gbfp.width / 2, gbfp.height / 2);
+ firstplacetext.setPosition (S_WIDTH / 2 - 15, ((S_HEIGHT / 2) - 70));
+ firstplacetext.setFillColor(sf::Color::Red);
+ // -----------------------------------------------------------------------
+
// Start menu text
startmenutext = sf::Text{ "Start menu", font, 24 };
sf::FloatRect gbr {startmenutext.getGlobalBounds()};
startmenutext.setOrigin(gbr.width / 2, gbr.height / 2);
- startmenutext.setPosition (S_WIDTH / 2, ((S_HEIGHT / 2) - 30));
+ startmenutext.setPosition (S_WIDTH / 2 - 15, ((S_HEIGHT / 2) + 80));
// Quit text
quittext = sf::Text{ "Quit", font, 24 };
- sf::FloatRect gbs {quittext.getGlobalBounds()};
- quittext.setOrigin(gbs.width / 2, gbs.height / 2);
- quittext.setPosition (S_WIDTH / 2, ((S_HEIGHT / 2) + 20));
+ sf::FloatRect gbq {quittext.getGlobalBounds()};
+ quittext.setOrigin(gbq.width / 2, gbq.height / 2);
+ quittext.setPosition (S_WIDTH / 2 - 15, ((S_HEIGHT / 2) + 130));
}
// changes color on text depending on selection
if( menu_index == 1)
{
- startmenutext.setFillColor(sf::Color::Yellow);
- quittext.setFillColor(sf::Color::Black);
+ startmenutext.setFillColor(sf::Color::Black);
+ quittext.setFillColor(sf::Color::Red);
}
else if( menu_index == 2)
{
- startmenutext.setFillColor(sf::Color::Black);
- quittext.setFillColor(sf::Color::Yellow);
+ startmenutext.setFillColor(sf::Color::Red);
+ quittext.setFillColor(sf::Color::Black);
}
// 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) + 45), ((S_HEIGHT / 2) + 65 + 50*(menu_index - 1)));
+ mouse_l.setPosition(((S_WIDTH / 2) - 73), ((S_HEIGHT / 2) + 112 + 50*(menu_index - 1)));
}
void Scoreboard_menu::render(sf::RenderWindow& window) const
{
- /*window.draw(sprite);*/
+ window.draw(sprite);
window.draw(mouse_l);
window.draw(mouse_r);
+ window.draw(scoreboardtext);
+ window.draw(firstplacetext);
window.draw(startmenutext);
window.draw(quittext);