treballant en ending2

This commit is contained in:
2026-03-19 09:53:42 +01:00
parent c80dffe957
commit a7d04d2bbc
10 changed files with 352 additions and 32 deletions

View File

@@ -34,7 +34,7 @@ enum class Options {
// --- Variables de estado globales ---
#ifdef _DEBUG
inline Scene current = Scene::CREDITS; // Escena actual
inline Scene current = Scene::ENDING2; // Escena actual
inline Options options = Options::LOGO_TO_LOADING_SCREEN; // Opciones de la escena actual
#else
inline Scene current = Scene::LOGO; // Escena actual

View File

@@ -90,27 +90,6 @@ void Ending2::render() {
// Dibuja los sprites con el texto del final
renderTexts();
// Dibuja una trama arriba y abajo
auto color = static_cast<Uint8>(PaletteColor::BLACK);
auto surface = Screen::get()->getRendererSurface();
for (int i = 0; i < 256; i += 2) {
surface->putPixel(i + 0, 0, color);
surface->putPixel(i + 1, 1, color);
surface->putPixel(i + 0, 2, color);
surface->putPixel(i + 1, 3, color);
surface->putPixel(i, 4, color);
surface->putPixel(i, 6, color);
surface->putPixel(i + 0, 191, color);
surface->putPixel(i + 1, 190, color);
surface->putPixel(i + 0, 189, color);
surface->putPixel(i + 1, 188, color);
surface->putPixel(i, 187, color);
surface->putPixel(i, 185, color);
}
// Vuelca el contenido del renderizador en pantalla
Screen::get()->render();
}
@@ -317,28 +296,26 @@ void Ending2::updateTexts(float delta) {
// Dibuja los sprites
void Ending2::renderSprites() {
const auto COLOR_A = static_cast<Uint8>(PaletteColor::RED);
for (const auto& sprite : sprites_) {
for (size_t i = 0; i < sprites_.size(); ++i) {
const auto& sprite = sprites_[i];
const bool A = sprite->getRect().y + sprite->getRect().h > 0;
const bool B = sprite->getRect().y < Options::game.height;
if (A && B) {
sprite->render(1, COLOR_A);
const Uint8 COLOR = colors_[i % colors_.size()];
sprite->renderWithVerticalFade(FADE_H, Options::game.height, 1, COLOR);
}
}
// Pinta el ultimo elemento de otro color
const auto COLOR_B = static_cast<Uint8>(PaletteColor::WHITE);
sprites_.back()->render(1, COLOR_B);
}
// Dibuja los sprites con el texto
void Ending2::renderSpriteTexts() {
const auto COLOR = static_cast<Uint8>(PaletteColor::WHITE);
for (const auto& sprite : sprite_texts_) {
for (size_t i = 0; i < sprite_texts_.size(); ++i) {
const auto& sprite = sprite_texts_[i];
const bool A = sprite->getRect().y + sprite->getRect().h > 0;
const bool B = sprite->getRect().y < Options::game.height;
if (A && B) {
sprite->render(1, COLOR);
const Uint8 COLOR = colors_[i % colors_.size()];
sprite->renderWithVerticalFade(FADE_H, Options::game.height, 1, COLOR);
}
}
}

View File

@@ -42,6 +42,7 @@ class Ending2 {
static constexpr int DIST_SPRITE_SPRITE = 0; // Distancia entre dos sprites de la misma columna
static constexpr int INITIAL_Y_OFFSET = 40; // Offset inicial en Y para posicionar sprites
static constexpr int SCREEN_MESH_HEIGHT = 8; // Altura de la malla superior/inferior de la pantalla
static constexpr int FADE_H = 24; // Alçada de la zona de dissolució als cantons (files)
static constexpr int TEXT_SPACING_MULTIPLIER = 2; // Multiplicador para espaciado entre líneas de texto
// Constantes de tiempo (basadas en tiempo real, no en frames)