From 8627c4c40546673cc3a0f68e44b7200f03c6551c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Wed, 27 Sep 2023 17:56:11 +0200 Subject: [PATCH] Las notificaciones simultaneas ya no aparecen todas de golpe --- source/common/notify.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/source/common/notify.cpp b/source/common/notify.cpp index fe0b1cb..376ed07 100644 --- a/source/common/notify.cpp +++ b/source/common/notify.cpp @@ -49,8 +49,29 @@ void Notify::update() { for (int i = 0; i < (int)notifications.size(); ++i) { + // Si la notificación anterior está "saliendo", no hagas nada + if (i > 0) + { + if (notifications[i - 1].state == ns_rising) + { + break; + } + } + notifications[i].counter++; + // Hace sonar la notificación en el primer frame + if (notifications[i].counter == 1) + { + if (options->notifications.sound) + { + if (notifications[i].state == ns_rising) + { // Reproduce el sonido de la notificación + JA_PlaySound(sound); + } + } + } + // Comprueba los estados if (notifications[i].state == ns_rising) { @@ -245,14 +266,11 @@ void Notify::showText(std::string text1, std::string text2, int icon) // Crea el sprite de la notificación n.sprite = new Sprite(n.rect, n.texture, renderer); + // Deja la notificación invisible + n.texture->setAlpha(0); + // Añade la notificación a la lista notifications.push_back(n); - - // Reproduce el sonido de la notificación - if (options->notifications.sound) - { - JA_PlaySound(sound); - } } // Indica si hay notificaciones activas