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

@@ -22,7 +22,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s
mode_(mode) {
// En modo normal: empieza negro sólido (se irá revelando a transparente)
// En modo inverso: empieza transparente (se irá cubriendo de negro)
const auto INITIAL_COLOR = reverse_ ? static_cast<Uint8>(PaletteColor::TRANSPARENT) : static_cast<Uint8>(PaletteColor::BLACK);
const auto INITIAL_COLOR = reverse_ ? 255 : 0;
cover_surface_->clear(INITIAL_COLOR);
if (mode_ == RevealMode::ORDERED) {
@@ -68,7 +68,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s
// Actualiza el estado del revelado
void PixelReveal::update(float time_active) { // NOLINT(readability-make-member-function-const)
// En modo normal revela (pone transparente); en modo inverso cubre (pone negro)
const auto PIXEL_COLOR = reverse_ ? static_cast<Uint8>(PaletteColor::BLACK) : static_cast<Uint8>(PaletteColor::TRANSPARENT);
const auto PIXEL_COLOR = reverse_ ? 0 : 255;
for (int r = 0; r < height_; r++) {
const float T_START = static_cast<float>(r) / pixels_per_second_;

View File

@@ -56,7 +56,7 @@ Screen::Screen() {
game_surface_dstrect_ = {.x = Options::video.border.width, .y = Options::video.border.height, .w = Options::game.width, .h = Options::game.height};
// Define el color del borde para el modo de pantalla completa
border_color_ = static_cast<Uint8>(PaletteColor::BLACK);
border_color_ = 0;
// Crea la textura donde se dibujan los graficos del juego
game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Options::game.width, Options::game.height);
@@ -76,7 +76,7 @@ Screen::Screen() {
// Crea las surfaces (PaletteManager aplicará la paleta inicial en su constructor)
game_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
game_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
game_surface_->clear(0);
border_surface_ = std::make_shared<Surface>(Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2));
border_surface_->clear(border_color_);

View File

@@ -4249,5 +4249,6 @@ static const uint8_t kdownscale_frag_spv[] = {
0x38,
0x00,
0x01,
0x00};
0x00,
};
static const size_t kdownscale_frag_spv_size = 4248;

View File

@@ -11713,5 +11713,6 @@ static const uint8_t kpostfx_frag_spv[] = {
0x38,
0x00,
0x01,
0x00};
0x00,
};
static const size_t kpostfx_frag_spv_size = 11712;

View File

@@ -1445,5 +1445,6 @@ static const uint8_t kpostfx_vert_spv[] = {
0x38,
0x00,
0x01,
0x00};
0x00,
};
static const size_t kpostfx_vert_spv_size = 1444;

View File

@@ -629,5 +629,6 @@ static const uint8_t kupscale_frag_spv[] = {
0x38,
0x00,
0x01,
0x00};
0x00,
};
static const size_t kupscale_frag_spv_size = 628;

View File

@@ -93,10 +93,10 @@ auto readPalFile(const std::string& file_path) -> Palette {
// Constructor
Surface::Surface(int w, int h)
: surface_data_(std::make_shared<SurfaceData>(w, h)),
transparent_color_(static_cast<Uint8>(PaletteColor::TRANSPARENT)) { initializeSubPalette(sub_palette_); }
transparent_color_(255) { initializeSubPalette(sub_palette_); }
Surface::Surface(const std::string& file_path)
: transparent_color_(static_cast<Uint8>(PaletteColor::TRANSPARENT)) {
: transparent_color_(255) {
SurfaceData loaded_data = loadSurface(file_path);
surface_data_ = std::make_shared<SurfaceData>(std::move(loaded_data));

View File

@@ -176,7 +176,7 @@ auto Text::writeToSurface(const std::string& text, int zoom, int kerning) -> std
auto surface = std::make_shared<Surface>(width, height);
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(surface);
surface->clear(stringToColor("transparent"));
surface->clear(255);
write(0, 0, text, kerning);
Screen::get()->setRendererSurface(previuos_renderer);
@@ -190,7 +190,7 @@ auto Text::writeDXToSurface(Uint8 flags, const std::string& text, int kerning, U
auto surface = std::make_shared<Surface>(width, height);
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(surface);
surface->clear(stringToColor("transparent"));
surface->clear(255);
writeDX(flags, 0, 0, text, kerning, text_color, shadow_distance, shadow_color, lenght);
Screen::get()->setRendererSurface(previuos_renderer);