tots els singletons tornats a fer a la vieja y gorda usanza
This commit is contained in:
@@ -8,26 +8,17 @@
|
||||
#include <unordered_map> // Para unordered_map, operator==, _Node_cons...
|
||||
#include <utility> // Para pair
|
||||
|
||||
// [SINGLETON]
|
||||
Input *Input::input_ = nullptr;
|
||||
// Singleton
|
||||
Input *Input::instance_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
void Input::init(const std::string &game_controller_db_path)
|
||||
{
|
||||
Input::input_ = new Input(game_controller_db_path);
|
||||
}
|
||||
// Inicializa la instancia única del singleton
|
||||
void Input::init(const std::string &game_controller_db_path) { Input::instance_ = new Input(game_controller_db_path); }
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
void Input::destroy()
|
||||
{
|
||||
delete Input::input_;
|
||||
}
|
||||
// Libera la instancia
|
||||
void Input::destroy() { delete Input::instance_; }
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
Input *Input::get()
|
||||
{
|
||||
return Input::input_;
|
||||
}
|
||||
// Obtiene la instancia
|
||||
Input *Input::get() { return Input::instance_; }
|
||||
|
||||
// Constructor
|
||||
Input::Input(const std::string &game_controller_db_path)
|
||||
|
||||
Reference in New Issue
Block a user