Transició a surface: barallantme amb tots els Color que hi ha pel codi

This commit is contained in:
2025-03-03 22:58:12 +01:00
parent b940d627d6
commit c4033e3663
20 changed files with 219 additions and 224 deletions

View File

@@ -5,7 +5,7 @@
#include <SDL2/SDL_render.h> // for SDL_RenderDrawPoint, SDL_SetRenderDr...
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <algorithm> // for max, min, replace
#include "s_animated_sprite.h" // for AnimatedSprite
#include "s_animated_sprite.h" // for SAnimatedSprite
#include "defines.h" // for options.game.height, GAMECANVAS_CENTER_X
#include "global_events.h" // for check
#include "global_inputs.h" // for check
@@ -38,7 +38,7 @@ Ending2::Ending2()
}
// Cambia el color del borde
Screen::get()->setBorderColor(stringToColor(options.video.palette, "black"));
Screen::get()->setBorderColor(stringToColor("black"));
// Inicializa la lista de sprites
iniSpriteList();
@@ -101,7 +101,7 @@ void Ending2::render()
Screen::get()->start();
// Limpia la pantalla
Screen::get()->clean(stringToColor(options.video.palette, "black"));
Screen::get()->clean(stringToColor("black"));
// Dibuja los sprites
renderSprites();
@@ -282,7 +282,7 @@ void Ending2::loadSprites()
// Carga los sprites
for (const auto &file : sprite_list_)
{
sprites_.emplace_back(std::make_shared<AnimatedSprite>(Resource::get()->getSurface(file + ".gif"), Resource::get()->getAnimations(file + ".ani")));
sprites_.emplace_back(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface(file + ".gif"), Resource::get()->getAnimations(file + ".ani")));
sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_);
sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_);
}
@@ -497,15 +497,16 @@ void Ending2::createTexts()
// Actualiza el fade final
void Ending2::updateFinalFade()
{
{/*
// La variable step va de 0 a 40 en el tramo de postCounter que va de 500 a 540. Al dividirlo por 40, va de 0.0f a 1.0f
const float STEP = std::min(std::max(post_counter_, 500) - 500, 40) / 40.0f;
const int INDEX = (colors_.size() - 1) * STEP;
for (const auto &text : texts_)
{
//text->getTexture()->setColor(colors_.at(INDEX).r, colors_.at(INDEX).g, colors_.at(INDEX).b);
text->getTexture()->setColor(colors_.at(INDEX).r, colors_.at(INDEX).g, colors_.at(INDEX).b);
}
*/
}
// Actualiza el volumen de la musica