diff options
Diffstat (limited to 'src/libjin/core')
-rw-r--r-- | src/libjin/core/game.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libjin/core/game.h b/src/libjin/core/game.h index e36a71b..cd99b42 100644 --- a/src/libjin/core/game.h +++ b/src/libjin/core/game.h @@ -1,6 +1,10 @@ #ifndef __JIN_CORE_GAME_H #define __JIN_CORE_GAME_H +#include <SDL2/SDL.h> + +#include "../utils/macros.h" + namespace jin { namespace core @@ -19,9 +23,9 @@ namespace core return g_game ? g_game : (g_game = new Game()); } - inline void quit() + inline void quit() // quit game loop { - run = false; + CallOnce(_quit()); } inline bool running() @@ -29,6 +33,11 @@ namespace core return run; } + inline void exit() // exit game + { + CallOnce(_exit()); + } + private: Game(); @@ -36,6 +45,16 @@ namespace core static Game* g_game; bool run; + + inline void _exit() + { + SDL_Quit(); + } + + inline void _quit() + { + run = false; + } }; } } |