diff options
author | chai <chaifix@163.com> | 2018-05-20 23:37:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-05-20 23:37:11 +0800 |
commit | 51ba9cb2a6b0b9395a2912eadeb954c95e4c1d3c (patch) | |
tree | 58ce7d8b50c0d9a451d26bf0b3230b1c2e2f2782 /src/libjin/core | |
parent | adfda73e1810973a40b7bedd9a8edc3e7ab89e3c (diff) |
修改目录结构
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; + } }; } } |