Las notificaciones simultaneas aparecen de forma escalonada

This commit is contained in:
2023-10-03 21:48:24 +02:00
parent eb713006c6
commit ee261f4509
2 changed files with 24 additions and 10 deletions

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

View File

@@ -153,10 +153,6 @@ void Title::checkEvents()
showCheevos = !showCheevos;
break;
case SDL_SCANCODE_Z:
initMarquee();
break;
default:
break;
}