|
|
|
@ -6,13 +6,15 @@ MainMenu::MainMenu(sf::RenderWindow& game_window, Callbacks&& callbacks) :
|
|
|
|
|
_buttons(std::make_shared<Group>()),
|
|
|
|
|
_game_window(game_window)
|
|
|
|
|
{
|
|
|
|
|
const float window_width = game_window.getSize().x;
|
|
|
|
|
const float window_height = game_window.getSize().y;
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<Button> button_start = std::make_shared<Button>("Start");
|
|
|
|
|
button_start->setRect(sf::FloatRect(140, 140, 500, 100));
|
|
|
|
|
button_start->setRect(sf::FloatRect(window_width / 3., window_height / 7. * 2, window_width / 3., window_height / 7.));
|
|
|
|
|
button_start->setCallback(callbacks.onAppendGameState);
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<Button> button_exit = std::make_shared<Button>("Exit");
|
|
|
|
|
button_exit->setRect(sf::FloatRect(140, 140, 400, 100));
|
|
|
|
|
button_exit->setPosition({240, 340});
|
|
|
|
|
button_exit->setRect(sf::FloatRect(window_width / 3., window_height / 7. * 4, window_width / 3., window_height / 7.));
|
|
|
|
|
button_exit->setCallback([&]()
|
|
|
|
|
{
|
|
|
|
|
_game_window.close();
|
|
|
|
|