summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine/Application.cpp')
-rw-r--r--Source/Asura.Engine/Application.cpp44
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