From 878518babe95b0188fabeb2cc038d7584a3779f5 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 28 Sep 2024 12:46:53 +0200 Subject: [PATCH] Eliminades les icones de les notificacions (herencia del CC original) --- data/notification/notify.png | Bin 1502 -> 0 bytes source/director.cpp | 3 --- source/notify.cpp | 23 ++++++++++++++++++----- source/notify.h | 1 + source/screen.cpp | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) delete mode 100644 data/notification/notify.png diff --git a/data/notification/notify.png b/data/notification/notify.png deleted file mode 100644 index 753f74c7a8b7ac9a49e86f21d79706be3e4d344e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1502 zcmcJPdpOez7{?bebR1iBSnNDPSrRHTw++p$%go9pLRUJjxlLwlZlNKCsIZk&E@K@Q zHEQD&r9k{pb69^Kn=YO^vM@AP`8?%M*iN zC;jKBsjfSf7ruKP8xrsyt{~2Av4n$axl}d zP7P5q6|+S6Ody041UJj()|5~EA$6Cw$mC;HW6j3RxP$c{c|JOBZL%=Cc5d<3weHaJ z5Fvxl6$w9g2Pb5uO!P_IzhfSJg6#tGEUZpUPYtih!2GLlnBk+_=9XxXPXRhw-n}hlpH(KzLqp# zn-xxMjX$iW9SG*0F0!7qxpigMG@w zlce87Z7G**v@hTvm6{~B(UNo*>S>OCy#RB}5{ANdpDCQ7xWSnSb2oU*y#s*}AEPZb z7)?(_5;3>&6Q5>Vs6qEsfM?&>mxcAO9*U7QKdYNZ5Ve;)!dllUEm3ok!|zq)#9AXO=98kc{u!rQonZ+xxQ1Gq(g8 zy%rT)P;=lSn-*pM%gO@e+ew7}X1Kk5C`UdKmeln)HDMZDGN{6;&dxiF*4)!keEc10 zH{;Cq4!Rx8i_q0ryN$z|Y@BDZPPLEgT$zes@@kN1zSu%c$;=85D!34zVrDe?oAH9I zt!jzO1i~PpO$H8wG+Tbw`y-uqu{Lr)?&mw>D z&?FDTt@MGX7Zdsh|6&Ac&82KnNO@!-#IK19$nyhF1THm@&L^y$8dKGEXCK=bhs z`S2CypQ~TYI=*J5#@o!ka-_BnT0ay6VR9g{;+VTPx+! z)eJL@C~6VYq1`#BgOtvt((K~ek?8gG@j}vV-p60x8XhC7vJpz?%0_iPiOy+3cV}5c z>qpo~bcqZd^_idYorsY|7LS7b(n!{Ts7O}P5~WA-nso#=8(XW|7#r0)Aric!X>qQQ^JC)@O!d%Q zVa?w4CF Bz%~E? diff --git a/source/director.cpp b/source/director.cpp index fa02cb7..bfdeb1f 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -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); diff --git a/source/notify.cpp b/source/notify.cpp index 5cdfa73..54ab98d 100644 --- a/source/notify.cpp +++ b/source/notify.cpp @@ -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 - iconTexture = new Texture(renderer, iconFile); + 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 - delete textTexture; - delete iconTexture; - delete text; + 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}); diff --git a/source/notify.h b/source/notify.h index 6a3a87c..6506282 100644 --- a/source/notify.h +++ b/source/notify.h @@ -67,6 +67,7 @@ private: std::vector 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(); diff --git a/source/screen.cpp b/source/screen.cpp index b9de282..0653152 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -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};