aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/core
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-20 23:37:11 +0800
committerchai <chaifix@163.com>2018-05-20 23:37:11 +0800
commit51ba9cb2a6b0b9395a2912eadeb954c95e4c1d3c (patch)
tree58ce7d8b50c0d9a451d26bf0b3230b1c2e2f2782 /src/libjin/core
parentadfda73e1810973a40b7bedd9a8edc3e7ab89e3c (diff)
修改目录结构
Diffstat (limited to 'src/libjin/core')
-rw-r--r--src/libjin/core/game.h23
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;
+ }
};
}
}