This commit is contained in:
2025-10-19 22:01:31 +02:00
parent 16306f2325
commit 2b4523d644
101 changed files with 2058 additions and 1564 deletions

View File

@@ -3,18 +3,19 @@
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetRenderTarget, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_TextureAccess, SDL_FPoint
#include <algorithm> // Para clamp, max
#include <algorithm> // Para clamp, min, max
#include <cmath> // Para M_PI, cos, sin
#include <utility>
#include <string> // Para basic_string
#include <utility> // Para move
#include "animated_sprite.hpp" // Para MovingSprite
#include "animated_sprite.hpp" // Para AnimatedSprite
#include "moving_sprite.hpp" // Para MovingSprite
#include "param.hpp" // Para Param, ParamBackground, param
#include "resource.hpp" // Para Resource
#include "screen.hpp" // Para Screen
#include "sprite.hpp" // Para Sprite
#include "texture.hpp" // Para Texture
#include "utils.hpp" // Para funciones de easing
#include "utils.hpp" // Para easeOutCubic
// Constructor
Background::Background(float total_progress_to_complete)
@@ -191,7 +192,7 @@ void Background::setState(State new_state) {
// Si entra en estado completado, inicializar variables de transición
if (new_state == State::COMPLETED && state_ != State::COMPLETED) {
completion_initial_progress_ = progress_;
completion_transition_timer_ = 0.0f;
completion_transition_timer_ = 0.0F;
}
state_ = new_state;
@@ -209,8 +210,8 @@ void Background::reset() {
moon_index_ = 0;
// Resetear variables de transición de completado
completion_transition_timer_ = 0.0f;
completion_initial_progress_ = 0.0f;
completion_transition_timer_ = 0.0F;
completion_initial_progress_ = 0.0F;
// Notifica el cambio si hay callback
if (progress_callback_ && progress_ != old_progress) {
@@ -274,9 +275,9 @@ void Background::updateProgression(float delta_time) {
completion_transition_timer_ += delta_time;
// Calcular progreso normalizado de la transición (0.0 a 1.0)
float t = std::min(completion_transition_timer_ / COMPLETION_TRANSITION_DURATION_S, 1.0f);
float t = std::min(completion_transition_timer_ / COMPLETION_TRANSITION_DURATION_S, 1.0F);
if (t < 1.0f) {
if (t < 1.0F) {
// Usar easeOutCubic para transición suave (rápido al inicio, lento al final)
float eased_t = easeOutCubic(static_cast<double>(t));
@@ -342,12 +343,12 @@ void Background::updateCloudsSpeed() {
}
// Actualiza las nubes
void Background::updateClouds(float deltaTime) {
void Background::updateClouds(float delta_time) {
// Mueve las nubes
top_clouds_sprite_a_->update(deltaTime);
top_clouds_sprite_b_->update(deltaTime);
bottom_clouds_sprite_a_->update(deltaTime);
bottom_clouds_sprite_b_->update(deltaTime);
top_clouds_sprite_a_->update(delta_time);
top_clouds_sprite_b_->update(delta_time);
bottom_clouds_sprite_a_->update(delta_time);
bottom_clouds_sprite_b_->update(delta_time);
// Calcula el offset de las nubes
if (top_clouds_sprite_a_->getPosX() < -top_clouds_sprite_a_->getWidth()) {