player.handle_input(event);
}
-Start_menu::Start_menu() : texture{}, sprite{}, exit_menu{false}
+Start_menu::Start_menu() : texture{}, sprite{}, exit_menu{false}, gametitle{}, starttext{}, scoreboardtext{}, quittext{}, font{}
{
- texture.loadFromFile("assets/sack.png");
+ //sprite
+ texture.loadFromFile("assets/meny_bild.png");
sprite.setTexture(texture);
+ sprite.setScale(S_SCALE_KOEFF, S_SCALE_KOEFF);
sf::FloatRect gb {sprite.getGlobalBounds()};
- sprite.setOrigin(gb.width / 2, gb.height / 2);
- sprite.setPosition(S_WIDTH / 2, S_HEIGHT / 2); // hej
+ sprite.setPosition(0, 0);
+
+
+ //load textfont
+ if ( !font.loadFromFile ("assets/fonts/ComicNeue-Bold.ttf") )
+ throw std::invalid_argument ("Unable to load font");
+
+ //start
+ starttext = sf::Text{ "Start Game", font, 24 };
+ sf::FloatRect gbts {starttext.getGlobalBounds()};
+ starttext.setOrigin(gbts.width / 2, gbts.height / 2);
+ starttext.setPosition ((S_WIDTH) / 2, ((S_HEIGHT / 2) - 100));
+ starttext.setFillColor(sf::Color::Black);
+
+ //score
+ scoreboardtext = sf::Text{ "Scoreboard", font, 24 };
+ sf::FloatRect gbtb {scoreboardtext.getGlobalBounds()};
+ scoreboardtext.setOrigin(gbtb.width / 2, gbtb.height / 2);
+ scoreboardtext.setPosition (S_WIDTH / 2, ((S_HEIGHT / 2) - 50));
+ scoreboardtext.setFillColor(sf::Color::Black);
+
+ //quit
+ quittext = sf::Text{ "Quit", font, 24 };
+ sf::FloatRect gbtq {quittext.getGlobalBounds()};
+ quittext.setOrigin(gbtq.width / 2, gbtq.height / 2);
+ quittext.setPosition (S_WIDTH / 2, S_HEIGHT / 2);
+ quittext.setFillColor(sf::Color::Black);
+
+
+
}
void Start_menu::update(Context& context)
void Start_menu::render(sf::RenderWindow& window) const
{
window.draw(sprite);
+
+ window.draw(gametitle);
+ window.draw(starttext);
+ window.draw(scoreboardtext);
+ window.draw(quittext);
}
void Start_menu::handle_input(sf::Event& event)