Eliminades les icones de les notificacions (herencia del CC original)
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -330,9 +330,6 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/config/demo2.bin", t_data);
|
||||
asset->add(prefix + "/data/config/gamecontrollerdb.txt", t_data);
|
||||
|
||||
// Notificaciones
|
||||
asset->add(prefix + "/data/notification/notify.png", t_bitmap);
|
||||
|
||||
// Musicas
|
||||
asset->add(prefix + "/data/music/intro.ogg", t_music);
|
||||
asset->add(prefix + "/data/music/playing.ogg", t_music);
|
||||
|
||||
@@ -12,9 +12,16 @@ Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapF
|
||||
bgColor = options.notification.color;
|
||||
waitTime = 150;
|
||||
stack = false;
|
||||
hasIcons = iconFile == "" ? false : true;
|
||||
iconTexture = nullptr;
|
||||
textTexture = nullptr;
|
||||
text = nullptr;
|
||||
|
||||
// Crea objetos
|
||||
if (hasIcons)
|
||||
{
|
||||
iconTexture = new Texture(renderer, iconFile);
|
||||
}
|
||||
textTexture = new Texture(renderer, bitmapFile);
|
||||
text = new Text(textFile, textTexture, renderer);
|
||||
sound = JA_LoadSound(soundFile.c_str());
|
||||
@@ -24,9 +31,15 @@ Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapF
|
||||
Notify::~Notify()
|
||||
{
|
||||
// Libera la memoria de los objetos
|
||||
if (textTexture)
|
||||
delete textTexture;
|
||||
|
||||
if (iconTexture)
|
||||
delete iconTexture;
|
||||
|
||||
if (text)
|
||||
delete text;
|
||||
|
||||
JA_DeleteSound(sound);
|
||||
|
||||
for (auto notification : notifications)
|
||||
@@ -276,7 +289,7 @@ void Notify::showText(std::string text1, std::string text2, int icon)
|
||||
}
|
||||
|
||||
// Dibuja el icono de la notificación
|
||||
if (icon >= 0 && numTexts == 2)
|
||||
if (hasIcons && icon >= 0 && numTexts == 2)
|
||||
{
|
||||
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture);
|
||||
sp->setPos({paddingIn, paddingIn, iconSize, iconSize});
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
std::vector<notification_t> notifications; // La lista de notificaciones activas
|
||||
JA_Sound_t *sound; // Sonido a reproducir cuando suena la notificación
|
||||
bool stack; // Indica si las notificaciones se apilan
|
||||
bool hasIcons; // Indica si el notificador tiene textura para iconos
|
||||
|
||||
// Elimina las notificaciones finalizadas
|
||||
void clearFinishedNotifications();
|
||||
|
||||
@@ -69,7 +69,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
|
||||
infoResolution = std::to_string(DM.w) + " X " + std::to_string(DM.h) + " AT " + std::to_string(DM.refresh_rate) + " HZ";
|
||||
|
||||
// Crea los objetos
|
||||
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"));
|
||||
notify = new Notify(renderer, "", asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"));
|
||||
|
||||
// Define el color del borde para el modo de pantalla completa
|
||||
borderColor = {0x00, 0x00, 0x00};
|
||||
|
||||
Reference in New Issue
Block a user