aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Game/je_game.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Game/je_game.h')
-rw-r--r--src/libjin/Game/je_game.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/libjin/Game/je_game.h b/src/libjin/Game/je_game.h
new file mode 100644
index 0000000..9323177
--- /dev/null
+++ b/src/libjin/Game/je_game.h
@@ -0,0 +1,58 @@
+#ifndef __LIBJIN_CORE_GAME_H
+#define __LIBJIN_CORE_GAME_H
+
+#include "../common/je_subsystem.hpp"
+#include "../utils/je_macros.h"
+#include "../input/je_Event.h"
+
+#include "SDL2/SDL.h"
+
+namespace jin
+{
+ namespace core
+ {
+
+ class Game : public Subsystem<Game>
+ {
+ public:
+
+ typedef void(*onLoad)();
+ typedef void(*onEvent)(jin::input::Event* e);
+ typedef void(*onUpdate)(int dt);
+ typedef void(*onDraw)();
+
+ struct Setting : SettingBase
+ {
+ onEvent eventHandler;
+ onUpdate updater;
+ onDraw drawer;
+ onLoad loader;
+ };
+
+ void run();
+ inline void stop() { _running = false; };
+ inline bool running() { return _running; };
+
+ private:
+
+ Game();
+ ~Game() {};
+
+ singleton(Game);
+
+ onEvent _onEvent;
+ onUpdate _onUpdate;
+ onDraw _onDraw;
+ onLoad _onLoad;
+
+ bool _running;
+
+ bool initSystem(const SettingBase* setting);
+ void quitSystem();
+
+ };
+
+ } // namespace core
+} // namespace jin
+
+#endif // __LIBJIN_CORE_GAME_H