Las notificaciones se pueden configurar para que no se apilen
This commit is contained in:
@@ -11,6 +11,7 @@ Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapF
|
||||
this->options = options;
|
||||
bgColor = options->notification.color;
|
||||
waitTime = 100;
|
||||
stack = false;
|
||||
|
||||
// Crea objetos
|
||||
iconTexture = new Texture(renderer, iconFile);
|
||||
@@ -149,6 +150,11 @@ void Notify::clearFinishedNotifications()
|
||||
// Muestra una notificación de texto por pantalla;
|
||||
void Notify::showText(std::string text1, std::string text2, int icon)
|
||||
{
|
||||
if (!stack)
|
||||
{
|
||||
clearNotifications();
|
||||
}
|
||||
|
||||
// Inicializa variables
|
||||
const int iconSize = 16;
|
||||
const int paddingOut = 1;
|
||||
@@ -250,7 +256,6 @@ void Notify::showText(std::string text1, std::string text2, int icon)
|
||||
SDL_RenderClear(renderer);
|
||||
}
|
||||
|
||||
|
||||
// Dibuja el icono de la notificación
|
||||
if (icon >= 0 && numTexts == 2)
|
||||
{
|
||||
@@ -295,4 +300,15 @@ bool Notify::active()
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Finaliza y elimnina todas las notificaciones activas
|
||||
void Notify::clearNotifications()
|
||||
{
|
||||
for (int i = 0; i < (int)notifications.size(); ++i)
|
||||
{
|
||||
notifications[i].state = ns_finished;
|
||||
}
|
||||
|
||||
clearFinishedNotifications();
|
||||
}
|
||||
Reference in New Issue
Block a user