#include "GameSettingsAppMenu.h" #include "AppMenu.h" #include "GamePiecesAppMenu.h" #include "GameBoardAppMenu.h" #include "GamePlayingAppMenu.h" #include "../PlayerCursor.h" #include #include #include GameSettingsAppMenu::GameSettingsAppMenu(std::shared_ptr menuStack, std::shared_ptr settings, std::shared_ptr renderWindow) : AppMenu(menuStack, settings, renderWindow), playerCursor({2, 3, 3}) { } void GameSettingsAppMenu::computeFrame() { this->updateMetaBinds(); this->playerCursor.updatePosition(); switch (this->playerCursor.getPosition().y) { case 1 : { switch (this->playerCursor.getPosition().x) { case 0 : {this->settings->setGamemode(SPRINT); break;} case 1 : {this->settings->setGamemode(MARATHON); break;} case 2 : {this->settings->setGamemode(ULTRA); break;} } break; } case 2 : { switch (this->playerCursor.getPosition().x) { case 0 : {this->settings->setGamemode(MASTER); break;} case 1 : {this->settings->setGamemode(INVISIBLE); break;} case 2 : {this->settings->setGamemode(ZEN); break;} } break; } } if (this->enterReleased) { if (this->playerCursor.getPosition().y == 0) { if (this->playerCursor.getPosition().x == 0) { this->menuStack->push(std::make_shared(this->menuStack, this->settings, this->renderWindow)); } if (this->playerCursor.getPosition().x == 1) { this->menuStack->push(std::make_shared(this->menuStack, this->settings, this->renderWindow)); } } if (this->playerCursor.getPosition().y > 0) { this->menuStack->push(std::make_shared(this->menuStack, this->settings, this->renderWindow)); } } if (this->escReleased) { this->menuStack->pop(); } } void GameSettingsAppMenu::drawFrame() const { this->renderWindow->clear(sf::Color(200, 200, 200)); sf::Text text(this->pressStartFont, "", this->settings->getWindowSizeMultiplier() * 2); text.setFillColor(sf::Color(0, 0, 0)); text.setOutlineColor(sf::Color(255, 255, 255)); this->placeTitle(text, {}, "GAME SETTINGS", 5.f, {}); this->placeText(text, this->playerCursor, "PIECES SELECT", 5.f, 15.f, sf::Vector2u{0, 0}); this->placeText(text, this->playerCursor, "BOARD SELECT", 40.f, 15.f, sf::Vector2u{1, 0}); text.setOutlineThickness(0); this->placeTitle(text, {}, "GAMEMODE SELECT", 25.f, {}); this->placeText(text, this->playerCursor, "SPRINT", 5.f, 35.f, sf::Vector2u{0, 1}); this->placeText(text, this->playerCursor, "MARATHON", 25.f, 35.f, sf::Vector2u{1, 1}); this->placeText(text, this->playerCursor, "ULTRA", 50.f, 35.f, sf::Vector2u{2, 1}); this->placeText(text, this->playerCursor, "MASTER", 5.f, 45.f, sf::Vector2u{0, 2}); this->placeText(text, this->playerCursor, "INVISIBLE", 25.f, 45.f, sf::Vector2u{1, 2}); this->placeText(text, this->playerCursor, "ZEN", 50.f, 45.f, sf::Vector2u{2, 2}); this->renderWindow->display(); }