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

@@ -26,7 +26,7 @@ Credits::Credits()
shining_sprite_->setPos({194, 174, 8, 8});
// Cambia el color del borde
Screen::get()->setBorderColor(stringToColor("black"));
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
// Crea la textura para el texto que se escribe en pantalla
text_surface_ = std::make_shared<Surface>(options.game.width, options.game.height);
@@ -76,62 +76,62 @@ void Credits::iniTexts()
}
texts_.clear();
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"INSTRUCTIONS:", stringToColor("yellow")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"HELP JAILDOC TO GET BACK ALL", stringToColor("white")});
texts_.push_back({"HIS PROJECTS AND GO TO THE", stringToColor("white")});
texts_.push_back({"JAIL TO FINISH THEM", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"INSTRUCTIONS:", static_cast<Uint8>(PaletteColor::YELLOW)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"HELP JAILDOC TO GET BACK ALL", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"HIS PROJECTS AND GO TO THE", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"JAIL TO FINISH THEM", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"KEYS:", stringToColor("yellow")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({keys + " TO MOVE AND JUMP", stringToColor("white")});
texts_.push_back({"M TO SWITCH THE MUSIC", stringToColor("white")});
texts_.push_back({"H TO PAUSE THE GAME", stringToColor("white")});
texts_.push_back({"F1-F2 TO CHANGE WINDOWS SIZE", stringToColor("white")});
texts_.push_back({"F3 TO SWITCH TO FULLSCREEN", stringToColor("white")});
texts_.push_back({"B TO TOOGLE THE BORDER SCREEN", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"KEYS:", static_cast<Uint8>(PaletteColor::YELLOW)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({keys + " TO MOVE AND JUMP", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"M TO SWITCH THE MUSIC", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"H TO PAUSE THE GAME", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"F1-F2 TO CHANGE WINDOWS SIZE", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"F3 TO SWITCH TO FULLSCREEN", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"B TO TOOGLE THE BORDER SCREEN", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"A GAME BY JAILDESIGNER", stringToColor("yellow")});
texts_.push_back({"MADE ON SUMMER/FALL 2022", stringToColor("yellow")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"A GAME BY JAILDESIGNER", static_cast<Uint8>(PaletteColor::YELLOW)});
texts_.push_back({"MADE ON SUMMER/FALL 2022", static_cast<Uint8>(PaletteColor::YELLOW)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"I LOVE JAILGAMES! ", stringToColor("white")});
texts_.push_back({"", stringToColor("white")});
texts_.push_back({"I LOVE JAILGAMES! ", static_cast<Uint8>(PaletteColor::WHITE)});
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
#else
texts.clear();
texts.push_back({"", stringToColor("white")});
texts.push_back({"INSTRUCTIONS:", stringToColor("yellow")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"HELP JAILDOC TO GET BACK ALL", stringToColor("white")});
texts.push_back({"HIS PROJECTS AND GO TO THE", stringToColor("white")});
texts.push_back({"JAIL TO FINISH THEM", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"INSTRUCTIONS:", static_cast<Uint8>(PaletteColor::YELLOW)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"HELP JAILDOC TO GET BACK ALL", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"HIS PROJECTS AND GO TO THE", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"JAIL TO FINISH THEM", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"KEYS:", stringToColor("yellow")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"B TO JUMP", stringToColor("white")});
texts.push_back({"R TO SWITCH THE MUSIC", stringToColor("white")});
texts.push_back({"L TO SWAP THE COLOR PALETTE", stringToColor("white")});
texts.push_back({"START TO PAUSE", stringToColor("white")});
texts.push_back({"SELECT TO EXIT", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"KEYS:", static_cast<Uint8>(PaletteColor::YELLOW)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"B TO JUMP", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"R TO SWITCH THE MUSIC", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"L TO SWAP THE COLOR PALETTE", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"START TO PAUSE", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"SELECT TO EXIT", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"A GAME BY JAILDESIGNER", stringToColor("yellow")});
texts.push_back({"MADE ON SUMMER/FALL 2022", stringToColor("yellow")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"A GAME BY JAILDESIGNER", static_cast<Uint8>(PaletteColor::YELLOW)});
texts.push_back({"MADE ON SUMMER/FALL 2022", static_cast<Uint8>(PaletteColor::YELLOW)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"I LOVE JAILGAMES! ", stringToColor("white")});
texts.push_back({"", stringToColor("white")});
texts.push_back({"I LOVE JAILGAMES! ", static_cast<Uint8>(PaletteColor::WHITE)});
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
#endif
}
@@ -144,7 +144,7 @@ void Credits::fillTexture()
// Rellena la textura de texto
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(text_surface_);
text_surface_->clear(stringToColor("black"));
text_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
auto text = Resource::get()->getText("smb2");
@@ -161,17 +161,17 @@ void Credits::fillTexture()
// Escribe el corazón
const int TEXT_LENGHT = text->lenght(texts_[22].label, 1) - text->lenght(" ", 1); // Se resta el ultimo caracter que es un espacio
const int POS_X = ((PLAY_AREA_WIDTH - TEXT_LENGHT) / 2) + TEXT_LENGHT;
text->writeColored(POS_X, 176, "}", stringToColor("bright_red"));
text->writeColored(POS_X, 176, "}", static_cast<Uint8>(PaletteColor::BRIGHT_RED));
// Recoloca el sprite del brillo
shining_sprite_->setPosX(POS_X + 2);
// Rellena la textura que cubre el texto con color transparente
text_surface_->clear(stringToColor("transparent"));
text_surface_->clear(static_cast<Uint8>(PaletteColor::TRANSPARENT));
// Los primeros 8 pixels crea una malla
auto surface = Screen::get()->getRendererSurface();
auto color = stringToColor("black");
auto color = static_cast<Uint8>(PaletteColor::BLACK);
for (int i = 0; i < 256; i += 2)
{
surface->putPixel(i, 0, color);