From 70b82d1981c0de3c7b77670ff8abcfeb26815142 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 12 Mar 2019 00:39:26 +0800 Subject: *misc --- Source/Asura.Engine/Application.cpp | 44 +++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'Source/Asura.Engine/Application.cpp') 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(); + + 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 -- cgit v1.1-26-g67d0