Canviades les paletes dels .gif

Ara es poden carregar paletes desde fitxers .pal
Reajustada la pleta general
fix: la pantalla de càrrega deixava un pixel per pintar, desde sempre
Ajustat el color del borde en el Logo i el Title per a ser igual al fondo amb les paletes de 16 colors (la del Spectrum es de 15)
This commit is contained in:
2025-03-06 20:04:53 +01:00
parent d0e06e30c9
commit d339fb13b0
46 changed files with 478 additions and 154 deletions

View File

@@ -17,8 +17,7 @@
#include "s_sprite.h" // for SSprite
#include "text.h" // for Text, TEXT_STROKE
#include "surface.h" // for Surface
#include "utils.h" // for Color, stringToColor, Palette
#include "utils.h" // for Color, static_cast<Uint8>,PaletteColor::PALETTE
// Constructor
Ending::Ending()
: counter_(-1),
@@ -40,7 +39,7 @@ Ending::Ending()
iniScenes();
// Cambia el color del borde
Screen::get()->setBorderColor(stringToColor("black"));
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
// Crea la textura para cubrir el texto
cover_surface_ = std::make_shared<Surface>(options.game.width, options.game.height + 8);
@@ -84,7 +83,7 @@ void Ending::render()
Screen::get()->start();
// Limpia la pantalla
Screen::get()->clearSurface(stringToColor("black"));
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
// Dibuja las imagenes de la escena
sprite_pics_.at(current_scene_).image_sprite->render();
@@ -167,8 +166,8 @@ void Ending::iniTexts()
const int WIDTH = text->lenght(txt.caption, 1) + 2 + 2;
const int HEIGHT = text->getCharacterSize() + 2 + 2;
auto text_color = stringToColor("white");
auto shadow_color = stringToColor("black");
auto text_color = static_cast<Uint8>(PaletteColor::WHITE);
auto shadow_color = static_cast<Uint8>(PaletteColor::BLACK);
EndingSurface st;
@@ -187,11 +186,11 @@ void Ending::iniTexts()
Screen::get()->setRendererSurface(st.cover_surface);
// Rellena la cover_surface con color transparente
st.cover_surface->clear(stringToColor("transparent"));
st.cover_surface->clear(static_cast<Uint8>(PaletteColor::TRANSPARENT));
// Crea una malla de 8 pixels de alto
auto surface = Screen::get()->getRendererSurface();
auto color = stringToColor("black");
auto color = static_cast<Uint8>(PaletteColor::BLACK);
for (int i = 0; i < WIDTH; i += 2)
{
surface->putPixel(i, 0, color);
@@ -255,11 +254,11 @@ void Ending::iniPics()
Screen::get()->setRendererSurface(sp.cover_surface);
// Rellena la cover_surface con color transparente
sp.cover_surface->clear(stringToColor("transparent"));
sp.cover_surface->clear(static_cast<Uint8>(PaletteColor::TRANSPARENT));
// Crea una malla en los primeros 8 pixels
auto surface = Screen::get()->getRendererSurface();
auto color = stringToColor("black");
auto color = static_cast<Uint8>(PaletteColor::BLACK);
for (int i = 0; i < WIDTH; i += 2)
{
surface->putPixel(i, 0, color);
@@ -477,10 +476,10 @@ void Ending::fillCoverTexture()
// Rellena la textura que cubre el texto con color transparente
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(cover_surface_);
cover_surface_->clear(stringToColor("transparent"));
cover_surface_->clear(static_cast<Uint8>(PaletteColor::TRANSPARENT));
// Los primeros 8 pixels crea una malla
const Uint8 color = stringToColor("black");
const Uint8 color = static_cast<Uint8>(PaletteColor::BLACK);
auto surface = Screen::get()->getRendererSurface();
for (int i = 0; i < 256; i += 2)
{