JNGL
Easy to use cross-platform 2D game library
|
Inherit from this class to create a singleton that will be destroyed when your games exits. More...
#include <jngl/Singleton.hpp>
Public Member Functions | |
Singleton (const Singleton &)=delete | |
Singleton & | operator= (const Singleton &)=delete |
Singleton (Singleton &&)=delete | |
Singleton & | operator= (Singleton &&)=delete |
Static Public Member Functions | |
static T & | handle () |
Creates the Singleton if needed. | |
static T * | handleIfAlive () noexcept |
Doesn't create the Singleton, may return nullptr. | |
static void | destroy () noexcept |
Deletes the Singleton. | |
Inherit from this class to create a singleton that will be destroyed when your games exits.
You should use this instead of global / static variables, because some platforms (Android) don't destroy the process on exit and instead re-enter the main function.
Definition at line 23 of file Singleton.hpp.
|
inlinestatic |
Creates the Singleton if needed.
Definition at line 32 of file Singleton.hpp.
|
inlinestaticnoexcept |
Doesn't create the Singleton, may return nullptr.
Definition at line 41 of file Singleton.hpp.
|
inlinestaticnoexcept |
Deletes the Singleton.
Definition at line 46 of file Singleton.hpp.