Las notificaciones simultaneas ya no aparecen todas de golpe

This commit is contained in:
2023-09-27 17:56:11 +02:00
parent e41aec37b0
commit 8627c4c405

View File

@@ -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