From 987dcd02050fe8be0aa407dbd3a56a9110fbe5a6 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 24 Sep 2025 20:54:45 +0200 Subject: [PATCH] fix: el audio del logo.cpp soles sonava la primera volta --- source/sections/logo.cpp | 6 ++---- source/sections/logo.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/sections/logo.cpp b/source/sections/logo.cpp index 04bbdb2..a167212 100644 --- a/source/sections/logo.cpp +++ b/source/sections/logo.cpp @@ -80,11 +80,9 @@ void Logo::checkInput() { // Maneja la reproducción del sonido del logo void Logo::handleSound() { - static bool sound_triggered = false; - - if (!sound_triggered && elapsed_time_s_ >= SOUND_TRIGGER_TIME_S) { + if (!sound_triggered_ && elapsed_time_s_ >= SOUND_TRIGGER_TIME_S) { Audio::get()->playSound("logo.wav"); - sound_triggered = true; + sound_triggered_ = true; } } diff --git a/source/sections/logo.h b/source/sections/logo.h index 8632d5a..314c34c 100644 --- a/source/sections/logo.h +++ b/source/sections/logo.h @@ -76,6 +76,7 @@ class Logo { float elapsed_time_s_ = 0.0f; // Tiempo transcurrido en segundos Uint64 last_time_ = 0; // Último timestamp para calcular delta-time SDL_FPoint dest_; // Posición donde dibujar el logo + bool sound_triggered_ = false; // Indica si el sonido del logo ya se reprodujo // --- Métodos internos --- void update(float delta_time); // Actualiza las variables