From 1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 19 Mar 2019 23:06:27 +0800 Subject: *rename --- source/libs/asura-lib-core/application.h | 93 ++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 source/libs/asura-lib-core/application.h (limited to 'source/libs/asura-lib-core/application.h') diff --git a/source/libs/asura-lib-core/application.h b/source/libs/asura-lib-core/application.h new file mode 100644 index 0000000..6ae3218 --- /dev/null +++ b/source/libs/asura-lib-core/application.h @@ -0,0 +1,93 @@ +#ifndef __ASURA_ENGINE_APPLICATION_H__ +#define __ASURA_ENGINE_APPLICATION_H__ + +#include +#include +#include + +#include "config.h" + +namespace AsuraEngine +{ + + /// + /// 子模块 + /// + enum SubModules + { + ASURA_MODULE_NONE = 0X00000000U, + + ASURA_MODULE_GRAPHICS = 1 << 1, + ASURA_MODULE_AUDIO = 1 << 2, + ASURA_MODULE_FONT = 1 << 3, + ASURA_MODULE_INPUT = 1 << 4, + ASURA_MODULE_MATH = 1 << 5, + ASURA_MODULE_PHYSICS = 1 << 6, + ASURA_MODULE_TIME = 1 << 7, + ASURA_MODULE_WINDOW = 1 << 8, + + ASURA_MODULE_ALL = 0XFFFFFFFFU + }; + + /// + /// 管理主循环 + /// + ASURA_ABSTRACT class Application + { + public: + + Application(); + + virtual ~Application(); + + /// + /// 初始化进入前的子系统 + /// + bool InitSubModules(uint flag = ASURA_MODULE_ALL); + + /// + /// 进入入口 + /// + virtual void Run(int argc, char* args[]); + + /// + /// 退出run时的处理 + /// + virtual void OnExit(); + + protected: + + /// + /// 添加module,application拥有module的所有权。 + /// + void EnqueueModule(Module* module); + + private: + + /// + /// 子模块初始化函数,在各自模块的文件夹下面实现。 + /// + bool InitGraphics(); + bool InitAudio(); + bool InitFont(); + bool InitInput(); + bool InitMath(); + bool InitPhysics(); + bool InitTime(); + bool InitWindow(); + + /// + /// Lua state. + /// + lua_State* mLuaState; + + /// + /// 载入的Asura libs,会按照队列顺序初始化,并在退出时执行退出函数。 + /// + std::queue mModules; + + }; + +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0