tots els singletons tornats a fer a la vieja y gorda usanza
This commit is contained in:
@@ -12,26 +12,17 @@
|
||||
#include "texture.h" // Para Texture
|
||||
#include "resource.h"
|
||||
|
||||
// [SINGLETON]
|
||||
Notifier *Notifier::notifier_ = nullptr;
|
||||
// Singleton
|
||||
Notifier *Notifier::instance_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
void Notifier::init(const std::string &icon_file, std::shared_ptr<Text> text)
|
||||
{
|
||||
Notifier::notifier_ = new Notifier(icon_file, text);
|
||||
}
|
||||
// Inicializa la instancia única del singleton
|
||||
void Notifier::init(const std::string &icon_file, std::shared_ptr<Text> text) { Notifier::instance_ = new Notifier(icon_file, text); }
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
void Notifier::destroy()
|
||||
{
|
||||
delete Notifier::notifier_;
|
||||
}
|
||||
// Libera la instancia
|
||||
void Notifier::destroy() { delete Notifier::instance_; }
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
Notifier *Notifier::get()
|
||||
{
|
||||
return Notifier::notifier_;
|
||||
}
|
||||
// Obtiene la instancia
|
||||
Notifier *Notifier::get() { return Notifier::instance_; }
|
||||
|
||||
// Constructor
|
||||
Notifier::Notifier(std::string icon_file, std::shared_ptr<Text> text)
|
||||
@@ -76,7 +67,7 @@ void Notifier::update()
|
||||
if (notifications_[i].state == NotificationStatus::RISING)
|
||||
{
|
||||
// Reproduce el sonido de la notificación
|
||||
Audio::get().playSound("notify.wav");
|
||||
Audio::get()->playSound("notify.wav");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user