From 7c8c68d79343d04be382334c15a73d079450857c Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 17 Oct 2021 23:05:01 +0800 Subject: *misc --- Editor/EditorMain.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Editor/EditorMain.cpp') diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp index 8fea1df..9745598 100644 --- a/Editor/EditorMain.cpp +++ b/Editor/EditorMain.cpp @@ -1,11 +1,13 @@ #include #include #include "GUI/EditorWindows.h" -#include "Runtime/Scripting/LuaBind.h" +#include "Runtime/LuaBind/LuaBind.h" #include "EditorManager.h" #include "Runtime/Graphics/OpenGL.h" #include "Editor/Scripting/EditorScripting.h" +using namespace LuaBind; + static int MainLoop() { BOOL returnValue; @@ -37,6 +39,20 @@ void OpenLogTags() { //log_open_tag("WndProc"); //log_open_tag("Menu"); + log_open_tag("Scripting"); +} + +void InitLuaState() +{ + LuaBind::VM vm; + vm.Setup(); + vm.OpenLibs(); + if (!SetupGameLabEditorScripting(vm.GetMainThread())) + { + log_error("Can't setup scripting."); + } + LuaBind::State state = vm.GetMainState(); + state.DoFile("./Scripts/EditorApplication.lua"); } #ifdef GAMELAB_DEBUG @@ -48,11 +64,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) OpenLogTags(); WindowUtil::Init(); - if (!SetupGameLabEditorScripting()) - { - log_error("Can't setup scripting."); - return 0; - } + InitLuaState(); ContainnerWindow* wnd = new ContainnerWindow(); Vector2f min = Vector2f(100, 100); -- cgit v1.1-26-g67d0