llevat soport per a colors amb nom
This commit is contained in:
@@ -32,7 +32,7 @@ Credits::Credits()
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
shining_sprite_->setPos({.x = 194, .y = 174, .w = 8, .h = 8});
|
||||
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
|
||||
Screen::get()->setBorderColor(0); // Cambia el color del borde
|
||||
fillTexture(); // Escribe el texto en la textura
|
||||
Audio::get()->playMusic("574071_EA_DTV.ogg"); // Inicia la musica
|
||||
}
|
||||
@@ -56,33 +56,33 @@ void Credits::iniTexts() { // NOLINT(readability-convert-member-functions-to-st
|
||||
auto* loc = Locale::get();
|
||||
|
||||
texts_.clear();
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.instructions"), .color = static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.l0"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.l1"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.l2"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.instructions"), .color = 12});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.l0"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.l1"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.l2"), .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
|
||||
texts_.push_back({.label = loc->get("credits.keys"), .color = static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.keys_move"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.f8"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.f11"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.f1f2"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.f3"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.f9"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.keys"), .color = 12});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.keys_move"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.f8"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.f11"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.f1f2"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.f3"), .color = 14});
|
||||
texts_.push_back({.label = loc->get("credits.f9"), .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
|
||||
texts_.push_back({.label = loc->get("credits.author"), .color = static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts_.push_back({.label = loc->get("credits.date"), .color = static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.author"), .color = 12});
|
||||
texts_.push_back({.label = loc->get("credits.date"), .color = 12});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
|
||||
texts_.push_back({.label = loc->get("credits.love"), .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = "", .color = static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({.label = loc->get("credits.love"), .color = 14});
|
||||
texts_.push_back({.label = "", .color = 14});
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
@@ -93,7 +93,7 @@ void Credits::fillTexture() {
|
||||
// Rellena la textura de texto
|
||||
auto previuos_renderer = Screen::get()->getRendererSurface();
|
||||
Screen::get()->setRendererSurface(text_surface_);
|
||||
text_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
text_surface_->clear(0);
|
||||
|
||||
auto text = Resource::Cache::get()->getText("smb2");
|
||||
|
||||
@@ -109,7 +109,7 @@ void Credits::fillTexture() {
|
||||
// Escribe el corazón
|
||||
const int TEXT_LENGHT = text->length(texts_[22].label, 1) - text->length(" ", 1); // Se resta el ultimo caracter que es un espacio
|
||||
const int POS_X = ((PlayArea::WIDTH - TEXT_LENGHT) / 2) + TEXT_LENGHT;
|
||||
text->writeColored(POS_X, 176, "ä", static_cast<Uint8>(PaletteColor::BRIGHT_RED));
|
||||
text->writeColored(POS_X, 176, "ä", 5);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
// Recoloca el sprite del brillo
|
||||
@@ -219,7 +219,7 @@ void Credits::render() {
|
||||
Screen::get()->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
|
||||
if (state_ != State::EXITING) {
|
||||
// Dibuja la textura con el texto en pantalla
|
||||
@@ -230,7 +230,7 @@ void Credits::render() {
|
||||
|
||||
// Dibuja el sprite con el brillo
|
||||
if (reveal_time_ > SHINE_START_TIME) {
|
||||
shining_sprite_->render(1, static_cast<Uint8>(PaletteColor::BRIGHT_WHITE));
|
||||
shining_sprite_->render(1, 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Ending::Ending()
|
||||
iniPics(); // Inicializa las imagenes
|
||||
iniScenes(); // Inicializa las escenas
|
||||
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
|
||||
Screen::get()->setBorderColor(0); // Cambia el color del borde
|
||||
}
|
||||
|
||||
// Actualiza el objeto
|
||||
@@ -55,7 +55,7 @@ void Ending::render() {
|
||||
Screen::get()->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
|
||||
// Skip rendering durante WARMING_UP
|
||||
if (state_ != State::WARMING_UP) {
|
||||
@@ -212,8 +212,8 @@ void Ending::iniTexts() { // NOLINT(readability-convert-member-functions-to-sta
|
||||
|
||||
const float WIDTH = text->length(txt.caption, 1) + 2 + 2;
|
||||
const float HEIGHT = text->getCharacterSize() + 2 + 2;
|
||||
auto text_color = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
auto shadow_color = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
auto text_color = 14;
|
||||
auto shadow_color = 0;
|
||||
|
||||
EndingSurface st;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/defines.hpp" // Para GameCanvas::CENTER_X, GameCanvas::CENTER_Y
|
||||
#include "utils/delta_timer.hpp" // Para DeltaTimer
|
||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Constructor
|
||||
Ending2::Ending2()
|
||||
@@ -30,12 +30,9 @@ Ending2::Ending2()
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> COLORS = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
for (const auto& color : COLORS) {
|
||||
colors_.push_back(stringToColor(color));
|
||||
}
|
||||
colors_ = {14, 12, 10, 8, 6, 4, 2, 0};
|
||||
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
|
||||
Screen::get()->setBorderColor(0); // Cambia el color del borde
|
||||
iniSpriteList(); // Inicializa la lista de sprites
|
||||
loadSprites(); // Carga todos los sprites desde una lista
|
||||
placeSprites(); // Coloca los sprites en su sito
|
||||
@@ -80,7 +77,7 @@ void Ending2::render() {
|
||||
Screen::get()->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
|
||||
// Dibuja los sprites
|
||||
renderSprites();
|
||||
@@ -269,14 +266,14 @@ void Ending2::loadSprites() {
|
||||
for (const auto& file : sprite_list_) {
|
||||
const auto& animation_data = Resource::Cache::get()->getAnimationData(file + ".yaml");
|
||||
sprites_.emplace_back(std::make_shared<DissolveSprite>(animation_data));
|
||||
sprites_.back()->setColorReplace(1, static_cast<Uint8>(PaletteColor::RED));
|
||||
sprites_.back()->setColorReplace(1, 4);
|
||||
sprites_.back()->setProgress(1.0F); // comença invisible
|
||||
sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_);
|
||||
sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_);
|
||||
}
|
||||
|
||||
// El último sprite (player) va en blanco, no en rojo
|
||||
sprites_.back()->setColorReplace(1, static_cast<Uint8>(PaletteColor::WHITE));
|
||||
sprites_.back()->setColorReplace(1, 14);
|
||||
}
|
||||
|
||||
// Actualiza los sprites
|
||||
@@ -428,7 +425,7 @@ void Ending2::createSpriteTexts() { // NOLINT(readability-convert-member-functi
|
||||
// Crea el sprite
|
||||
SDL_FRect pos = {.x = X, .y = Y, .w = W, .h = H};
|
||||
sprite_texts_.emplace_back(std::make_shared<DissolveSprite>(surface, pos));
|
||||
sprite_texts_.back()->setColorReplace(1, static_cast<Uint8>(PaletteColor::WHITE));
|
||||
sprite_texts_.back()->setColorReplace(1, 14);
|
||||
sprite_texts_.back()->setProgress(1.0F); // comença invisible
|
||||
sprite_texts_.back()->setVelY(SPRITE_DESP_SPEED);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "game/ui/console.hpp" // Para Console
|
||||
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO...
|
||||
#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea::HEIGHT, RoomBorder::BOTTOM
|
||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "core/system/debug.hpp" // Para Debug
|
||||
@@ -489,7 +489,7 @@ void Game::renderPlaying() {
|
||||
// Renderiza el juego en estado BLACK_SCREEN (pantalla negra)
|
||||
void Game::renderBlackScreen() {
|
||||
Screen::get()->start();
|
||||
auto const COLOR = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
auto const COLOR = 0;
|
||||
Screen::get()->clearSurface(COLOR);
|
||||
Screen::get()->setBorderColor(COLOR);
|
||||
Screen::get()->render();
|
||||
@@ -498,7 +498,7 @@ void Game::renderBlackScreen() {
|
||||
// Renderiza el juego en estado GAME_OVER (pantalla negra)
|
||||
void Game::renderGameOver() {
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
Screen::get()->render();
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ void Game::renderFadeToEnding() {
|
||||
Screen::get()->setRendererSurface(game_backbuffer_surface_);
|
||||
|
||||
// 3. Renderizar todo a backbuffer
|
||||
game_backbuffer_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
game_backbuffer_surface_->clear(0);
|
||||
room_->renderMap();
|
||||
room_->renderEnemies();
|
||||
room_->renderItems();
|
||||
@@ -530,7 +530,7 @@ void Game::renderFadeToEnding() {
|
||||
// Renderiza el juego en estado POST_FADE_ENDING (pantalla negra)
|
||||
void Game::renderPostFadeEnding() {
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
Screen::get()->render();
|
||||
}
|
||||
|
||||
@@ -550,18 +550,18 @@ void Game::renderDebugInfo() {
|
||||
|
||||
// Borra el marcador
|
||||
SDL_FRect rect = {.x = 0, .y = 18 * Tile::SIZE, .w = PlayArea::WIDTH, .h = GameCanvas::HEIGHT - PlayArea::HEIGHT};
|
||||
surface->fillRect(&rect, static_cast<Uint8>(PaletteColor::BLACK));
|
||||
surface->fillRect(&rect, 0);
|
||||
|
||||
// Pinta la rejilla
|
||||
/*for (int i = 0; i < PlayArea::BOTTOM; i += 8)
|
||||
{
|
||||
// Lineas horizontales
|
||||
surface->drawLine(0, i, PlayArea::RIGHT, i, static_cast<Uint8>(PaletteColor::BRIGHT_BLACK));
|
||||
surface->drawLine(0, i, PlayArea::RIGHT, i, 1);
|
||||
}
|
||||
for (int i = 0; i < PlayArea::RIGHT; i += 8)
|
||||
{
|
||||
// Lineas verticales
|
||||
surface->drawLine(i, 0, i, PlayArea::BOTTOM - 1, static_cast<Uint8>(PaletteColor::BRIGHT_BLACK));
|
||||
surface->drawLine(i, 0, i, PlayArea::BOTTOM - 1, 1);
|
||||
}*/
|
||||
|
||||
// Pinta el texto
|
||||
@@ -815,11 +815,11 @@ void Game::setScoreBoardColor() { // NOLINT(readability-convert-member-function
|
||||
// Obtiene el color del borde
|
||||
const Uint8 BORDER_COLOR = room_->getBorderColor();
|
||||
|
||||
const bool IS_BLACK = BORDER_COLOR == static_cast<Uint8>(PaletteColor::BLACK);
|
||||
const bool IS_BRIGHT_BLACK = BORDER_COLOR == static_cast<Uint8>(PaletteColor::BRIGHT_BLACK);
|
||||
const bool IS_BLACK = BORDER_COLOR == 0;
|
||||
const bool IS_BRIGHT_BLACK = BORDER_COLOR == 1;
|
||||
|
||||
// Si el color del borde es negro o negro brillante cambia el texto del marcador a blanco
|
||||
scoreboard_data_->color = IS_BLACK || IS_BRIGHT_BLACK ? static_cast<Uint8>(PaletteColor::WHITE) : BORDER_COLOR;
|
||||
scoreboard_data_->color = IS_BLACK || IS_BRIGHT_BLACK ? 14 : BORDER_COLOR;
|
||||
}
|
||||
|
||||
// Comprueba si ha finalizado el juego
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/defines.hpp" // Para GameCanvas::CENTER_X
|
||||
#include "utils/delta_timer.hpp" // Para DeltaTimer
|
||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Constructor
|
||||
GameOver::GameOver()
|
||||
@@ -34,13 +34,10 @@ GameOver::GameOver()
|
||||
tv_sprite_->setPosX(GameCanvas::CENTER_X - tv_sprite_->getWidth() - TV_X_OFFSET);
|
||||
tv_sprite_->setPosY(TEXT_Y + SPRITE_Y_OFFSET);
|
||||
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->setBorderColor(0);
|
||||
|
||||
// Inicializa el vector de colores (de brillante a oscuro para fade)
|
||||
const std::vector<std::string> COLORS = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
for (const auto& color : COLORS) {
|
||||
colors_.push_back(stringToColor(color));
|
||||
}
|
||||
colors_ = {14, 12, 10, 8, 6, 4, 2, 0};
|
||||
color_ = colors_.back(); // Empieza en black
|
||||
}
|
||||
|
||||
@@ -64,7 +61,7 @@ void GameOver::update() {
|
||||
// Dibuja el final en pantalla
|
||||
void GameOver::render() {
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
|
||||
auto text = Resource::Cache::get()->getText("smb2");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "game/options.hpp" // Para Options, options, SectionState, Options...
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED
|
||||
#include "utils/utils.hpp" // Para stringToColor, PaletteColor
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Constructor
|
||||
LoadingScreen::LoadingScreen()
|
||||
@@ -28,7 +28,7 @@ LoadingScreen::LoadingScreen()
|
||||
screen_surface_(std::make_shared<Surface>(Options::game.width, Options::game.height)),
|
||||
delta_timer_(std::make_unique<DeltaTimer>()) {
|
||||
// Configura la superficie donde se van a pintar los sprites
|
||||
screen_surface_->clear(static_cast<Uint8>(PaletteColor::WHITE));
|
||||
screen_surface_->clear(14);
|
||||
|
||||
// Inicializa variables
|
||||
SceneManager::current = SceneManager::Scene::LOADING_SCREEN;
|
||||
@@ -39,7 +39,7 @@ LoadingScreen::LoadingScreen()
|
||||
initLineIndexArray();
|
||||
|
||||
// Cambia el color del borde
|
||||
Screen::get()->setBorderColor(stringToColor("white"));
|
||||
Screen::get()->setBorderColor(14);
|
||||
transitionToState(State::SILENT1);
|
||||
}
|
||||
|
||||
@@ -279,10 +279,10 @@ void LoadingScreen::renderDataBorder() {
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul
|
||||
border->clear(static_cast<Uint8>(PaletteColor::BLUE));
|
||||
border->clear(2);
|
||||
|
||||
// Añade lineas amarillas
|
||||
const auto COLOR = static_cast<Uint8>(PaletteColor::YELLOW);
|
||||
const auto COLOR = 12;
|
||||
const int WIDTH = Options::game.width + (Options::video.border.width * 2);
|
||||
const int HEIGHT = Options::game.height + (Options::video.border.height * 2);
|
||||
bool draw_enabled = rand() % 2 == 0;
|
||||
@@ -306,10 +306,10 @@ void LoadingScreen::renderHeaderBorder() const {
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul o rojo
|
||||
border->clear(carrier_.toggle ? static_cast<Uint8>(PaletteColor::CYAN) : static_cast<Uint8>(PaletteColor::RED));
|
||||
border->clear(carrier_.toggle ? 10 : 4);
|
||||
|
||||
// Añade lineas rojas o azules
|
||||
const auto COLOR = carrier_.toggle ? static_cast<Uint8>(PaletteColor::RED) : static_cast<Uint8>(PaletteColor::CYAN);
|
||||
const auto COLOR = carrier_.toggle ? 4 : 10;
|
||||
const int WIDTH = Options::game.width + (Options::video.border.width * 2);
|
||||
const int HEIGHT = Options::game.height + (Options::video.border.height * 2);
|
||||
|
||||
@@ -335,12 +335,12 @@ void LoadingScreen::renderHeaderBorder() const {
|
||||
}
|
||||
|
||||
// Dibuja el borde de color
|
||||
void LoadingScreen::renderColoredBorder(PaletteColor color) {
|
||||
void LoadingScreen::renderColoredBorder(Uint8 color) {
|
||||
// Obtiene la Surface del borde
|
||||
auto border = Screen::get()->getBorderSurface();
|
||||
|
||||
// Pinta el borde de color azul
|
||||
border->clear(static_cast<Uint8>(color));
|
||||
// Pinta el borde del color indicado
|
||||
border->clear(color);
|
||||
}
|
||||
|
||||
// Actualiza las variables
|
||||
@@ -391,7 +391,7 @@ void LoadingScreen::render() {
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(stringToColor("white"));
|
||||
Screen::get()->clearSurface(14);
|
||||
|
||||
// Copia la surface a la surface de Screen
|
||||
screen_surface_->render(0, 0);
|
||||
@@ -430,16 +430,16 @@ void LoadingScreen::renderBorder() {
|
||||
renderHeaderBorder();
|
||||
break;
|
||||
case Border::WHITE:
|
||||
renderColoredBorder(PaletteColor::WHITE);
|
||||
renderColoredBorder(14);
|
||||
break;
|
||||
case Border::BLACK:
|
||||
renderColoredBorder(PaletteColor::BLACK);
|
||||
renderColoredBorder(0);
|
||||
break;
|
||||
case Border::RED:
|
||||
renderColoredBorder(PaletteColor::RED);
|
||||
renderColoredBorder(4);
|
||||
break;
|
||||
case Border::CYAN:
|
||||
renderColoredBorder(PaletteColor::CYAN);
|
||||
renderColoredBorder(10);
|
||||
break;
|
||||
case Border::NONE:
|
||||
// No renderizar borde
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <memory> // Para shared_ptr
|
||||
|
||||
#include "utils/delta_timer.hpp" // Para DeltaTimer
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
class Sprite; // Forward declaration
|
||||
class Surface; // Forward declaration
|
||||
|
||||
@@ -90,7 +89,7 @@ class LoadingScreen {
|
||||
void renderBorder(); // Pinta el borde
|
||||
static void renderDataBorder(); // Dibuja el efecto de carga amarillo y azul en el borde
|
||||
void renderHeaderBorder() const; // Dibuja el efecto de carga rojo y azul en el borde
|
||||
static void renderColoredBorder(PaletteColor color); // Dibuja el borde de color
|
||||
static void renderColoredBorder(Uint8 color); // Dibuja el borde de color
|
||||
void initLineIndexArray(); // Inicializa el array de índices de líneas
|
||||
void printProgramName(); // Escribe el nombre del programa
|
||||
void updateCarrier(float delta_time); // Actualiza la portadora
|
||||
|
||||
@@ -28,8 +28,8 @@ Logo::Logo()
|
||||
delta_timer_(std::make_unique<DeltaTimer>()) {
|
||||
// Configura variables
|
||||
since_1998_sprite_->setClip(0, 0, since_1998_surface_->getWidth(), since_1998_surface_->getHeight());
|
||||
since_1998_color_ = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
jailgames_color_ = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
since_1998_color_ = 0;
|
||||
jailgames_color_ = 15;
|
||||
|
||||
// Inicializa variables
|
||||
SceneManager::current = SceneManager::Scene::LOGO;
|
||||
@@ -51,7 +51,7 @@ Logo::Logo()
|
||||
easing_function_ = EASING_OPTIONS[dist(gen)];
|
||||
|
||||
// Cambia el color del borde
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->setBorderColor(0);
|
||||
}
|
||||
|
||||
// Comprueba el manejador de eventos
|
||||
@@ -216,7 +216,7 @@ void Logo::update() {
|
||||
void Logo::render() { // NOLINT(readability-convert-member-functions-to-static)
|
||||
// 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 los objetos
|
||||
for (const auto& sprite : jailgames_sprite_) {
|
||||
@@ -257,14 +257,14 @@ void Logo::endSection() {
|
||||
void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-static)
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<Uint8> COLORS = {
|
||||
static_cast<Uint8>(PaletteColor::BLACK),
|
||||
static_cast<Uint8>(PaletteColor::BLUE),
|
||||
static_cast<Uint8>(PaletteColor::RED),
|
||||
static_cast<Uint8>(PaletteColor::MAGENTA),
|
||||
static_cast<Uint8>(PaletteColor::GREEN),
|
||||
static_cast<Uint8>(PaletteColor::CYAN),
|
||||
static_cast<Uint8>(PaletteColor::YELLOW),
|
||||
static_cast<Uint8>(PaletteColor::BRIGHT_WHITE)};
|
||||
0,
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
8,
|
||||
10,
|
||||
12,
|
||||
15};
|
||||
for (const auto& color : COLORS) {
|
||||
color_.push_back(color);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user