From 789895b4b9f99668b8b772f271d07d1ce3115742 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 5 Oct 2018 15:40:31 +0800 Subject: *update --- src/libjin/Game/Game.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/libjin/Game/Game.h (limited to 'src/libjin/Game/Game.h') diff --git a/src/libjin/Game/Game.h b/src/libjin/Game/Game.h new file mode 100644 index 0000000..725c62c --- /dev/null +++ b/src/libjin/Game/Game.h @@ -0,0 +1,58 @@ +#ifndef __LIBJIN_CORE_GAME_H +#define __LIBJIN_CORE_GAME_H + +#include "SDL2/SDL.h" + +#include "../Common/Subsystem.hpp" +#include "../utils/macros.h" +#include "../Input/Event.h" + +namespace jin +{ +namespace core +{ + + class Game : public Subsystem + { + 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(); + + }; + +} // core +} // jin + +#endif // __LIBJIN_CORE_GAME_H -- cgit v1.1-26-g67d0