aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/core/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/core/game.h')
-rw-r--r--src/libjin/core/game.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/libjin/core/game.h b/src/libjin/core/game.h
index cd99b42..e155607 100644
--- a/src/libjin/core/game.h
+++ b/src/libjin/core/game.h
@@ -3,13 +3,14 @@
#include <SDL2/SDL.h>
+#include "../common/singleton.h"
#include "../utils/macros.h"
namespace jin
{
namespace core
{
- class Game
+ class Game : public Singleton<Game>
{
public:
@@ -18,14 +19,9 @@ namespace core
};
- static inline Game* get()
- {
- return g_game ? g_game : (g_game = new Game());
- }
-
inline void quit() // quit game loop
{
- CallOnce(_quit());
+ CALLONCE(_quit());
}
inline bool running()
@@ -35,14 +31,15 @@ namespace core
inline void exit() // exit game
{
- CallOnce(_exit());
+ CALLONCE(_exit());
}
private:
Game();
-
- static Game* g_game;
+ ~Game() {};
+
+ SINGLETON(Game);
bool run;