migrat a deltaTime screen.cpp i notifier.cpp

This commit is contained in:
2025-09-24 18:08:50 +02:00
parent 40a2b2cc00
commit d077374883
19 changed files with 192 additions and 437 deletions

View File

@@ -105,6 +105,10 @@ void Credits::update(float deltaTime) {
const float multiplier = want_to_pass_ ? 4.0f : 1.0f;
const float adjusted_delta_time = deltaTime * multiplier;
static auto *screen = Screen::get();
screen->update(deltaTime); // Actualiza el objeto screen
Audio::update(); // Actualiza el objeto audio
tiled_bg_->update(adjusted_delta_time);
cycleColors();
balloon_manager_->update(adjusted_delta_time);
@@ -117,9 +121,7 @@ void Credits::update(float deltaTime) {
const float frameFactor = adjusted_delta_time * 60.0f;
counter_ += frameFactor;
Screen::get()->update();
fillCanvas();
Audio::update();
}
// Dibuja Credits::en patalla
@@ -290,7 +292,7 @@ void Credits::fillCanvas() {
// Actualiza el destino de los rectangulos de las texturas (time-based)
void Credits::updateTextureDstRects(float deltaTime) {
constexpr float TEXTURE_UPDATE_INTERVAL_S = 10.0f / 60.0f; // ~0.167s (cada 10 frames)
constexpr float TEXTURE_UPDATE_INTERVAL_S = 10.0f / 60.0f; // ~0.167s (cada 10 frames)
static float texture_accumulator = 0.0f;
texture_accumulator += deltaTime;
@@ -327,8 +329,8 @@ void Credits::updateTextureDstRects(float deltaTime) {
void Credits::throwBalloons(float deltaTime) {
constexpr int SPEED = 200;
const std::vector<int> SETS = {0, 63, 25, 67, 17, 75, 13, 50};
constexpr float BALLOON_INTERVAL_S = SPEED / 60.0f; // ~3.33s (cada 200 frames)
constexpr float POWERBALL_INTERVAL_S = (SPEED * 4) / 60.0f; // ~13.33s (cada 800 frames)
constexpr float BALLOON_INTERVAL_S = SPEED / 60.0f; // ~3.33s (cada 200 frames)
constexpr float POWERBALL_INTERVAL_S = (SPEED * 4) / 60.0f; // ~13.33s (cada 800 frames)
if (counter_ > ((SETS.size() - 1) * SPEED) * 3) {
return;
@@ -422,7 +424,7 @@ void Credits::initPlayers() {
// Actualiza los rectangulos negros (time-based)
void Credits::updateBlackRects(float deltaTime) {
static float current_step_ = static_cast<float>(steps_);
constexpr float BLACK_RECT_INTERVAL_S = 4.0f / 60.0f; // ~0.067s (cada 4 frames)
constexpr float BLACK_RECT_INTERVAL_S = 4.0f / 60.0f; // ~0.067s (cada 4 frames)
static float black_rect_accumulator = 0.0f;
if (top_black_rect_.h != param.game.game_area.center_y - 1 && bottom_black_rect_.y != param.game.game_area.center_y + 1) {
@@ -485,12 +487,12 @@ void Credits::updateAllFades(float deltaTime) {
updateRedRect();
}
fade_in_->update(); // Fade ya usa tiempo interno
fade_in_->update(); // Fade ya usa tiempo interno
if (fade_in_->hasEnded()) {
Audio::get()->playMusic("credits.ogg");
}
fade_out_->update(); // Fade ya usa tiempo interno
fade_out_->update(); // Fade ya usa tiempo interno
if (fade_out_->hasEnded()) {
Section::name = Section::Name::HI_SCORE_TABLE;
}