refactoring

This commit is contained in:
2025-03-24 22:39:16 +01:00
parent 321271b748
commit c168cd68d7
18 changed files with 256 additions and 115 deletions

View File

@@ -3,11 +3,12 @@
#include "AppMenu.h"
#include "GameSettingsAppMenu.h"
#include "SettingsMainAppMenu.h"
#include "PlayerCursor.h"
#include "../PlayerCursor.h"
#include <stack>
#include <memory>
#include <vector>
#include <optional>
#include <SFML/Graphics.hpp>
@@ -42,33 +43,15 @@ void MainAppMenu::drawFrame() const {
float sizeMultiplier = this->settings->getWindowSizeMultiplier();
sf::Font font("data/fonts/pressstart/prstartk.ttf");
sf::Text text(font, "", this->settings->getWindowSizeMultiplier() * 2);
sf::Text text(this->pressStartFont, "", this->settings->getWindowSizeMultiplier() * 2);
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);
this->placeTitle(text, std::optional<PlayerCursor>(), "JMINOS", 10.f, std::optional<sf::Vector2u>());
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->placeTitle(text, this->playerCursor, "PLAY", 20.f, sf::Vector2u({0, 0}));
this->placeTitle(text, this->playerCursor, "SETTINGS", 30.f, sf::Vector2u({0, 1}));
this->placeTitle(text, this->playerCursor, "INFO (TODO)", 40.f, sf::Vector2u({0, 2}));
this->renderWindow->display();
}