llevat soport per a colors amb nom

This commit is contained in:
2026-04-06 09:14:36 +02:00
parent c4a26ffa0f
commit cdf0665458
121 changed files with 676 additions and 5754 deletions

View File

@@ -20,7 +20,7 @@
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/ui/console.hpp" // Para Console
#include "utils/defines.hpp" // Para PlayArea::CENTER_X, GameCanvas::WIDTH
#include "utils/utils.hpp" // Para stringToColor, PaletteColor, playMusic
#include "utils/utils.hpp"
// Constructor
Title::Title()
@@ -46,7 +46,7 @@ Title::Title()
// Acciones iniciales
initMarquee(); // Inicializa la marquesina
createCheevosTexture(); // Crea y rellena la textura para mostrar los logros
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
Screen::get()->setBorderColor(0); // Cambia el color del borde
Audio::get()->playMusic("574071_EA_DTV.ogg"); // Inicia la musica
}
@@ -233,7 +233,7 @@ void Title::renderMarquee() const {
if (letter.enabled && letter.clip.w > 0.0F) {
sprite->setClip(letter.clip);
sprite->setX(letter.x);
sprite->render(1, static_cast<Uint8>(PaletteColor::MAGENTA));
sprite->render(1, 6);
}
}
}
@@ -425,7 +425,7 @@ void Title::render() {
// Prepara para empezar a dibujar en la textura de juego
Screen::get()->start();
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
Screen::get()->clearSurface(0);
// Dibuja en pantalla la surface con la composicion
title_surface_->render();
@@ -463,17 +463,17 @@ void Title::createCheevosTexture() { // NOLINT(readability-convert-member-funct
Screen::get()->setRendererSurface(cheevos_surface_);
// Rellena la textura con color sólido
const auto CHEEVOS_BG_COLOR = static_cast<Uint8>(PaletteColor::BLACK);
const auto CHEEVOS_BG_COLOR = 0;
cheevos_surface_->clear(CHEEVOS_BG_COLOR);
// Escribe la lista de logros en la textura
const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects"); // NOLINT(readability-static-accessed-through-instance)
const std::string CHEEVOS_LIST_CAPTION = CHEEVOS_OWNER + " (" + std::to_string(Cheevos::get()->getTotalUnlockedAchievements()) + " / " + std::to_string(Cheevos::get()->size()) + ")";
int pos = 2;
TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, stringToColor("bright_green"));
TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, 9);
pos += TEXT->getCharacterSize();
const Uint8 CHEEVO_LOCKED_COLOR = stringToColor("white");
const Uint8 CHEEVO_UNLOCKED_COLOR = stringToColor("bright_green");
const Uint8 CHEEVO_LOCKED_COLOR = 14;
const Uint8 CHEEVO_UNLOCKED_COLOR = 9;
constexpr int LINE_X1 = (CHEEVOS_TEXTURE_WIDTH / 7) * 3;
constexpr int LINE_X2 = LINE_X1 + ((CHEEVOS_TEXTURE_WIDTH / 7) * 1);
@@ -526,7 +526,7 @@ void Title::renderMainMenu() {
constexpr int MENU_ZONE_HEIGHT = 102;
// Menú principal normal con 4 opciones centradas verticalmente en la zona
const Uint8 COLOR = stringToColor("green");
const Uint8 COLOR = 8;
const int TEXT_SIZE = menu_text_->getCharacterSize();
const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2);
const int SPACING = 2 * TEXT_SIZE; // Espaciado entre opciones
@@ -554,7 +554,7 @@ void Title::fillTitleSurface() {
Screen::get()->setRendererSurface(title_surface_);
// Rellena la textura de color
title_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
title_surface_->clear(0);
switch (state_) {
case State::MAIN_MENU:
@@ -676,8 +676,8 @@ void Title::renderKeyboardRemap() const {
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
const Uint8 COLOR = stringToColor("green");
const Uint8 ERROR_COLOR = stringToColor("red");
const Uint8 COLOR = 8;
const Uint8 ERROR_COLOR = 4;
const int TEXT_SIZE = menu_text_->getCharacterSize();
const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2);
@@ -724,8 +724,8 @@ void Title::renderJoystickRemap() const {
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
const Uint8 COLOR = stringToColor("green");
const Uint8 ERROR_COLOR = stringToColor("red");
const Uint8 COLOR = 8;
const Uint8 ERROR_COLOR = 4;
const int TEXT_SIZE = menu_text_->getCharacterSize();
const int MENU_CENTER_Y = MENU_ZONE_Y + (MENU_ZONE_HEIGHT / 2);