From 51ba9cb2a6b0b9395a2912eadeb954c95e4c1d3c Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 20 May 2018 23:37:11 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/core/game.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/libjin/core') 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 + +#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; + } }; } } -- cgit v1.1-26-g67d0