This commit is contained in:
2025-10-27 11:53:12 +01:00
parent 231dcd4b3b
commit 5d8811026d
69 changed files with 899 additions and 888 deletions

View File

@@ -104,13 +104,13 @@ void Ending::render() {
void Ending::checkEvents() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
globalEvents::check(event);
GlobalEvents::check(event);
}
}
// Comprueba las entradas
void Ending::checkInput() {
globalInputs::check();
GlobalInputs::check();
}
// Inicializa los textos
@@ -407,9 +407,7 @@ void Ending::updateSpriteCovers() {
sprite_pics_.at(current_scene_).cover_clip_desp -= 2;
} else if (sprite_pics_.at(current_scene_).cover_clip_height > 0) {
sprite_pics_.at(current_scene_).cover_clip_height -= 2;
if (sprite_pics_.at(current_scene_).cover_clip_height < 0) {
sprite_pics_.at(current_scene_).cover_clip_height = 0;
}
sprite_pics_.at(current_scene_).cover_clip_height = std::max(sprite_pics_.at(current_scene_).cover_clip_height, 0);
sprite_pics_.at(current_scene_).cover_sprite->setY(sprite_pics_.at(current_scene_).cover_sprite->getY() + 2);
}
sprite_pics_.at(current_scene_).cover_sprite->setClip(0, sprite_pics_.at(current_scene_).cover_clip_desp, sprite_pics_.at(current_scene_).cover_sprite->getWidth(), sprite_pics_.at(current_scene_).cover_clip_height);
@@ -441,21 +439,21 @@ void Ending::fillCoverTexture() {
cover_surface_->clear(static_cast<Uint8>(PaletteColor::TRANSPARENT));
// Los primeros 8 pixels crea una malla
const Uint8 color = static_cast<Uint8>(PaletteColor::BLACK);
const Uint8 COLOR = static_cast<Uint8>(PaletteColor::BLACK);
auto surface = Screen::get()->getRendererSurface();
for (int i = 0; i < 256; i += 2) {
surface->putPixel(i + 0, Options::game.height + 0, color);
surface->putPixel(i + 1, Options::game.height + 1, color);
surface->putPixel(i + 0, Options::game.height + 2, color);
surface->putPixel(i + 1, Options::game.height + 3, color);
surface->putPixel(i + 0, Options::game.height + 0, COLOR);
surface->putPixel(i + 1, Options::game.height + 1, COLOR);
surface->putPixel(i + 0, Options::game.height + 2, COLOR);
surface->putPixel(i + 1, Options::game.height + 3, COLOR);
surface->putPixel(i, Options::game.height + 4, color);
surface->putPixel(i, Options::game.height + 6, color);
surface->putPixel(i, Options::game.height + 4, COLOR);
surface->putPixel(i, Options::game.height + 6, COLOR);
}
// El resto se rellena de color sólido
SDL_FRect rect = {0, 0, 256, Options::game.height};
surface->fillRect(&rect, color);
surface->fillRect(&rect, COLOR);
Screen::get()->setRendererSurface(previuos_renderer);
}
@@ -465,17 +463,17 @@ void Ending::renderCoverTexture() {
if (cover_counter_ > 0) {
// Dibuja la textura que cubre el texto
const int OFFSET = std::min(cover_counter_, 100);
SDL_FRect srcRect = {0.0F, 200.0F - (cover_counter_ * 2.0F), 256.0F, OFFSET * 2.0F};
SDL_FRect dstRect = {0.0F, 0.0F, 256.0F, OFFSET * 2.0F};
cover_surface_->render(&srcRect, &dstRect);
SDL_FRect src_rect = {0.0F, 200.0F - (cover_counter_ * 2.0F), 256.0F, OFFSET * 2.0F};
SDL_FRect dst_rect = {0.0F, 0.0F, 256.0F, OFFSET * 2.0F};
cover_surface_->render(&src_rect, &dst_rect);
}
}
// Actualiza el volumen de la musica
void Ending::updateMusicVolume() {
void Ending::updateMusicVolume() const {
if (current_scene_ == 4 && cover_counter_ > 0) {
const float step = (100.0f - cover_counter_) / 100.0f;
const int volume = 128 * step;
JA_SetVolume(volume);
const float STEP = (100.0F - cover_counter_) / 100.0F;
const int VOLUME = 128 * STEP;
JA_SetVolume(VOLUME);
}
}