diff options
author | chai <chaifix@163.com> | 2019-03-12 00:39:26 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-12 00:39:26 +0800 |
commit | 70b82d1981c0de3c7b77670ff8abcfeb26815142 (patch) | |
tree | f69c05bcd204cc3f9bf745be37a2ba5911e52436 /Source/Asura.Engine/Application.cpp | |
parent | c19a282e10f51ddd50d198b903f8fbd5a2238b62 (diff) |
*misc
Diffstat (limited to 'Source/Asura.Engine/Application.cpp')
-rw-r--r-- | Source/Asura.Engine/Application.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/Source/Asura.Engine/Application.cpp b/Source/Asura.Engine/Application.cpp index 59f5aae..598bca8 100644 --- a/Source/Asura.Engine/Application.cpp +++ b/Source/Asura.Engine/Application.cpp @@ -1,6 +1,9 @@ -#include "Application.h" #include "Sdl2/SDL.h" #include "Exceptions/Exception.h" +#include "Scripting/Luax.hpp" +#include "Application.h" + +using namespace Luax; namespace AsuraEngine { @@ -15,7 +18,7 @@ namespace AsuraEngine } - bool Application::Application::InitSubModules(uint flag) + bool Application::InitSubModules(uint flag) { // ʼģ #define TryInitSubModule(module_name, func_name) \ @@ -23,15 +26,34 @@ namespace AsuraEngine throw Exception("Asura init submodule %s failed.", #module_name); TryInitSubModule(GRAPHICS, Graphics); - TryInitSubModule(AUDIO, Audio); - TryInitSubModule(FONT, Font); - TryInitSubModule(INPUT, Input); - TryInitSubModule(MATH, Math); - TryInitSubModule(PHYSICS, Physics); - TryInitSubModule(TIME, Time); - TryInitSubModule(WINDOW, Window); - - + TryInitSubModule(AUDIO, Audio); + TryInitSubModule(FONT, Font); + TryInitSubModule(INPUT, Input); + TryInitSubModule(MATH, Math); + TryInitSubModule(PHYSICS, Physics); + TryInitSubModule(TIME, Time); + TryInitSubModule(WINDOW, Window); + + } + + void Application::PortToLua() + { + LuaxState state(mLuaState); + +#define RegisterLuaFactory(T) state.RegisterFactory<T>(); + + state.SetToGlobalNamespace(); + state.PushNamespace("AsuraEngine"); + + RegisterLuaFactory(AEGraphics::Image>); + +#ifdef ASURA_AUTHOR + state.PushNamespace("Version"); + + state.PopNamespace(); // AsuraEngine.Version +#endif + + state.PopNamespace(); // AsuraEngine } }
\ No newline at end of file |