#include "MainAppMenu.h" #include "AppMenu.h" #include "InGameAppMenu.h" #include #include #include MainAppMenu::MainAppMenu(std::shared_ptr menuStack, std::shared_ptr settings, std::shared_ptr renderWindow) : AppMenu(menuStack, settings, renderWindow), playerCursor(std::vector({1, 1, 1})) { } void MainAppMenu::computeFrame() { this->updateMetaBinds(); this->playerCursor.updatePosition(); if (this->enterReleased) { 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 MainAppMenu::drawFrame() const { this->renderWindow->clear(sf::Color(200, 200, 200)); float sizeMultiplier = this->settings->getWindowSizeMultiplier(); sf::Font font("data/fonts/arial.ttf"); sf::Text text(font, "", this->settings->getWindowSizeMultiplier() * 5); text.setFillColor(sf::Color(0, 0, 0)); text.setOutlineColor(sf::Color(255, 255, 255)); text.setString("jminos"); text.setOrigin(text.getLocalBounds().getCenter()); text.setPosition(sf::Vector2f({sizeMultiplier * 40, sizeMultiplier * 10})); this->renderWindow->draw(text); text.setString("Play"); text.setOutlineThickness((this->playerCursor.getPosition().y == 0) ? (sizeMultiplier / 2) : 0); text.setOrigin(text.getLocalBounds().getCenter()); text.setPosition(sf::Vector2f({sizeMultiplier * 40, sizeMultiplier * 20})); this->renderWindow->draw(text); text.setString("Settings"); text.setOutlineThickness((this->playerCursor.getPosition().y == 1) ? (sizeMultiplier / 2) : 0); text.setOrigin(text.getLocalBounds().getCenter()); text.setPosition(sf::Vector2f({sizeMultiplier * 40, sizeMultiplier * 30})); this->renderWindow->draw(text); text.setString("Info"); text.setOutlineThickness((this->playerCursor.getPosition().y == 2) ? (sizeMultiplier / 2) : 0); text.setOrigin(text.getLocalBounds().getCenter()); text.setPosition(sf::Vector2f({sizeMultiplier * 40, sizeMultiplier * 40})); this->renderWindow->draw(text); this->renderWindow->display(); }